Make use of the wait throbber in quint and cleanup the throbber in saucelabs.js.

This commit is contained in:
John-David Dalton
2013-11-15 22:18:03 -08:00
parent bca3ff2eac
commit 7a4103dd48
2 changed files with 77 additions and 24 deletions

View File

@@ -17,9 +17,13 @@
request = require('request'),
SauceTunnel = require('sauce-tunnel');
/** Used by `logInline` */
var attempts = -1,
prevLine = '';
/** Used by `logInline` to clear previously logged messages */
var prevLine = '';
/** Used to display the wait throbber */
var throbberId,
throbberDelay = 500,
waitCount = -1;
/** Used as request `auth` and `options` values */
var port = 8081,
@@ -131,6 +135,15 @@
process.stdout.write(text + blankLine.slice(text.length) + '\r');
}
/**
* Writes the wait throbber to standard output.
*
* @private
*/
function logThrobber() {
logInline('Please wait' + repeat('.', (++waitCount % 3) + 1));
}
/**
* Converts a comma separated option value into an array.
*
@@ -208,6 +221,7 @@
});
}
clearInterval(throbberId);
console.log('Shutting down Sauce Connect tunnel...');
tunnel.stop(function() {
@@ -250,6 +264,12 @@
process.exit(3);
}
});
// initialize the wait throbber
if (!throbberId) {
throbberId = setInterval(logThrobber, throbberDelay);
logThrobber();
}
}
/**
@@ -272,7 +292,6 @@
handleTestResults(body['js tests']);
}
else {
logInline('Please wait' + repeat('.', (++attempts % 3) + 1));
setTimeout(function() {
waitForTestCompletion(testIdentifier);
}, 5000);