Simulate Actions Using a Headless Browser

My code:

const Browser = require('zombie');
Browser.site = 'https://boilerplate-mochachai.luizfernandorg.repl.co';
const browser = new Browser();
suite('Functional Tests with Zombie.js', function() {
  this.timeout(5000);
  
  suiteSetup(function(done) {
    return browser.visit('/', done);
  });
 /*
  suite('Headless browser', function() {
    test('should have a working "site" property', function() {
      assert.isNotNull(browser.site);
    });
  });
   
  suite('"Famous Italian Explorers" form', function () {
    // #5
    test('Submit the surname "Colombo" in the HTML form', function (done) {
      assert.fail();

      done();
    });
    // #6
    test('Submit the surname "Vespucci" in the HTML form', function (done) {
      assert.fail();

      done();
    });
  });*/
});

All the tests that are not commented out pass, but the page does not open, the page opens at the beginning when the test is running, but at the end of the test the page crash, if you uncomment ‘Headless browser’, it gives an error 502. What turns the test at the exercise to fail because there is no page to test.

1 Like

Not entirely sure what is going on, but it looks to be caused by the Functional Tests part.

You do have one of the done() calls in the wrong place but after fixing that I also have to comment out the this.timeout(5000); at the top of the Functional Tests function. Then the page stays up and passes the challenge I think you are on and is just failing the last two tests.

You replit

1 Like

Lasjorg thank you, it passes the test, but for some reason, the page still does not show.

1 Like

hi @luizfernandorg “done” is a callback function just add to it a parenthesis
code :

const Browser = require('zombie');
Browser.site = 'https://boilerplate-mochachai.luizfernandorg.repl.co';
const browser = new Browser();
suite('Functional Tests with Zombie.js', function() {
  this.timeout(5000);
  
  suiteSetup(function(done) {
    return browser.visit('/', done( ) );
  });
 /*
  suite('Headless browser', function() {
    test('should have a working "site" property', function() {
      assert.isNotNull(browser.site);
    });
  });
   
  suite('"Famous Italian Explorers" form', function () {
    // #5
    test('Submit the surname "Colombo" in the HTML form', function (done) {
      assert.fail();

      done();
    });
    // #6
    test('Submit the surname "Vespucci" in the HTML form', function (done) {
      assert.fail();

      done();
    });
  });*/
});
1 Like