I’ve tried searching for the solution to passing these tests, and I’ve read that there may be problems with the test themselves? The code I’ve written is as follows (I’ve tried many combinations), but I can’t see anything wrong with it…
My question is, have I made a mistake (any pointers greatly appreciated) or is there still a problem with the tests themselves?
Thank you.
Here is my code:
const Browser = require('zombie');
Browser.site = 'http://localhost:3000/'; // Your URL here
const browser = new Browser();
suiteSetup(function(done) {
return browser.visit('/', done( ));
});
suite('Functional Tests with Zombie.js', function () {
suite('Headless browser', function() {
test('should have a working "site" property', function() {
assert.isNotNull(browser.site);
});
});
suite('"Famous Italian Explorers" form', function() {
// #5
test('Submit the surname "Colombo" in the HTML form', function(done) {
browser.fill('surname', 'Colombo').pressButton('submit', function() {
browser.assert.success();
browser.assert.text('span#name', 'Cristoforo');
browser.assert.text('span#surname', 'Colombo');
browser.assert.elements('span#dates', 1);
done();
});
});
// #6
test('Submit the surname "Vespucci" in the HTML form', function (done) {
assert.fail();
done();
});
})
});
When your code is posted as it is now, it’s full of smart quotes, so I can’t do much with it.
Could you repaste all of your code within backticks please?
Just click on </> (or CTRL+e) and paste everything into the space provided.
Or, even better, just a link to your repl code.
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
I’ve since rolled my code back to a version which passes locally and remains stable (using ‘after’ code to reboot when the repl crashes): boilerplate-mochachai - Replit
Thank you very much for your reply. I’ve made the change but I am getting this error: 'AssertionError [ERR_ASSERTION]: No INPUT matching ‘surname’ ’ The full code is here. I’ve also added below my package.json contents just incase there is version issue between your packages and mine?
const Browser = require('zombie');
Browser.site = 'http://localhost:3000/'; // Your URL here
const browser = new Browser();
suiteSetup(function(done) {
return browser.visit('/', done( ));
});
suite('Functional Tests with Zombie.js', function () {
suite('Headless browser', function() {
test('should have a working "site" property', function() {
assert.isNotNull(browser.site);
});
});
suite('"Famous Italian Explorers" form', function() {
// #5
test('Submit the surname "Colombo" in the HTML form', function(done) {
browser.fill('surname', 'Colombo');
browser.pressButton('submit', function() {
browser.assert.success();
browser.assert.text('span#name', 'Cristoforo');
browser.assert.text('span#surname', 'Colombo');
browser.assert.elements('span#dates', 1);
done();
});
});
// #6
test('Submit the surname "Vespucci" in the HTML form', function (done) {
assert.fail();
done();
});
})
});
Hello! Unfortunately, removing the parenthesis gives me this error? Are there any other differences between the working code and mine?
‘TypeError: bind EINVAL 0.0.0.0’
Here is my full code that generates this error:
const Browser = require('zombie');
Browser.site = 'http://localhost:3000/'; // Your URL here
const browser = new Browser();
suiteSetup(function(done) {
return browser.visit('/', done);
});
suite('Functional Tests with Zombie.js', function () {
suite('Headless browser', function() {
test('should have a working "site" property', function() {
assert.isNotNull(browser.site);
});
});
suite('"Famous Italian Explorers" form', function() {
// #5
test('Submit the surname "Colombo" in the HTML form', function(done) {
browser.fill('surname', 'Colombo');
browser.pressButton('submit', function() {
browser.assert.success();
browser.assert.text('span#name', 'Cristoforo');
browser.assert.text('span#surname', 'Colombo');
browser.assert.elements('span#dates', 1);
done();
});
});
// #6
test('Submit the surname "Vespucci" in the HTML form', function (done) {
assert.fail();
done();
});
})
});
Thank you! I’ve eventually got this to work, thanks to your steer and changing the Browser.site declaration (on localhost) to:
Browser.site = '0.0.0.0:3000';
I really appreciate your time helping me out. I think it would be great for freeCodeCamp to provide more guidance to users using localhost (especially given the timeout issues using replit), as this bug is quite frustrating.