Fix test retry logic

This commit is contained in:
Niklas von Hertzen 2014-09-20 21:09:18 +03:00
parent 6092629679
commit 9406f76a18

View File

@ -108,25 +108,19 @@
.timeout(60000) .timeout(60000)
.catch(Promise.TimeoutError, function() { .catch(Promise.TimeoutError, function() {
if (retries < 3) { if (retries < 3) {
console.log("Retry", (retries + 1), test); console.log(colors.violet, "Retry", (retries + 1), test);
return runTestWithRetries(browser, test, retries + 1); return runTestWithRetries(browser, test, retries + 1);
} else { } else {
throw new Error("Couldn't run test after 3 retries"); throw new Error("Couldn't run test after 3 retries");
} }
})
.then(function(e) {
if (e.message === "timeout error") {
throw e;
}
return e;
}); });
} }
function runTest(browser, test) { function runTest(browser, test) {
return browser return Promise.resolve(browser
.then(loadTestPage(browser, test)) .then(loadTestPage(browser, test))
.then(captureScreenshots(browser)) .then(captureScreenshots(browser))
.then(analyzeResults(test)); .then(analyzeResults(test))).cancellable();
} }
exports.tests = function(browsers, singleTest) { exports.tests = function(browsers, singleTest) {