diff --git a/lib/retry.js b/lib/retry.js index ec6ef00..86abad7 100644 --- a/lib/retry.js +++ b/lib/retry.js @@ -77,17 +77,24 @@ function afterLaunch(configRetry) { protractorCommand.push('--disableChecks'); /* the remaining command arg */ var usedCommandKeys = ['$0', '_', 'test', 'specs', 'retry' , 'suite', 'help', 'version']; - Object.keys(argv).forEach(function(key) { - if (usedCommandKeys.indexOf(key) === -1) { - if(key === 'params') { - Object.keys(argv[key]).forEach(function(param) { - protractorCommand.push('--params.'+param, argv[key][param]); - }); - } else { - protractorCommand.push('--'+key, argv[key]); + + const keyify = (obj, prefix = '--') => + Object.keys(obj).forEach(objectKey => { + if (usedCommandKeys.indexOf(objectKey) === -1) { + if(Array.isArray(obj[objectKey]) ) { + Object.keys(obj[objectKey]).forEach(value => { + protractorCommand.push(prefix + objectKey, obj[objectKey][value]); + }); + } + else if (typeof obj[objectKey] === 'object' && obj[objectKey] !== null) { + keyify(obj[objectKey], prefix + objectKey + '.'); + } else { + protractorCommand.push(prefix + objectKey, obj[objectKey]); + } } - } - }); + }, []); + + keyify(argv); if (retryCount <= retry) { retryLogger(retryCount, fixedSpecList);