[IMP] website test_ui: add a try catch in run and run_test to display error
authorChristophe Matthieu <chm@openerp.com>
Thu, 6 Feb 2014 17:51:13 +0000 (18:51 +0100)
committerChristophe Matthieu <chm@openerp.com>
Thu, 6 Feb 2014 17:51:13 +0000 (18:51 +0100)
bzr revid: chm@openerp.com-20140206175113-w0qscfngebnn7718

addons/website/tests/ui_suite/ui_test_runner.js

index 832ca96..dd023ee 100644 (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 = {