summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchm@openerp.com <>2014-03-19 12:20:27 +0100
committerchm@openerp.com <>2014-03-19 12:20:27 +0100
commitea901ebb1de354f5bccc5cbcfb7ef478f5fa99eb (patch)
tree81061c98ce4fade7c91fb14ea1656fd801b7c86b
parent17956befd78277cb2494f901973643acd4cb620e (diff)
[FIX] phantomjs: don't use error method because it's undefined in phantomjs evaluating environment
bzr revid: chm@openerp.com-20140319112027-buua40iyi7hgnlly
-rw-r--r--openerp/tests/phantomtest.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/openerp/tests/phantomtest.js b/openerp/tests/phantomtest.js
index 63a3b2e33ff..6957f741fd5 100644
--- a/openerp/tests/phantomtest.js
+++ b/openerp/tests/phantomtest.js
@@ -6,7 +6,8 @@ function waitFor (ready, callback, timeout, timeoutMessageCallback) {
(function waitLoop() {
if(new Date - start > timeout) {
- error(timeoutMessageCallback ? timeoutMessageCallback() : "Timeout after "+timeout+" ms");
+ console.log('error', timeoutMessageCallback ? timeoutMessageCallback() : "Timeout after "+timeout+" ms");
+ phantom.exit(1);
} else if (ready()) {
callback();
} else {
@@ -15,10 +16,6 @@ function waitFor (ready, callback, timeout, timeoutMessageCallback) {
}());
}
-function error(message) {
- console.log('error', message);
- phantom.exit(1);
-}
function PhantomTest() {
var self = this;
this.options = JSON.parse(phantom.args[phantom.args.length-1]);
@@ -49,10 +46,12 @@ function PhantomTest() {
}));
msg.push('(leaf frame on top)')
}
- error(JSON.stringify(msg.join('\n')));
+ console.log('error', JSON.stringify(msg.join('\n')));
+ phantom.exit(1);
};
this.page.onAlert = function(message) {
- error(message);
+ console.log('error', message);
+ phantom.exit(1);
};
this.page.onConsoleMessage = function(message) {
console.log(message);
@@ -78,7 +77,8 @@ function PhantomTest() {
if(!found) {
console.log('Injecting', src, 'needed for', need);
if(!self.page.injectJs(src)) {
- error("Cannot inject " + src);
+ console.log('error', "Cannot inject " + src);
+ phantom.exit(1);
}
}
}
@@ -89,7 +89,8 @@ function PhantomTest() {
var message = ("Timeout\nhref: " + window.location.href
+ "\nreferrer: " + document.referrer
+ "\n\n" + document.body.innerHTML).replace(/[^a-z0-9\s~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "*");
- error(message);
+ console.log('error', message);
+ phantom.exit(1);
});
}, self.timeout);
@@ -108,7 +109,8 @@ function PhantomTest() {
var url = self.origin + url_path;
self.page.open(url, function(status) {
if (status !== 'success') {
- error("failed to load " + url)
+ console.log('error', "failed to load " + url);
+ phantom.exit(1);
} else {
console.log('loaded', url, status);
// process ready
@@ -119,7 +121,7 @@ function PhantomTest() {
try {
console.log("page.evaluate eval expr:", ready);
r = !!eval(ready);
- } catch(ex) {
+ } catch(ex) {
}
console.log("page.evaluate eval result:", r);
return r;