|
@@ -31,7 +31,7 @@ var PhantomasWrapper = function() {
|
|
|
var options = {
|
|
|
|
|
|
// Cusomizable options
|
|
|
- 'timeout': task.options.timeout || 60,
|
|
|
+ 'timeout': task.options.timeout || 120,
|
|
|
'user-agent': (task.options.device === 'desktop') ? 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) YLT Chrome/85.0.4183.121 Safari/537.36' : null,
|
|
|
'tablet': (task.options.device === 'tablet'),
|
|
|
'phone': (task.options.device === 'phone'),
|
|
@@ -79,44 +79,6 @@ var PhantomasWrapper = function() {
|
|
|
deferred.reject('Phantomas failed: ' + res.message);
|
|
|
});
|
|
|
|
|
|
- /*var process = phantomas(task.url, options, function(err, json, results) {
|
|
|
- var errorCode = err ? parseInt(err.message, 10) : null;
|
|
|
-
|
|
|
- debug('Returning from Phantomas with error %s', errorCode);
|
|
|
-
|
|
|
- // Adding some YellowLabTools errors here
|
|
|
- if (json && json.metrics && (!json.metrics.javascriptExecutionTree || !json.offenders.javascriptExecutionTree)) {
|
|
|
- errorCode = 1001;
|
|
|
- }
|
|
|
-
|
|
|
- if (!errorCode && (!json || !json.metrics)) {
|
|
|
- errorCode = 1002;
|
|
|
- }
|
|
|
-
|
|
|
- // Don't cancel test if it is a timeout and we've got some results
|
|
|
- if (errorCode === 252 && json) {
|
|
|
- debug('Timeout after ' + options.timeout + ' seconds. But it\'s not a problem, the test is valid.');
|
|
|
- errorCode = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (errorCode) {
|
|
|
- debug('Attempt failed. Error code ' + errorCode);
|
|
|
- }
|
|
|
-
|
|
|
- }, function(err, json) {
|
|
|
-
|
|
|
- if (err) {
|
|
|
- debug('All ' + triesNumber + ' attemps failed for the test');
|
|
|
- deferred.reject(err);
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- deferred.resolve(json);
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
- */
|
|
|
-
|
|
|
return deferred.promise;
|
|
|
};
|
|
|
};
|