Skip to content

Commit bd028fa

Browse files
author
David Haeffner
committed
Fixed a bug in capabilities parsing in the runner for multiple quoted capabilities
1 parent a7a47e7 commit bd028fa

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packages/selenium-side-runner/src/__test__/capabilities.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ describe('capabilities string parser', () => {
5151
binary: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
5252
})
5353
})
54+
it('should parse multiple multiword capability keys', () => {
55+
const expected = {
56+
browserName: 'internet explorer',
57+
version: 10,
58+
platform: 'Windows 8.1',
59+
}
60+
const capabilitiesSingleQuotes =
61+
"browserName='internet explorer' version=10.0 platform='Windows 8.1'"
62+
expect(Capabilities.parseString(capabilitiesSingleQuotes)).toEqual(expected)
63+
const capabilitiesDoubleQuotes =
64+
'browserName="internet explorer" version=10.0 platform="Windows 8.1"'
65+
expect(Capabilities.parseString(capabilitiesDoubleQuotes)).toEqual(expected)
66+
})
5467
it('should parse boolean capability key', () => {
5568
const capabilities = 'javascriptEnabled=false databaseEnabled=true'
5669
expect(Capabilities.parseString(capabilities)).toEqual({

packages/selenium-side-runner/src/capabilities.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default {
3030
}
3131

3232
function matchStringPairs(input) {
33-
const regex = /([^\s=]*)\s?=\s?(".*"|'.*'|\[.*\]|[^\s]*)/g
33+
const regex = /([^\s=]*)\s?=\s?(".*?"|'.*?'|\[.*\]|[^\s]*)/g
3434
let result
3535
const splitCapabilities = []
3636
while ((result = regex.exec(input)) !== null) {

0 commit comments

Comments
 (0)