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

Tell us what’s happening:
The last two test are not passing even I’m getting the following error:
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. (tests/2_functional-tests.js:80:15)
at processImmediate (node:internal/timers:463:21)

Your project link(s)

solution: https://boilerplate-mochachai-1.perezshumba.repl.co/

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Avast/115.0.21929.110

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

Link to the challenge:

What happened to all the code from the previous challenge?


You are missing the .then call and you are not calling pressButton on browser.

Look at the example code.

test('Submit the surname "Polo" in the HTML form', function (done) {
  browser.fill('surname', 'Polo').then(() => {
    browser.pressButton('submit', () => {
      browser.assert.success();
      browser.assert.text('span#name', 'Marco');
      browser.assert.text('span#surname', 'Polo');
      browser.assert.elements('span#dates', 1);
      done();
    });
  });
});

All the other code(s) passed except for challenge #5 from the 2_Functional-test.

You will have to update your Replit with the code you have locally or post a repo with the code. We can’t help if we can’t see the code.


Also, I don’t know why all your unit tests are set to explicitly fail in your Replit. All the steps should build up to a single passing app that is able to pass all the challenges. There is no point in having multiple versions of this with code that will only pass specific challenges.

https://boilerplate-mochachai-3.perezshumba.repl.co/

This is the link to the updated Replit.

Good Morning! Any suggested solutions?

You still do not have the setup code from the previous challenge.

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

and on Replit it has to be .site not .localhost


When I fix that your Replit passes the tests.

Hi there, After making the necessary changes the code still does not pass but I’m getting the following error message:
23 passing (882ms)
2 failing

  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. (tests/2_functional-tests.js:89:15)
    at process.processImmediate (node:internal/timers:471:21)

  2. Functional Tests with Zombie.js
    “Famous Italian Explorers” form
    Submit the surname “Vespucci” in the HTML form:
    AssertionError [ERR_ASSERTION]: No INPUT matching ‘surname’
    at Browser.fill (node_modules/zombie/lib/index.js:647:5)
    at Context. (tests/2_functional-tests.js:103:15)
    at process.processImmediate (node:internal/timers:471:21)

The done callback should not be invoked () inside browser.visit()

Browser.site should point to the Replit.

Move the Browser() constructor inside the test code after the timeout delay. You can try lowering the delay to 4000 as well (this specific test is much more reliable running locally than on Replit BTW).

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