From 4aef4e98f4b9ea955c1115483976ebdb89530a01 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Wed, 30 Apr 2014 17:03:07 +0200 Subject: [PATCH] fix: handle error when opening initial url Example of the problem: https://travis-ci.org/angular/angular.js/jobs/24101767#L2645 https://saucelabs.com/tests/edcfa4e9844f4a9ea8402366d8d2ebf7 For some reason (probably a network error on Travis), navigation to Karma capture page failed. With this fix, it will fail the launcher and therefore Karma will try to start the browser again. Even if the network error would remain, at least Karma fails instead of waiting for Travis timeout. --- lib/sauce_launcher.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/sauce_launcher.js b/lib/sauce_launcher.js index 3dd88ae..0d928ae 100644 --- a/lib/sauce_launcher.js +++ b/lib/sauce_launcher.js @@ -106,7 +106,10 @@ var SauceLauncher = function(args, sauceConnect, /* config.sauceLabs */ config, log.info('%s session at https://saucelabs.com/tests/%s', browserName, driver.sessionID); log.debug('WebDriver channel for %s instantiated, opening %s', browserName, url); - return driver.get(url).then(heartbeat); + return driver.get(url).then(heartbeat, function(err) { + log.error('Can not start %s\n %s', browserName, formatSauceError(err)); + return self._done('failure'); + }); }, function(err) { if (pendingCancellations > 0) { pendingCancellations--;