Skip to content

Instantly share code, notes, and snippets.

@manderly
Last active August 29, 2015 14:05
Show Gist options
  • Save manderly/0c1a8e7210e71e891857 to your computer and use it in GitHub Desktop.
Save manderly/0c1a8e7210e71e891857 to your computer and use it in GitHub Desktop.
CasperJS test exercise
casper.test.begin("Testing if node express app", 2, function suite(test) {
casper.start('http://localhost:3000', function() {
test.assertHttpStatus(200);
});
casper.then(function() {
if (this.fetchText('.daysLeft') > 0) { //todo: parse as int?
this.echo("more than 0 days left");
}
this.echo("Days left: " + this.fetchText('.daysLeft'));
});
casper.then(function() {
test.assertTitle("Class Days Remaining", 'title is ok');
});
casper.run(function() {
test.done();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment