remote_runner: Use an options object to create webdriver object

pull/5020/head
Richard Hansen 2021-05-02 16:01:06 -04:00
parent 925f789d4c
commit a12c475776
1 changed files with 4 additions and 6 deletions

View File

@ -8,10 +8,10 @@ const async = require('async');
const wd = require('wd'); const wd = require('wd');
const config = { const config = {
host: 'ondemand.saucelabs.com', hostname: 'ondemand.saucelabs.com',
port: 80, port: 80,
username: process.env.SAUCE_USER, user: process.env.SAUCE_USER,
accessKey: process.env.SAUCE_ACCESS_KEY, pwd: process.env.SAUCE_ACCESS_KEY,
}; };
const isAdminRunner = process.argv[2] === 'admin'; const isAdminRunner = process.argv[2] === 'admin';
@ -32,8 +32,6 @@ const sauceTestWorker = async.queue((testSettings, callback) => {
const name = `${testSettings.browserName} ${testSettings.version}, ${testSettings.platform}`; const name = `${testSettings.browserName} ${testSettings.version}, ${testSettings.platform}`;
const pfx = `[${name}] `; const pfx = `[${name}] `;
const fullName = [process.env.GIT_HASH].concat(process.env.SAUCE_NAME || [], name).join(' - '); const fullName = [process.env.GIT_HASH].concat(process.env.SAUCE_NAME || [], name).join(' - ');
const browser = wd.promiseChainRemote(
config.host, config.port, config.username, config.accessKey);
testSettings.name = fullName; testSettings.name = fullName;
testSettings.public = true; testSettings.public = true;
testSettings.build = process.env.GIT_HASH; testSettings.build = process.env.GIT_HASH;
@ -41,7 +39,7 @@ const sauceTestWorker = async.queue((testSettings, callback) => {
// don't know how to print them into output of the tests // don't know how to print them into output of the tests
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');
browser.init(testSettings).get('http://localhost:9001/tests/frontend/', () => { browser.init(testSettings).get('http://localhost:9001/tests/frontend/', () => {
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);