I'm writing some tests for my website using CasperJS. When I load the webpage in my own browser all items from my HTML and CSS are shown as usual. But when taking a screenshot of my index with CasperJS, almost nothing apears. I posted screenshots below.
This makes my tests fail when I use CasperJS, when everything works fine when I do it by hand.
This is my test code, which fails:
casper.test.begin('Test users without login', 1, function(test) {
// Open the webpage
casper.start('http://localhost:3000', function() {
// Wait for the website to load
casper.wait(500, function () {
// Click the 'Users' button in the upper menu
casper.capture('screenshot.png'); // SCREENSHOT GETS TAKEN HERE!
this.click("#users-button");
});
}).viewport(1920,1080);
// Wait for the website to load
casper.wait(500, function () {
// Are you on the right page?
test.assertUrlMatch('http://localhost:3000/ratings.html'); // RESULT = localhost:3000/
});
// Run the test
casper.run(function() {
test.done();
});
})
Screenshot taken in own browser
It doesn't matter how long I wait for the page to load, it keeps almost empty.
Hope someone could help.
Aucun commentaire:
Enregistrer un commentaire