Commit 21cb5487 21cb54871c111eed110dfea8c81122c54325983a by Nicolas Perriault

refs #64 - add Tester.assertTextExists

1 parent 8c9f8669
......@@ -273,7 +273,9 @@ var Tester = function(casper, options) {
* @param String message Test description
*/
this.assertTextExists = function assertTextExists(text, message) {
return this.assert( ( casper.evaluate( function(){ return document.body.innerText; } ).indexOf(text) != -1), message);
return this.assert((casper.evaluate(function() {
return document.body.innerText;
}).indexOf(text) != -1), message);
};
/**
......
......@@ -42,4 +42,11 @@ var expected = [
});
t.assertEquals(files, expected, 'findTestFiles() find test files and sort them');
t.done();
t.comment('Tester.assertTextExists()');
casper.start('tests/site/index.html', function() {
t.assertTextExists('form', 'Tester.assertTextExists() checks that page body contains text');
});
casper.run(function() {
t.done();
});
......