[FIX] phantomjs 2.0 compatibility

phantomjs 2.0 remove the deprecated attribute `phantom.args`. Use the
new `system` module.
This commit is contained in:
Christophe Simonis 2015-02-26 14:03:02 +01:00
parent 05bbe78d87
commit f0dc416871
2 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,5 @@
// Load helper
phantom.injectJs(phantom.args[0]);
var system = require('system');
phantom.injectJs(system.args[1]);
pt = new PhantomTest();
pt.run("/", "console.log('ok')", "console");

View File

@ -1,6 +1,8 @@
// Phantomjs odoo helper
// jshint evil: true, loopfunc: true
var system = require('system');
function waitFor (condition, callback, timeout, timeoutMessageCallback) {
timeout = timeout || 10000;
var start = new Date();
@ -19,7 +21,7 @@ function waitFor (condition, callback, timeout, timeoutMessageCallback) {
function PhantomTest() {
var self = this;
this.options = JSON.parse(phantom.args[phantom.args.length-1]);
this.options = JSON.parse(system.args[system.args.length-1]);
this.inject = this.options.inject || [];
this.timeout = this.options.timeout ? Math.round(parseFloat(this.options.timeout)*1000 - 5000) : 10000;
this.origin = 'http://localhost';
@ -143,7 +145,7 @@ function PhantomTest() {
}
// js mode or jsfile mode
if(phantom.args.length === 1) {
if(system.args.length === 2) {
pt = new PhantomTest();
pt.run(pt.options.url_path, pt.options.code, pt.options.ready);
}