In challenge #23 and #24 of Quality Assurance and Testing with Chai and Zombie, the challenges will not let me pass even though everything looks fine. I keep getting the errors:
“All tests should pass.
You should assert that the headless browser request succeeded.
You should assert that the text inside the element ‘span#name’ is ‘Amerigo’.
You should assert that the text inside the element ‘span#surname’ is ‘Vespucci’.
You should assert that the element ‘span#dates’ exist and its count is 1.”
And every time I think I’ve fixed it, it just says the same errors . I am stuck! Please help maybe I missed something!!
Your code so far
test(‘submit “surname” : “Colombo” - write your e2e test…’, function(done) {
// pressButton is ## Async ##.
// It waits for the ajax call to complete…
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(); // It's an async test, so we have to call 'done()''
});
//
});
test('submit the input "surname" : "Vespucci"', function(done) {
browser.fill("surname", "Vespucci").pressButton("submit", function() {
//fill the form, and submit.
// 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.assret.text('span#name', 'Vespucci');
// assert that the element(s) 'span#dates' exist and their count is 1
browser.assert.element('span#dates', 1);
done(); // It's an async test, so we have to call 'done()''
});
});
Challenge: Run Functional Tests using a Headless Browser
I took a quick peek at your project and you seem to be missing the fcctesting.js file. I’m not sure if it is actually missing or if I am just unable to see it, but that is the file that allows the tests to run properly.