Skip to content

Commit

Permalink
[FIX] phantomjs 2.0 compatibility
Browse files Browse the repository at this point in the history
phantomjs 2.0 remove the deprecated attribute `phantom.args`. Use the
new `system` module.
  • Loading branch information
KangOl committed Feb 26, 2015
1 parent 05bbe78 commit f0dc416
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion addons/web_tests/tests/test_ui_load.js
Original file line number Diff line number Diff line change
@@ -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");
6 changes: 4 additions & 2 deletions openerp/tests/phantomtest.js
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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';
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit f0dc416

Please sign in to comment.