Skip to content

Commit

Permalink
Improve Sauce Labs test status assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Acconut committed Feb 6, 2017
1 parent 1fe7719 commit 8525dca
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions bin/sauce-jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,28 @@ function pollTestStatus(testIds) {
options.auth = username + ":" + accessKey;
options.body = JSON.stringify(body);
request(options, function (res) {
var test = res["js tests"];
var tests = res["js tests"];
var remainingTestIds = [];

test.forEach(function (test) {
if (!("result" in test) || test.result == null) {
tests.forEach(function (test) {
if (test.status === "test error") {
console.log("Browser %s errored!".red, test.platform.join(" "));
failedTests++;
return;
}

if (!("result" in test)) {
// No results are available yet, so we still need to wait for it.
remainingTestIds.push(test.id);
return;
}

if (test.result == null) {
console.log("Browser %s completed without success!".red, test.platform.join(" "));
failedTests++;
return;
}

if (test.result.passed) {
// Test passed succesfully. No need to worry about it any more.
console.log("Browser %s passed!".green, test.platform.join(" "));
Expand Down

0 comments on commit 8525dca

Please sign in to comment.