Skip to content

Instantly share code, notes, and snippets.

Created April 24, 2014 03:50
Show Gist options
  • Save anonymous/11240852 to your computer and use it in GitHub Desktop.
Save anonymous/11240852 to your computer and use it in GitHub Desktop.
CasperJS vs. NightwatchJS COmparison
var server = require('../..');
var port = server.httpListener.address().port;
var url = 'http://localhost:'+String(port);
casper.test.begin('titles', 2, function(test){
casper
.start(url)
.waitForSelector('header#header', function(){
test.assertSelectorHasText('.timeZoneTitle:nth-child(1), :not(.timeZoneTitle) + .timeZoneTitle', 'Tokyo');
test.assertSelectorHasText('.timeZoneTitle:nth-child(2), :not(.timeZoneTitle) + .timeZoneTitle', 'Tijuana');
})
.run();
});
var server = require('../..');
var port = server.httpListener.address().port;
var url = 'http://localhost:'+String(port);
module.exports = {
'titles' : function(browser){
browser
.url(url)
.waitForElementVisible('header#header',1000)
.assert.containsText('.timeZoneTitle:nth-child(1), :not(.timeZoneTitle) + .timeZoneTitle', 'Tokyo')
.assert.containsText('.timeZoneTitle:nth-child(2), :not(.timeZoneTitle) + .timeZoneTitle', 'Tijuana')
.end();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment