Skip to content

Commit

Permalink
fix(): bump saucelabs to 6.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
taymoork2 committed Jan 11, 2022
1 parent 59b0c5c commit 5824bb6
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 199 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -38,7 +38,7 @@
"author": "Vojta Jina <vojta.jina@gmail.com>",
"dependencies": {
"global-agent": "^2.1.12",
"saucelabs": "^4.6.3",
"saucelabs": "^6.2.1",
"webdriverio": "^6.7.0"
},
"license": "MIT",
Expand Down
64 changes: 28 additions & 36 deletions src/launcher/launcher.ts
@@ -1,28 +1,28 @@
import {remote, BrowserObject} from 'webdriverio';
import { remote, BrowserObject } from 'webdriverio';
import SauceLabsAPI from 'saucelabs';
import {processConfig} from "../process-config";
import {BrowserMap} from "../browser-info";
import {waitUntil} from "../utils";
import { processConfig } from "../process-config";
import { BrowserMap } from "../browser-info";
import { waitUntil } from "../utils";

// Array of connected drivers. This is useful for quitting all connected drivers on kill.
let connectedDrivers: Map<string, BrowserObject> = new Map();

export function SaucelabsLauncher(args,
/* config.sauceLabs */ config,
/* SauceConnect */ sauceConnect,
browserMap: BrowserMap,
logger,
baseLauncherDecorator,
captureTimeoutLauncherDecorator,
retryLauncherDecorator) {
browserMap: BrowserMap,
logger,
baseLauncherDecorator,
captureTimeoutLauncherDecorator,
retryLauncherDecorator) {

// Apply base class mixins. This would be nice to have typed, but this is a low-priority now.
baseLauncherDecorator(this);
captureTimeoutLauncherDecorator(this);
retryLauncherDecorator(this);

// initiate driver with null to not close the tunnel too early
connectedDrivers.set(this.id, null)
connectedDrivers.set(this.id, null);

const log = logger.create('SaucelabsLauncher');
const {
Expand All @@ -41,25 +41,25 @@ export function SaucelabsLauncher(args,
const driver = connectedDrivers.get(this.id);

pendingHeartBeat = setTimeout(async () => {
if (!driver) {
return
}
try {
await driver.getTitle();
log.debug('Heartbeat to Sauce Labs (%s) - fetching title', browserName)
heartbeat();
} catch (ign) {
// Do nothing, just clear the timeout
clearTimeout(pendingHeartBeat)
}
if (!driver) {
return;
},
}
try {
await driver.getTitle();
log.debug('Heartbeat to Sauce Labs (%s) - fetching title', browserName);
heartbeat();
} catch (ign) {
// Do nothing, just clear the timeout
clearTimeout(pendingHeartBeat);
}
return;
},
60000,
);
};
// Upload the new job results to Sauce Labs
const uploadJobResult = async (browserData, browserName) => {
const {sessionId, username, accessKey, region, results} = browserData;
const { sessionId, username, accessKey, region, results } = browserData;
const api = new SauceLabsAPI({
user: username,
key: accessKey,
Expand Down Expand Up @@ -87,16 +87,8 @@ export function SaucelabsLauncher(args,
sessionId,
{
files: [
{
filename: 'log.json',
data: results,
},
{
filename: 'old-log.json',
data: {
someLog: oldLogs
}
},
'log.json',
'old-log.json'
],
},
);
Expand Down Expand Up @@ -133,7 +125,7 @@ export function SaucelabsLauncher(args,
// driver instances (e.g. when running with concurrency)
connectedDrivers.set(this.id, driver);

const sessionId = driver.sessionId
const sessionId = driver.sessionId;

log.info('%s session at https://saucelabs.com/tests/%s', browserName, sessionId);
log.debug('Opening "%s" on the selenium client', pageUrl);
Expand Down Expand Up @@ -180,9 +172,9 @@ export function SaucelabsLauncher(args,
log.error(e);
}

connectedDrivers.delete(this.id)
connectedDrivers.delete(this.id);

this._done();
return process.nextTick(done);
})
});
}

0 comments on commit 5824bb6

Please sign in to comment.