remote_runner: Always call browser.quit()
This commit is contained in:
parent
081f739a8d
commit
8baacd514e
1 changed files with 27 additions and 24 deletions
|
@ -42,32 +42,35 @@ const sauceTestWorker = async.queue(async ({name, pfx, testSettings}) => {
|
||||||
const browser = wd.remote(config, 'promiseChain');
|
const browser = wd.remote(config, 'promiseChain');
|
||||||
await browser.init(testSettings);
|
await browser.init(testSettings);
|
||||||
const url = `https://saucelabs.com/jobs/${browser.sessionID}`;
|
const url = `https://saucelabs.com/jobs/${browser.sessionID}`;
|
||||||
await browser.get('http://localhost:9001/tests/frontend/');
|
try {
|
||||||
log(`Remote sauce test started! ${url}`, pfx);
|
await browser.get('http://localhost:9001/tests/frontend/');
|
||||||
// @TODO this should be configured in testSettings, see
|
log(`Remote sauce test started! ${url}`, pfx);
|
||||||
// https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-Timeouts
|
// @TODO this should be configured in testSettings, see
|
||||||
const deadline = Date.now() + 14.5 * 60 * 1000; // Slightly less than overall test timeout.
|
// https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-Timeouts
|
||||||
// how many characters of the log have been sent to travis
|
const deadline = Date.now() + 14.5 * 60 * 1000; // Slightly less than overall test timeout.
|
||||||
let logIndex = 0;
|
// how many characters of the log have been sent to travis
|
||||||
while (true) {
|
let logIndex = 0;
|
||||||
const remoteFn = ($, skipChars) => $('#console').text().substring(skipChars);
|
while (true) {
|
||||||
const consoleText = await browser.eval(`(${remoteFn})($, ${JSON.stringify(logIndex)})`);
|
const remoteFn = ($, skipChars) => $('#console').text().substring(skipChars);
|
||||||
(consoleText ? consoleText.split('\n') : []).forEach((line) => log(line, pfx));
|
const consoleText = await browser.eval(`(${remoteFn})($, ${JSON.stringify(logIndex)})`);
|
||||||
logIndex += consoleText.length;
|
(consoleText ? consoleText.split('\n') : []).forEach((line) => log(line, pfx));
|
||||||
const [finished, nFailedStr] = consoleText.match(finishedRegex) || [];
|
logIndex += consoleText.length;
|
||||||
if (finished) {
|
const [finished, nFailedStr] = consoleText.match(finishedRegex) || [];
|
||||||
if (nFailedStr !== '0') process.exitCode = 1;
|
if (finished) {
|
||||||
break;
|
if (nFailedStr !== '0') process.exitCode = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Date.now() >= deadline) {
|
||||||
|
log('[red]FAILED[clear] allowed test duration exceeded');
|
||||||
|
process.exitCode = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 5000));
|
||||||
}
|
}
|
||||||
if (Date.now() >= deadline) {
|
} finally {
|
||||||
log('[red]FAILED[clear] allowed test duration exceeded');
|
log(`Remote sauce test finished! ${url}`, pfx);
|
||||||
process.exitCode = 1;
|
await browser.quit();
|
||||||
break;
|
|
||||||
}
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
||||||
}
|
}
|
||||||
log(`Remote sauce test finished! ${url}`, pfx);
|
|
||||||
await browser.quit();
|
|
||||||
}, 6); // run 6 tests in parrallel
|
}, 6); // run 6 tests in parrallel
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
|
|
Loading…
Reference in a new issue