ensured travis-ci is able to run the tests using phantomjs 1.5
Showing
2 changed files
with
33 additions
and
21 deletions
1 | var received; | 1 | // skip this test for phantom versions < 1.5 |
2 | if (phantom.version.major === 1 && phantom.version.minor < 6) { | ||
3 | casper.test.comment('Skipped tests, PhantomJS 1.6 required'); | ||
4 | casper.test.done(); | ||
5 | } else { | ||
6 | var received; | ||
2 | 7 | ||
3 | casper.setFilter('page.confirm', function(message) { | 8 | casper.setFilter('page.confirm', function(message) { |
4 | received = message; | 9 | received = message; |
5 | return true; | 10 | return true; |
6 | }); | 11 | }); |
7 | 12 | ||
8 | casper.start('tests/site/confirm.html', function() { | 13 | casper.start('tests/site/confirm.html', function() { |
9 | this.test.assert(this.getGlobal('confirmed'), 'confirmation received'); | 14 | this.test.assert(this.getGlobal('confirmed'), 'confirmation received'); |
10 | }); | 15 | }); |
11 | 16 | ||
12 | casper.run(function() { | 17 | casper.run(function() { |
13 | this.test.assertEquals(received, 'are you sure?', 'confirmation message is ok'); | 18 | this.test.assertEquals(received, 'are you sure?', 'confirmation message is ok'); |
14 | this.test.done(); | 19 | this.test.done(); |
15 | }); | 20 | }); |
21 | } | ... | ... |
1 | casper.setFilter('page.prompt', function(message, value) { | 1 | // skip this test for phantom versions < 1.5 |
2 | return 'Chuck ' + value; | 2 | if (phantom.version.major === 1 && phantom.version.minor < 6) { |
3 | }); | 3 | casper.test.comment('Skipped tests, PhantomJS 1.6 required'); |
4 | casper.test.done(); | ||
5 | } else { | ||
6 | casper.setFilter('page.prompt', function(message, value) { | ||
7 | return 'Chuck ' + value; | ||
8 | }); | ||
4 | 9 | ||
5 | casper.start('tests/site/prompt.html', function() { | 10 | casper.start('tests/site/prompt.html', function() { |
6 | this.test.assertEquals(this.getGlobal('name'), 'Chuck Norris', 'prompted value has been received'); | 11 | this.test.assertEquals(this.getGlobal('name'), 'Chuck Norris', 'prompted value has been received'); |
7 | }); | 12 | }); |
8 | 13 | ||
9 | casper.run(function() { | 14 | casper.run(function() { |
10 | this.test.done(); | 15 | this.test.done(); |
11 | }); | 16 | }); |
17 | } | ... | ... |
-
Please register or sign in to post a comment