Functional Tests using a Headless Browser

I am sure that I am doing everything correct. Actually, all of my tests get a tick and pass, but in FreeCodeCamp when I give the solution link and hit the “I’ve completed this challenge”, then it says that all tests failed.

const Browser = require('zombie');
Browser.site = 'https://boilerplate-mochachai.mohsenjafari.repl.co';

suite("e2e Testing with Zombie.js", function () {
  const browser = new Browser();
  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 () {
        // assert that status is OK 200
        browser.assert.success();
        // assert that the text inside the element 'span#name' is 'Cristoforo'
        browser.assert.text('span#name', 'Cristoforo');
        // assert that the text inside the element 'span#surname' is 'Colombo'
        browser.assert.text('span#surname', 'Colombo');
        // assert that the element(s) 'span#dates' exist and their count is 1
        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 () {
        // assert that status is OK 200
        browser.assert.success();
        // assert that the text inside the element 'span#name' is 'Amerigo'
        browser.assert.text('span#name', 'Amerigo');
        // assert that the text inside the element 'span#surname' is 'Vespucci'
        browser.assert.text('span#surname', 'Vespucci');
        // assert that the element(s) 'span#dates' exist and their count is 1
        browser.assert.element('span#dates', 1);
        
        done();
      });
    });
  });
});

Your browser information:

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

Challenge: Run Functional Tests using a Headless Browser

Link to the challenge:

Hey @mohhsen67!

An issue has been brought up on github for this challenge

1 Like