From 384642d05d33a026e99e4f4647f285feb08dd3f2 Mon Sep 17 00:00:00 2001 From: Alla Mudruk Date: Wed, 6 Nov 2019 17:24:16 +0100 Subject: [PATCH 1/2] fixed command line parameters for next runs --- lib/retry.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) 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); From 4c9120a13934eedd1cd9fba7dbacaa6987edd35c Mon Sep 17 00:00:00 2001 From: Alla Mudruk Date: Wed, 6 Nov 2019 17:25:58 +0100 Subject: [PATCH 2/2] fixed command line parameters for next runs --- lib/retry.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) 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);