Skip to content

Commit 3ea8274

Browse files
committed
Adjust saucelabs EOL feature
1 parent 2b9a376 commit 3ea8274

3 files changed

Lines changed: 41 additions & 33 deletions

File tree

.github/workflows/build.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
env:
1313
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
1414
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
15+
SAUCE_TUNNEL_NAME: sp-js-tracker-${{ github.run_id }}-${{ github.run_attempt }}
1516
BROWSERSLIST_IGNORE_OLD_DATA: true
1617

1718
steps:
@@ -52,8 +53,18 @@ jobs:
5253
if: ${{ env.SAUCE_ACCESS_KEY != '' }}
5354
run: echo "127.0.0.1 snowplow-js-tracker.local" | sudo tee -a /etc/hosts
5455

56+
- name: Start Saucelabs Tunnel
57+
if: ${{ env.SAUCE_ACCESS_KEY != '' }}
58+
uses: saucelabs/sauce-connect-action@v3
59+
with:
60+
username: ${{ secrets.SAUCE_USERNAME }}
61+
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
62+
region: us
63+
tunnelName: ${{ env.SAUCE_TUNNEL_NAME }}
64+
5565
- name: Run End to End Tests
5666
if: ${{ env.SAUCE_ACCESS_KEY != '' }}
67+
timeout-minutes: 60
5768
working-directory: ./trackers/javascript-tracker
5869
run: node ../../common/scripts/install-run-rushx.js test:e2e:sauce
5970

trackers/javascript-tracker/test/wdio.default.conf.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ function getFullPath(path: string): string {
99
type CustomTestRunnerConfig = Options.Testrunner & { dockerInstance?: DockerWrapper };
1010

1111
export const config: Omit<Options.Testrunner, 'capabilities'> = {
12-
specs: [[
13-
getFullPath('test/functional/*.test.ts'),
14-
getFullPath('test/integration/*.test.ts'),
15-
getFullPath('test/media/media.test.ts'),
16-
getFullPath('test/performance/*.test.ts'),
17-
// YouTube and Vimeo tests are disabled since they block SauceLabs on CI
18-
]],
12+
specs: [
13+
[
14+
getFullPath('test/functional/*.test.ts'),
15+
getFullPath('test/integration/*.test.ts'),
16+
getFullPath('test/media/media.test.ts'),
17+
getFullPath('test/performance/*.test.ts'),
18+
// YouTube and Vimeo tests are disabled since they block SauceLabs on CI
19+
],
20+
],
1921
logLevel: 'warn',
2022
baseUrl: 'http://snowplow-js-tracker.local:8080',
2123
waitforTimeout: 30000,
@@ -31,7 +33,11 @@ export const config: Omit<Options.Testrunner, 'capabilities'> = {
3133
defaultTimeoutInterval: 120000,
3234
},
3335
async onPrepare(config: CustomTestRunnerConfig) {
34-
const isSauce = config.services?.some((service) => Array.isArray(service) && service[0] === 'sauce');
36+
// Tolerate both the `'sauce'` and `['sauce', opts]` service forms, since Micro must be
37+
// advertised under the tunnel hostname rather than loopback whenever tests run on Sauce.
38+
const isSauce = config.services?.some((service) =>
39+
Array.isArray(service) ? service[0] === 'sauce' : service === 'sauce'
40+
);
3541
config.dockerInstance = await start(isSauce);
3642
await setValue('dockerInstanceUrl', config.dockerInstance.url);
3743
return;

trackers/javascript-tracker/test/wdio.sauce.conf.ts

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ if (process.env.GITHUB_WORKFLOW) {
88

99
const buildName = `snowplow-js-tracker-${buildIdentifier}`;
1010

11+
// The Sauce Connect tunnel is started outside of WebdriverIO (see the `Start Saucelabs Tunnel`
12+
// step in `.github/workflows/build.yml`) since Sauce Connect 4, the only version the pinned
13+
// `@wdio/sauce-service` can launch, is no longer accepted by Sauce Labs.
14+
const tunnelName = process.env.SAUCE_TUNNEL_NAME;
15+
const sauceOptions = {
16+
build: buildName,
17+
...(tunnelName ? { tunnelName } : {}),
18+
};
19+
1120
export const config: Partial<Options.Testrunner> = {
1221
...defaultConfig,
1322

@@ -20,59 +29,41 @@ export const config: Partial<Options.Testrunner> = {
2029
browserName: 'firefox',
2130
platformName: 'macOS 10.15',
2231
browserVersion: '96',
23-
'sauce:options': {
24-
build: buildName,
25-
},
32+
'sauce:options': { ...sauceOptions },
2633
},
2734
{
2835
browserName: 'firefox',
2936
browserVersion: '78',
3037
platformName: 'Windows 10',
31-
'sauce:options': {
32-
build: buildName,
33-
},
38+
'sauce:options': { ...sauceOptions },
3439
},
3540
{
3641
browserName: 'chrome',
3742
platformName: 'Windows 10',
3843
browserVersion: '109',
39-
'sauce:options': {
40-
build: buildName,
41-
},
44+
'sauce:options': { ...sauceOptions },
4245
},
4346
{
4447
browserName: 'chrome',
4548
platformName: 'macOS 10.15',
4649
browserVersion: '95',
47-
'sauce:options': {
48-
build: buildName,
49-
},
50+
'sauce:options': { ...sauceOptions },
5051
},
5152
{
5253
browserName: 'MicrosoftEdge',
5354
platformName: 'Windows 10',
5455
browserVersion: 'latest',
55-
'sauce:options': {
56-
build: buildName,
57-
},
56+
'sauce:options': { ...sauceOptions },
5857
},
5958
{
6059
browserName: 'safari',
6160
browserVersion: '14',
6261
platformName: 'macOS 11.00',
63-
'sauce:options': {
64-
build: buildName,
65-
},
62+
'sauce:options': { ...sauceOptions },
6663
},
6764
],
6865
services: [
69-
[
70-
'sauce',
71-
{
72-
sauceConnect: true,
73-
sauceConnectOpts: {},
74-
},
75-
],
66+
'sauce',
7667
[
7768
'static-server',
7869
{

0 commit comments

Comments
 (0)