Skip to content

Commit 569dd78

Browse files
author
Alex Plischke
authored
Add region selection (#13)
* Allow sauce region selection * Update package.json information
1 parent 61fa305 commit 569dd78

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sauce-playwright-runner",
33
"version": "0.0.0",
4-
"description": "Sauce Labs WDIO Test Runner",
4+
"description": "Sauce Labs Playwright Test Runner",
55
"main": "index.js",
66
"scripts": {
77
"build": "docker build -t saucelabs/${npm_package_name}:latest --cache-from saucelabs/${npm_package_name}:latest .",
@@ -11,14 +11,13 @@
1111
},
1212
"repository": {
1313
"type": "git",
14-
"url": "git+https://github.com/christian-bromann/sauce-wdio-runner.git"
14+
"url": "https://github.com/saucelabs/sauce-playwright-runner.git"
1515
},
16-
"author": "Christian Bromann",
1716
"license": "MIT",
1817
"bugs": {
19-
"url": "https://github.com/christian-bromann/sauce-wdio-runner/issues"
18+
"url": "https://github.com/saucelabs/testrunner-toolkit/issues"
2019
},
21-
"homepage": "https://github.com/christian-bromann/sauce-wdio-runner#readme",
20+
"homepage": "https://github.com/saucelabs/testrunner-toolkit",
2221
"dependencies": {
2322
"@wdio/logger": "^5.16.10",
2423
"find-process": "^1.4.3",

src/reporter.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ const { LOG_FILES, HOME_DIR } = require('./constants')
1111

1212
const log = logger('reporter')
1313

14+
const region = process.env.SAUCE_REGION || 'us-west-1'
15+
1416
const api = new SauceLabs({
1517
user: process.env.SAUCE_USERNAME,
1618
key: process.env.SAUCE_ACCESS_KEY,
17-
region: 'us-west-1'
19+
region: region
1820
})
1921

2022
const jobName = `DevX ${Math.random()}`
@@ -48,6 +50,7 @@ module.exports = class TestrunnerReporter {
4850
await remote({
4951
user: process.env.SAUCE_USERNAME,
5052
key: process.env.SAUCE_ACCESS_KEY,
53+
region: region,
5154
connectionRetryCount: 0,
5255
logLevel: 'silent',
5356
capabilities: {
@@ -114,6 +117,16 @@ module.exports = class TestrunnerReporter {
114117
})
115118
])
116119

117-
console.log(`\nOpen job details page: https://app.saucelabs.com/tests/${sessionId}\n`)
120+
let domain
121+
122+
switch (region) {
123+
case "us-west-1":
124+
domain = "saucelabs.com"
125+
break
126+
default:
127+
domain = `${region}.saucelabs.com`
128+
}
129+
130+
console.log(`\nOpen job details page: https://app.${domain}/tests/${sessionId}\n`)
118131
}
119132
}

0 commit comments

Comments
 (0)