The last three exercises are taking an unreasonable amount of time for me. #23 only worked when I did something differently from what the instructions said, and in task #24 I get all the tests to pass except for, ironically, the test that reads “All tests should pass.”
And the error message I get ( AssertionError [ERR_ASSERTION]: No open window with an HTML document
) has nothing to do with what the instructions cover, so I don’t know how to fix it.
I’ve read many forum posts as old as 3-4 years of people running into the same issue. In some cases, it’s because of Replit. In others, it’s because they’re running code locally. I’ve copied and pasted code which other users said had worked for them (only to make sure, because it was pretty much identical to my own code), and I keep getting the damn “no open window…” error.
I hate to be the “Well, my code is fine so the tests must be broken” guy, but I already wasted a lot of time on exercise #23 and enough people have had issues with these exercises for me to reasonably assume they’re faulty. Could someone confirm if this is the case? It’s already 2 am here so I’m calling it a day.
My code:
const Browser = require('zombie');
Browser.site="http://localhost:3000/";
suite('Functional Tests with Zombie.js', function () {
this.timeout(5000);
const browser = new Browser();
suiteSetup(function(done) {
return browser.visit('/', done());
});
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();
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();
});
});
});
NOTE: I’ve seen a few users say that done()
should not be invoked in
suiteSetup(function(done) {
return browser.visit('/', done());
});
… but adding those parenthesis was the only way for that exercise (#23, https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser ) to pass.