Refs #482: fixes test onerror.js
Error message for a ReferenceError is not equal between Gecko and Webkit.
Showing
1 changed file
with
8 additions
and
1 deletions
... | @@ -2,12 +2,19 @@ | ... | @@ -2,12 +2,19 @@ |
2 | /*jshint strict:false*/ | 2 | /*jshint strict:false*/ |
3 | casper.test.begin('page.error event tests', 2, function(test) { | 3 | casper.test.begin('page.error event tests', 2, function(test) { |
4 | var error = {}; | 4 | var error = {}; |
5 | var expectedMessage; | ||
6 | if (phantom.casperEngine === 'phantomjs') { | ||
7 | expectedMessage = "ReferenceError: Can't find variable: plop"; | ||
8 | } | ||
9 | else { | ||
10 | expectedMessage = "ReferenceError: plop is not defined"; | ||
11 | } | ||
5 | casper.once("page.error", function onError(msg, trace) { | 12 | casper.once("page.error", function onError(msg, trace) { |
6 | error.msg = msg; | 13 | error.msg = msg; |
7 | error.trace = trace; | 14 | error.trace = trace; |
8 | }); | 15 | }); |
9 | casper.start('tests/site/error.html', function() { | 16 | casper.start('tests/site/error.html', function() { |
10 | test.assertEquals(error.msg, "ReferenceError: Can't find variable: plop", | 17 | test.assertEquals(error.msg, expectedMessage, |
11 | "page.error event has been caught OK"); | 18 | "page.error event has been caught OK"); |
12 | test.assertMatch(error.trace[0].file, /error.html/, | 19 | test.assertMatch(error.trace[0].file, /error.html/, |
13 | "page.error retrieves correct stack trace"); | 20 | "page.error retrieves correct stack trace"); | ... | ... |
-
Please register or sign in to post a comment