I’m stucked with this error
1) Functional Tests with Zombie.js
"Famous Italian Explorers" form
Submit the surname "Colombo" in the HTML form:
AssertionError [ERR_ASSERTION]: No INPUT matching 'surname'
at Browser.fill (node_modules\zombie\lib\index.js:647:5)
at Context.<anonymous> (tests\2_functional-tests.js:102:15)
at process.processImmediate (node:internal/timers:471:21)
I tried many different solutions from the forum but I still don’t get the right one.
Btw, I am using a localhost because I kept getting an error on Replit.
Here is my code:
const Browser = require('zombie');
const { suiteSetup } = require('mocha');
Browser.site = 'http://localhost:3000/'
suite('Functional Tests with Zombie.js', function() {
this.timeout(5000);
const browser = new Browser();
suite('Headless browser', function() {
test('should have a working "site" property', function() {
assert.isNotNull(Browser.site);
});
});
suiteSetup(function(done) {
return browser.visit('/', done());
});
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.equal();
done();
});
});
});
I followed the instruction to change the browser.site to Browser.localhost(‘example.com’, (process.env.PORT || 3000)); and still get an error.