Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix headless endpoint #3876

Merged
merged 3 commits into from Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 4 additions & 15 deletions packages/wdio-config/src/utils.js
Expand Up @@ -6,18 +6,16 @@ const REGION_MAPPING = {
'us': '', // default endpoint
'eu': 'eu-central-1.',
'eu-central-1': 'eu-central-1.',
'us-east-1': 'us-east1.'
'us-east-1': 'us-east-1.'
}

export function getSauceEndpoint (region, isRDC, isHeadless) {
export function getSauceEndpoint (region, isRDC) {
const shortRegion = REGION_MAPPING[region] ? region : 'us'
const product = isHeadless ? 'headless.' : ''

if (isRDC){
return `${shortRegion}1.appium.testobject.com`
}

return `ondemand.${REGION_MAPPING[shortRegion]}${product}saucelabs.com`
return `ondemand.${REGION_MAPPING[shortRegion]}saucelabs.com`
}

/**
Expand Down Expand Up @@ -62,18 +60,9 @@ export function detectBackend (options = {}, isRDC = false) {
// Sauce headless is currently only in us-east-1
const sauceRegion = headless ? 'us-east-1' : region

/**
* headless runs not over SSL which might change soon
* see https://wiki.saucelabs.com/display/DOCS/Sauce+Headless+Beta
*/
if (headless) {
protocol = 'http'
port = 4444
}

return {
protocol: protocol || 'https',
hostname: hostname || getSauceEndpoint(sauceRegion, isRDC, headless),
hostname: hostname || getSauceEndpoint(sauceRegion, isRDC),
port: port || 443
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/wdio-config/tests/detectBackend.test.js
Expand Up @@ -133,9 +133,9 @@ describe('detectBackend', () => {
region: 'eu',
headless: true
})
expect(caps.hostname).toBe('ondemand.us-east1.headless.saucelabs.com')
expect(caps.port).toBe(4444)
expect(caps.protocol).toBe('http')
expect(caps.hostname).toBe('ondemand.us-east-1.saucelabs.com')
expect(caps.port).toBe(443)
expect(caps.protocol).toBe('https')
})

it('should throw if user and key are given but can not be connected to a cloud', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/wdio-spec-reporter/src/index.js
Expand Up @@ -97,7 +97,7 @@ class SpecReporter extends WDIOReporter {
getTestLink ({ config, sessionId }) {
if (config.hostname.includes('saucelabs')) {
const dc = config.headless
? '.us-east1.headless'
? '.us-east-1'
: ['eu', 'eu-central-1'].includes(config.region) ? '.eu-central-1' : ''
return ['', `Check out job at https://app${dc}.saucelabs.com/tests/${sessionId}`]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/wdio-spec-reporter/tests/__fixtures__/testdata.js
Expand Up @@ -180,5 +180,5 @@ export const SAUCELABS_EU_REPORT = REPORT + `[loremipsum #0-0]
`

export const SAUCELABS_HEADLESS_REPORT = REPORT + `[loremipsum #0-0]
[loremipsum #0-0] Check out job at https://app.us-east1.headless.saucelabs.com/tests/ba86cbcb70774ef8a0757c1702c3bdf9
[loremipsum #0-0] Check out job at https://app.us-east-1.saucelabs.com/tests/ba86cbcb70774ef8a0757c1702c3bdf9
`