The following image shows which test fails:
The boilerplate template was cloned 16 Jan 2021
Relevent code in ‘2_functional-tests.js’:
const Browser = require("zombie");
Browser.site = 'https://plum-stupendous-drive.glitch.me';
suite("Functional Tests with Zombie.js", function() {
const browser = new Browser(
//{waitDuration: 5 * 1000}
);
suiteSetup(function done() {
return browser.visit("/", done);
});
suite('"Famous Italian Explorers" form', function() {
// #5
test('submit {"surname" : "Colombo"} - write your e2e test...', 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.element("span#dates", 1);
done();
})
});
// #6
test('submit "surname" : "Vespucci" - write your e2e test...', function(done) {
browser.fill("surname", "Vespucci").pressButton("submit", function() {
browser.assert.success();
browser.assert.text("span#name", "Amerigo");
browser.assert.text("span#surname", "Vespucci");
browser.assert.element("span#dates", 1);
done();
});
});
});
});
All my code for the project may be found here.
The following shows up in the glitch console when the app runs :
AssertionError [ERR_ASSERTION]: No open window with an HTML document
at Browser.field (/rbd/pnpm-volume/e8239455-1801-4804-baee-7e96bd72875f/node_modules/zombie/lib/index.js:598:5)
at Browser.fill (/rbd/pnpm-volume/e8239455-1801-4804-baee-7e96bd72875f/node_modules/zombie/lib/index.js:646:24)
at Context.<anonymous> (tests/2_functional-tests.js:80:15)
at processImmediate (node:internal/timers:463:21)
I’ve tried updating all packages to the following:
"dependencies": {
"body-parser": "^1.19.0",
"chai": "^4.2.0",
"chai-http": "^4.3.0",
"cors": "^2.8.5",
"express": "^5.0.0-alpha.2",
"mocha": "^8.2.1",
"node": "^15.4.0",
"npm": "^7.4.2",
"zombie": "^6.1.4"
},
I’ve also tried adding wait() and then() functions in the code, but that didn’t change anything. ‘npm/zombie’ documentation mentions wrapping the fill() function in a before() wrapper, but when I tried that, none of the tests passed, so I removed it.
Any help/ advice would be greatly appreciated.
Many thanks for taking a look.
Phil