Run Functional Tests using a Headless Browser (All Test Should Pass) is wrong

Tell us what’s happening:

Your project link(s)

solution: https://boilerplate-mochachai-10.henrychang7.repl.co
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();
});
});


Your browser information:

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

Challenge: Run Functional Tests using a Headless Browser

Link to the challenge:

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();
  });
});

(This is much more clearer)

Tell us what’s happening:

Your project link(s)

solution: https://boilerplate-mochachai-10.henrychang7.repl.co

    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();
      });
    });
  });
});

Your browser information:

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

Challenge: Run Functional Tests Using a Headless Browser II

Link to the challenge:

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();
  });
});

});
});

This is much more clearer

Hello there,

Would you mind showing the output of the Replit console? It should show how many tests are passing.


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).


Also, I have combined your posts, as they are likely the same issue.

Why have you deleted important parts of the functional tests?

I suggest you reclone the boilerplate, and start again.

Hi,

I started this section over again and i am back to the part i am focusing on .


// #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();
});
});


You have removed very necessary code:

const Browser = require("zombie");

suite("Functional Tests with Zombie.js", function () {

  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.fail();

        done();
      });
    });
    // #6
    test('submit "surname" : "Vespucci" - write your e2e test...', function (done) {
      assert.fail();

      done();
    });
  });
});

This is what the boilerplate has for sections 5 and 6. It is needed, in order for the tests to pass. I recommend you copy the whole of the 2_functional-tests.js file from the boilerplate, and start the functional section again. Read the instructions carefully, and do not delete suites/code.

Hope this clarifies

Hi,

So I did my best to convert the functional section again and i keep failing. Here is my code below.

var Browser = require(“zombie”);
Broweser.site = ‘https://boilerplate-mochachai-23.henrychang7.repl.co
suite(“Functional Tests with Zombie.js”, function () {
const browser = new Browser();
suiteSetup(function(done) {
return browser.visit(’/’, done);
});
suite(’“Famous Italian Explorers” form’, function () {

You are deleting, and moving around code that you should not.

Start from the boilerplate: boilerplate-mochachai/2_functional-tests.js at main · freeCodeCamp/boilerplate-mochachai · GitHub

You should have:

  • 2 sets of suites, separate from one another
  • Each set should have 1 suite within it
  • The first set should have no more, and no less than 4 tests
  • The second set should have no more, and no less than 2 tests

Each suite and each test should have one opening, and one closing bracket.

This is a simple syntax/ordering issue, and is completely avoidable if you do not change the boilerplate structure.

I got it. thank you. i overthink sometimes

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