Skip to content

Commit

Permalink
Removing APAC region (#13666)
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Bromann <[email protected]>
  • Loading branch information
diemol and christian-bromann authored Sep 27, 2024
1 parent 4102c46 commit a5b573b
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 35 deletions.
3 changes: 1 addition & 2 deletions packages/wdio-cli/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ enum ProtocolOptions {

export enum RegionOptions {
US = 'us',
EU = 'eu',
APAC = 'apac'
EU = 'eu'
}

export const E2E_ENVIRONMENTS = [
Expand Down
2 changes: 1 addition & 1 deletion packages/wdio-cli/src/templates/wdio.conf.tpl.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if (answers.isUsingTypeScript) {
key: process.env.<%- answers.env_key %>,
//
// If you run your tests on Sauce Labs you can specify the region you want to run your tests
// in via the `region` property. Available short handles for regions are `us` (default), `eu` and `apac`.
// in via the `region` property. Available short handles for regions are `us` (default) and `eu`.
// These regions are used for the Sauce Labs VM cloud and the Sauce Labs Real Device Cloud.
// If you don't provide the region it will default for the `us`
<% }
Expand Down
6 changes: 3 additions & 3 deletions packages/wdio-sauce-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ Instructions on how to install `WebdriverIO` can be found [here.](https://webdri

## Configuration

To use the service for the Virtual Desktop/Emulator/Simulator Machine and Real Device cloud you need to set `user` and `key` in your `wdio.conf.js` file. It will automatically use Sauce Labs to run your integration tests. If you run your tests on Sauce Labs you can specify the region you want to run your tests in via the `region` property. Available short handles for regions are `us` (default), `eu` and `apac`. These regions are used for the Sauce Labs VM cloud and the Sauce Labs Real Device Cloud. If you don't provide the region, it defaults to `us`.
To use the service for the Virtual Desktop/Emulator/Simulator Machine and Real Device cloud you need to set `user` and `key` in your `wdio.conf.js` file. It will automatically use Sauce Labs to run your integration tests. If you run your tests on Sauce Labs you can specify the region you want to run your tests in via the `region` property. Available short handles for regions are `us` (default) and `eu`. These regions are used for the Sauce Labs VM cloud and the Sauce Labs Real Device Cloud. If you don't provide the region, it defaults to `us`.

If you want WebdriverIO to automatically spin up a [Sauce Connect](https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy) tunnel, you need to set `sauceConnect: true`. If you would like to change the data center to EU add `region:'eu'` or APAC add `region:'apac'` as US data center is set as default.
If you want WebdriverIO to automatically spin up a [Sauce Connect](https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy) tunnel, you need to set `sauceConnect: true`. If you would like to change the data center to EU add `region:'eu'` as US data center is set as default.

```js
// wdio.conf.js
export const config = {
// ...
user: process.env.SAUCE_USERNAME,
key: process.env.SAUCE_ACCESS_KEY,
region: 'us', // or 'eu' or 'apac'
region: 'us', // or 'eu'
services: [
['sauce', {
sauceConnect: true,
Expand Down
3 changes: 1 addition & 2 deletions packages/wdio-spec-reporter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ export default class SpecReporter extends WDIOReporter {
// VDC urls can be constructed / be made shared
const isUSEast4 = ['us-east-4'].includes(config?.region || '') || (config.hostname?.includes('us-east-4'))
const isEUCentral = ['eu', 'eu-central-1'].includes(config?.region || '') || (config.hostname?.includes('eu-central'))
const isAPAC = ['apac', 'apac-southeast-1'].includes(config?.region || '') || (config.hostname?.includes('apac'))
const dc = isUSEast4 ? '.us-east-4' : isEUCentral ? '.eu-central-1' : isAPAC ? '.apac-southeast-1' : ''
const dc = isUSEast4 ? '.us-east-4' : isEUCentral ? '.eu-central-1' : ''
const sauceLabsSharableLinks = this._sauceLabsSharableLinks
? sauceAuthenticationToken( config.user, config.key, sessionId )
: ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ exports[`SpecReporter > printReport > with normal setup > should print link to S
[loremipsum 50 Windows 10 #0-0] 2) Bar test a failed test with no stack
[loremipsum 50 Windows 10 #0-0] red expected foo to equal bar
[loremipsum 50 Windows 10 #0-0]
[loremipsum 50 Windows 10 #0-0] Check out job at https://app.apac-southeast-1.saucelabs.com/tests/ba86cbcb70774ef8a0757c1702c3bdf9?auth=364414eae3ee11cb8b8bb3fc3e3b5e12
[loremipsum 50 Windows 10 #0-0] Check out job at https://app.us-east-4.saucelabs.com/tests/ba86cbcb70774ef8a0757c1702c3bdf9?auth=364414eae3ee11cb8b8bb3fc3e3b5e12
",
],
]
Expand Down
11 changes: 0 additions & 11 deletions packages/wdio-spec-reporter/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,6 @@ describe('SpecReporter', () => {

printReporter.write.mockClear()

printReporter.runnerStat.instanceOptions[fakeSessionId] = {
hostname: 'ondemand.saucelabs.com',
user: 'foobar',
key: '123',
region: 'apac'
}
printReporter.printReport(getRunnerConfig({}))
expect(printReporter.write.mock.calls).toMatchSnapshot()

printReporter.write.mockClear()

printReporter.runnerStat.instanceOptions[fakeSessionId] = {
hostname: 'ondemand.us-east-4.saucelabs.com',
user: 'foobar',
Expand Down
2 changes: 1 addition & 1 deletion packages/wdio-types/src/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export interface WebDriver extends Connection {
cacheDir?: string
}

export type SauceRegions = 'us' | 'eu' | 'apac' | 'us-west-1' | 'us-east-4' | 'eu-central-1' | 'apac-southeast-1' | 'staging'
export type SauceRegions = 'us' | 'eu' | 'us-west-1' | 'us-east-4' | 'eu-central-1' | 'staging'

export interface WebdriverIO extends WebDriver, Pick<Hooks, 'onReload' | 'beforeCommand' | 'afterCommand'> {
/**
Expand Down
2 changes: 0 additions & 2 deletions packages/webdriverio/src/utils/detectBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const REGION_MAPPING = {
'eu': 'eu-central-1.',
'eu-central-1': 'eu-central-1.',
'us-east-4': 'us-east-4.',
'apac': 'apac-southeast-1.',
'apac-southeast-1': 'apac-southeast-1',
}

interface BackendConfigurations {
Expand Down
12 changes: 0 additions & 12 deletions packages/webdriverio/tests/utils/detectBackend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,6 @@ describe('detectBackend', () => {
expect(caps.protocol).toBe('https')
})

it('should detect saucelabs user running in an APAC DC', () => {
const caps = detectBackend({
user: 'foobar',
key: '50aa152c-1932-B2f0-9707-18z46q2n1mb0',
region: 'apac'
})
expect(caps.hostname).toBe('ondemand.apac-southeast-1.saucelabs.com')
expect(caps.port).toBe(443)
expect(caps.path).toBe('/wd/hub')
expect(caps.protocol).toBe('https')
})

it('should detect saucelabs user running on a random DC and default to the us', () => {
const caps = detectBackend({
user: 'foobar',
Expand Down

0 comments on commit a5b573b

Please sign in to comment.