@@ -1365,12 +1365,26 @@ exports.setVideoCliConfig = (bsConfig, videoConfig) => {
1365
1365
let user_cypress_version = ( bsConfig && bsConfig . run_settings && bsConfig . run_settings . cypress_version ) ? bsConfig . run_settings . cypress_version . toString ( ) : undefined ;
1366
1366
let cypress_major_version = ( user_cypress_version && user_cypress_version . match ( / ^ ( \d + ) / ) ) ? user_cypress_version . split ( "." ) [ 0 ] : undefined ;
1367
1367
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 } ` ) ;
1373
1384
}
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 } ` )
1374
1388
}
1375
1389
if ( bsConfig . run_settings && this . isNotUndefined ( config_args ) ) bsConfig [ "run_settings" ] [ "config" ] = config_args ;
1376
1390
}
0 commit comments