I am trying to create an instance of the headless browser using zombie. I set the site to “http:localhost:3000”, initially I was getting a circular reference error when visiting ‘/’, I solved this by changing the browser.visit(‘/’,done), by browser.visit(‘/’,function(){done()}). However if I log browser.html() I get bind EINVAL 0.0.0.0
Your code so far
const Browser = require('zombie');
Browser.site = 'http://localhost:3000'
const browser = new Browser();
suite('Functional Tests with Zombie.js', function () {
suiteSetup(function(done){
return browser.visit('/',function() {
console.log(browser.html());
done();
});
});
this.timeout(5000);
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) {
browser.fill('surname','Colombo').then(() => {
browser.pressButton('submit',() => {
browser.assert.success();
browser.assert.text('span#name','Cristoforo');
browser.assert.text('span#surname','Colombo');
browser.assert.elements('span#dates',1);
done();
});
});
});
// #6
test('Submit the surname "Vespucci" in the HTML form', function (done) {
browser.fill('#i1','Vespucci').then(() => {
browser.pressButton('submit',() => {
browser.assert.success();
browser.assert.text('span#name','Amerigo');
browser.assert.text('span#surname','Vespucci');
browser.assert.elements('span#dates',1);
done();
});
});
});
});
});
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Challenge Information:
Quality Assurance and Testing with Chai - Run Functional Tests Using a Headless Browser II
http:localhost:3000 is not a valid URL, you are missing //, i.e. http://localhost:3000
The proper way of using done with browser.visit is as a callback. You should not invoke it.
Not sure why are using trying to log out browser.html() but when I do that I get back the index.html content and doing so doesn’t prevent me from passing any of the tests.