Skip to content

Commit

Permalink
Fix/3492 fix multi remote (#3496)
Browse files Browse the repository at this point in the history
## Proposed changes

This PR fixes #3492. The new added line didn't look at multiremote support which should be an object instead of an array

## Types of changes

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist


- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

## Further comments

@webdriverio/technical-committee, I was wondering why for multiremote we need to haven an object, why aren't we providing an array with an object. This makes it confusing
  • Loading branch information
wswebcreation authored and christian-bromann committed Feb 5, 2019
1 parent 40e2acc commit c14e5e1
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/wdio-config/src/lib/ConfigParser.js
Expand Up @@ -55,8 +55,10 @@ export default class ConfigParser {
/**
* For Sauce Labs RDC we need to determine if the config file has a `testobject_api_key`
* If so, we need to provide a boolean to the `detectBackend` to set the correct hostname
*
* NOTE: This will not work for multi remote
*/
const isRDC = this._capabilities.some(capability => 'testobject_api_key' in capability)
const isRDC = Array.isArray(this._capabilities) && this._capabilities.some(capability => 'testobject_api_key' in capability)

/**
* detect Selenium backend
Expand Down
@@ -0,0 +1,30 @@
import path from 'path'

const TEST_ROOT = path.join(__dirname, '..')

exports.config = {
user: 'foobar',
key: '50fa142c-3121-4gb0-9p07-8q326vvbq7b0',
specs: [path.join(TEST_ROOT, '*.test.js')],
exclude: [
path.join(TEST_ROOT, '/detectBackend.test.js'),
path.join(TEST_ROOT, '/validateConfig.test.js')
],
region: 'eu',
capabilities: [{
myChromeBrowser: {
capabilities: {
browserName: 'chrome',
testobject_api_key: '1',
}
}
}],
suites: {
unit: [path.join(TEST_ROOT, 'configparser.test.js')],
mobile: [path.join(TEST_ROOT, 'detectBackend.test.js')],
functional: [
path.join(TEST_ROOT, 'validateConfig.test.js'),
path.join(TEST_ROOT, '..', 'src/index.js')
]
}
}
25 changes: 25 additions & 0 deletions packages/wdio-config/tests/__fixtures__/wdio.conf.rdc.js
@@ -0,0 +1,25 @@
import path from 'path'

const TEST_ROOT = path.join(__dirname, '..')

exports.config = {
user: 'foobar',
key: '50fa142c-3121-4gb0-9p07-8q326vvbq7b0',
specs: [path.join(TEST_ROOT, '*.test.js')],
exclude: [
path.join(TEST_ROOT, '/detectBackend.test.js'),
path.join(TEST_ROOT, '/validateConfig.test.js')
],
capabilities: [{
browserName: 'chrome',
testobject_api_key: '1',
}],
suites: {
unit: [path.join(TEST_ROOT, 'configparser.test.js')],
mobile: [path.join(TEST_ROOT, 'detectBackend.test.js')],
functional: [
path.join(TEST_ROOT, 'validateConfig.test.js'),
path.join(TEST_ROOT, '..', 'src/index.js')
]
}
}
14 changes: 14 additions & 0 deletions packages/wdio-config/tests/configparser.test.js
Expand Up @@ -3,6 +3,8 @@ import ConfigParser from '../src/lib/ConfigParser'

const FIXTURES_PATH = path.resolve(__dirname, '__fixtures__')
const FIXTURES_CONF = path.resolve(FIXTURES_PATH, 'wdio.conf.js')
const FIXTURES_CONF_RDC = path.resolve(FIXTURES_PATH, 'wdio.conf.rdc.js')
const FIXTURES_CONF_MULTIREMOTE_RDC = path.resolve(FIXTURES_PATH, 'wdio.conf.multiremote.rdc.js')
const FIXTURES_LOCAL_CONF = path.resolve(FIXTURES_PATH, 'wdio.local.conf.js')
const INDEX_PATH = path.resolve(__dirname, '..', 'src', 'index.js')

Expand All @@ -21,6 +23,18 @@ describe('ConfigParser', () => {
const configParser = new ConfigParser()
expect(() => configParser.addConfigFile(path.resolve(__dirname, 'foobar.conf.js'))).toThrow()
})

it('should add the rdc hostname when a rdc conf is provided', () => {
const configParser = new ConfigParser()
configParser.addConfigFile(FIXTURES_CONF_RDC)
expect(configParser._config.hostname).toContain('appium.testobject.com')
})

it('should default to the vm hostname when a multiremote conf with rdc props is provided', () => {
const configParser = new ConfigParser()
configParser.addConfigFile(FIXTURES_CONF_MULTIREMOTE_RDC)
expect(configParser._config.hostname).not.toContain('appium.testobject.com')
})
})

describe('merge', () => {
Expand Down

0 comments on commit c14e5e1

Please sign in to comment.