Quality Assurance and Testing with Chai - Run Functional Tests Using a Headless Browser

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() {
  const browser = new Browser();

  suite('Headless browser', function() {
    test('should have a working "site" property', function() {
  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.text('span#name', 'Cristoforo');
        browser.assert.text('span#surname', 'Colombo');
        browser.assert.elements('span#dates', 1);
    // #6
    test('Submit the surname "Vespucci" in the HTML form', function(done) {


I followed the instruction to change the browser.site to Browser.localhost(‘example.com’, (process.env.PORT || 3000)); and still get an error.

Move the suiteSetup up right after the const browser = new Browser(); and just pass the done callback (don’t invoke it).

const browser = new Browser();

suiteSetup(function (done) {
  return browser.visit('/', done);

With that, your code passes for me.

Not sure what other error you are getting (you said you change the browser.site) but I just tested my old passing code and it had an issue with the connection I haven’t seen before. It might be the nodejs version I’m using now, but I had to change the Browser.site to use the address (instead of localhost or

Browser.site = '';

Just wanted to mention it.

1 Like

Thanks for mentioning the Browser.site = ''; it also helps to pass the test.

I followed all your instructions given here and obtained all tests pass in my replit project but doesn’t pass any tests in the curriculum page

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.