Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 8924bbc

Browse files
RobbinHabermehljuliemr
authored andcommitted
fix(cli): convert capabilities arguments to dot-notation for WebDriver compatibility
1 parent 6bc5e29 commit 8924bbc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/cli.js

+16
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ if (argv.exclude) {
8383
argv.exclude = processFilePatterns(argv.exclude);
8484
}
8585

86+
// WebDriver capabilities properties require dot notation.
87+
var flattenObject = function(obj) {
88+
var prefix = arguments[1] || '';
89+
var out = arguments[2] || {};
90+
for (var prop in obj) {
91+
if (obj.hasOwnProperty(prop)) {
92+
typeof obj[prop] === 'object' ? flattenObject(obj[prop], prefix + prop + '.', out) : out[prefix + prop] = obj[prop];
93+
}
94+
}
95+
return out;
96+
}
97+
98+
if (argv.capabilities) {
99+
argv.capabilities = flattenObject(argv.capabilities);
100+
}
101+
86102
['seleniumServerJar', 'chromeDriver', 'onPrepare'].forEach(function(name) {
87103
if (argv[name]) {
88104
argv[name] = path.resolve(process.cwd(), argv[name]);

0 commit comments

Comments
 (0)