Error :
1) Functional Tests with Zombie.js
"Famous Italian Explorers" form
Submit the surname "Colombo" in the HTML form:
Uncaught AssertionError [ERR_ASSERTION]: Expected selector "span#name" to return one or more elements
at Assert.text (node_modules/zombie/lib/assert.js:182:5)
at /home/runner/boilerplate-mochachai/tests/2_functional-tests.js:89:21
at done (node_modules/zombie/lib/eventloop.js:424:9)
at Timeout.timeout (node_modules/zombie/lib/eventloop.js:436:31)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7)
Situation :
The first test item in this problem, “All tests must succeed.” times out every time and does not pass the test.
The other four tests have already been passed.
What have I tried :
- Searching in the forum
- Checking for typos
- Extending
this.timeout
- Change browsers (Chrome & Edge)
I also tried to output err
or res
to console in the done
method, but nothing was output.
// #5
test('Submit the surname "Colombo" in the HTML form', function(done) {
browser.fill('surname', 'Colombo').then(() => {
browser.pressButton('submit', () => {
browser.assert.success(); // status: OK 200
browser.assert.text('span#name', 'Cristoforo');
browser.assert.text('span#surname', 'Colombo');
browser.assert.elements('span#dates', 1);
done((err, res) => err ? console.log(err) : console.log(res));
});
});
});
This led me to believe that the test was not wrong, but rather that it timed out before reaching the test.
references :
test suite:
// Headless browser for testing web pages
const Browser = require('zombie');
Browser.site = 'https://boilerplate-mochachai.so-san.repl.co';
const browser = new Browser();
// Set browser to the route "/"
suiteSetup(done => browser.visit('/', done))
suite('Functional Tests with Zombie.js', function() {
this.timeout(50000);
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').then(() => {
browser.pressButton('submit', () => {
browser.assert.success(); // status: OK 200
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()
});
});
});