[IMP] website test_ui: add a try catch in run and run_test to display error

bzr revid: chm@openerp.com-20140206175113-w0qscfngebnn7718
This commit is contained in:
Christophe Matthieu 2014-02-06 18:51:13 +01:00
parent 97091c31ae
commit 062c491488
1 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,8 @@ function waitFor (ready, callback, timeout, timeoutMessageCallback) {
}
function run (test, onload, inject) {
try {
var options = JSON.parse(phantom.args);
var timeout = options.timeout ? Math.round(parseFloat(options.timeout)*1000) : 60000;
@ -113,9 +115,16 @@ function run (test, onload, inject) {
}
});
} catch (e) {
console.error("Error in run:", e);
phantom.exit(1);
}
}
function run_test (testname, options) {
try {
options = options || {};
run(
function start (page, timeout) {
@ -137,6 +146,11 @@ function run_test (testname, options) {
},
options.inject || null
);
} catch (e) {
console.error("Error in run_test:", e);
phantom.exit(1);
}
}
module.exports = {