Skip to content

Commit 80b0293

Browse files
committed
fix video_config
1 parent b7a1ba1 commit 80b0293

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

bin/helpers/utils.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,12 +1365,26 @@ exports.setVideoCliConfig = (bsConfig, videoConfig) => {
13651365
let user_cypress_version = (bsConfig && bsConfig.run_settings && bsConfig.run_settings.cypress_version) ? bsConfig.run_settings.cypress_version.toString() : undefined;
13661366
let cypress_major_version = (user_cypress_version && user_cypress_version.match(/^(\d+)/)) ? user_cypress_version.split(".")[0] : undefined;
13671367
let config_args = (bsConfig && bsConfig.run_settings && bsConfig.run_settings.config) ? bsConfig.run_settings.config : undefined;
1368-
if(config_args && !config_args.includes('video')) {
1369-
if(this.isUndefined(user_cypress_version) || this.isUndefined(cypress_major_version) || parseInt(cypress_major_version) >= 13 ) {
1370-
let video_args = `video=${videoConfig.video},videoUploadOnPasses=${videoConfig.videoUploadOnPasses}`;
1371-
config_args = this.isUndefined(config_args) ? video_args : config_args + ',' + video_args;
1372-
logger.debug(`Setting default video true for cypress 13 and above in cli for cypress version ${user_cypress_version} with cli args - ${config_args}`)
1368+
if(this.isUndefined(user_cypress_version) || this.isUndefined(cypress_major_version) || parseInt(cypress_major_version) >= 13 ) {
1369+
let video_args = `video=${videoConfig.video},videoUploadOnPasses=${videoConfig.videoUploadOnPasses}`;
1370+
config_args = this.isUndefined(config_args) ? video_args : config_args + ',' + video_args;
1371+
let params = config_args.split(",");
1372+
const finalParamsHash = {};
1373+
1374+
for (let i = 0; i < params.length; i++) {
1375+
const param = params[i].split('=');
1376+
if (finalParamsHash[param[0]] == undefined) {
1377+
finalParamsHash[param[0]] = param[1];
1378+
}
1379+
};
1380+
1381+
const arr = [];
1382+
for (const [key, value] of Object.entries(finalParamsHash)) {
1383+
arr.push(`${key}=${value}`);
13731384
}
1385+
config_args = arr.join(",");
1386+
videoConfig["video"] = finalParamsHash["video"];
1387+
logger.debug(`Setting default video true for cypress 13 and above in cli for cypress version ${user_cypress_version} with cli args - ${config_args}`)
13741388
}
13751389
if (bsConfig.run_settings && this.isNotUndefined(config_args)) bsConfig["run_settings"]["config"] = config_args;
13761390
}

0 commit comments

Comments
 (0)