Przeglądaj źródła

Relaunch run on webkit1 if webkit2 fails

Gaël Métais 9 lat temu
rodzic
commit
c54cf5a2ba
1 zmienionych plików z 9 dodań i 0 usunięć
  1. 9 0
      lib/tools/phantomas/phantomasWrapper.js

+ 9 - 0
lib/tools/phantomas/phantomasWrapper.js

@@ -112,8 +112,17 @@ var PhantomasWrapper = function() {
 
 
         // It's time to launch the test!!!
         // It's time to launch the test!!!
         var triesNumber = 2;
         var triesNumber = 2;
+        var currentTry = 0;
 
 
         async.retry(triesNumber, function(cb) {
         async.retry(triesNumber, function(cb) {
+
+            currentTry ++;
+            // Fix for https://github.com/gmetais/YellowLabTools/issues/114
+            if (currentTry === 2 && options.engine === 'webkit2') {
+                debug('Launching a second try with the old webkit v1 engine');
+                options.engine = 'webkit';
+            }
+
             var process = phantomas(task.url, options, function(err, json, results) {
             var process = phantomas(task.url, options, function(err, json, results) {
                 var errorCode = err ? parseInt(err.message, 10) : null;
                 var errorCode = err ? parseInt(err.message, 10) : null;