remote_runner: Handle webdriver errors
parent
7f57b17b2e
commit
c803ec81f1
|
@ -42,22 +42,22 @@ const sauceTestWorker = async.queue((testSettings, callback) => {
|
||||||
testSettings.extendedDebugging = true;
|
testSettings.extendedDebugging = true;
|
||||||
testSettings.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
|
testSettings.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
|
||||||
const browser = wd.remote(config, 'promiseChain');
|
const browser = wd.remote(config, 'promiseChain');
|
||||||
browser.init(testSettings).get('http://localhost:9001/tests/frontend/', () => {
|
browser.init(testSettings).get('http://localhost:9001/tests/frontend/', (err) => {
|
||||||
|
if (err != null) return callback(err);
|
||||||
const url = `https://saucelabs.com/jobs/${browser.sessionID}`;
|
const url = `https://saucelabs.com/jobs/${browser.sessionID}`;
|
||||||
log(`Remote sauce test started! ${url}`, pfx);
|
log(`Remote sauce test started! ${url}`, pfx);
|
||||||
|
|
||||||
// tear down the test excecution
|
// tear down the test excecution
|
||||||
const stopSauce = (err) => {
|
const stopSauce = (testErr) => {
|
||||||
clearInterval(getStatusInterval);
|
clearInterval(getStatusInterval);
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
browser.quit((err) => {
|
||||||
browser.quit(() => {
|
if (err) return callback(err);
|
||||||
if (err) {
|
if (testErr) {
|
||||||
log(`[red]FAILED[clear] ${err}`, pfx);
|
log(`[red]FAILED[clear] ${testErr}`, pfx);
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
}
|
}
|
||||||
log(`Remote sauce test finished! ${url}`, pfx);
|
log(`Remote sauce test finished! ${url}`, pfx);
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -77,9 +77,8 @@ const sauceTestWorker = async.queue((testSettings, callback) => {
|
||||||
let logIndex = 0;
|
let logIndex = 0;
|
||||||
const getStatusInterval = setInterval(() => {
|
const getStatusInterval = setInterval(() => {
|
||||||
browser.eval("$('#console').text()", (err, consoleText) => {
|
browser.eval("$('#console').text()", (err, consoleText) => {
|
||||||
if (!consoleText || err) {
|
if (err != null) return stopSauce(err);
|
||||||
return;
|
if (!consoleText) return;
|
||||||
}
|
|
||||||
consoleText.substring(logIndex).split('\\n').forEach((line) => log(line, pfx));
|
consoleText.substring(logIndex).split('\\n').forEach((line) => log(line, pfx));
|
||||||
logIndex = consoleText.length;
|
logIndex = consoleText.length;
|
||||||
const [finished, nFailedStr] = consoleText.match(finishedRegex) || [];
|
const [finished, nFailedStr] = consoleText.match(finishedRegex) || [];
|
||||||
|
|
Loading…
Reference in New Issue