refs #64 - add Tester.assertTextExists
Showing
2 changed files
with
11 additions
and
2 deletions
... | @@ -273,7 +273,9 @@ var Tester = function(casper, options) { | ... | @@ -273,7 +273,9 @@ var Tester = function(casper, options) { |
273 | * @param String message Test description | 273 | * @param String message Test description |
274 | */ | 274 | */ |
275 | this.assertTextExists = function assertTextExists(text, message) { | 275 | this.assertTextExists = function assertTextExists(text, message) { |
276 | return this.assert( ( casper.evaluate( function(){ return document.body.innerText; } ).indexOf(text) != -1), message); | 276 | return this.assert((casper.evaluate(function() { |
277 | return document.body.innerText; | ||
278 | }).indexOf(text) != -1), message); | ||
277 | }; | 279 | }; |
278 | 280 | ||
279 | /** | 281 | /** | ... | ... |
... | @@ -42,4 +42,11 @@ var expected = [ | ... | @@ -42,4 +42,11 @@ var expected = [ |
42 | }); | 42 | }); |
43 | t.assertEquals(files, expected, 'findTestFiles() find test files and sort them'); | 43 | t.assertEquals(files, expected, 'findTestFiles() find test files and sort them'); |
44 | 44 | ||
45 | t.done(); | 45 | t.comment('Tester.assertTextExists()'); |
46 | casper.start('tests/site/index.html', function() { | ||
47 | t.assertTextExists('form', 'Tester.assertTextExists() checks that page body contains text'); | ||
48 | }); | ||
49 | |||
50 | casper.run(function() { | ||
51 | t.done(); | ||
52 | }); | ... | ... |
-
Please register or sign in to post a comment