Skip to content

Commit ae509f8

Browse files
Default handling video for cyp 13 similar as cyp 12
1 parent a85992d commit ae509f8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

bin/helpers/utils.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,10 +1297,9 @@ exports.setVideoCliConfig = (bsConfig, videoConfig) => {
12971297
let cypress_major_version = (user_cypress_version && user_cypress_version.match(/^(\d+)/)) ? user_cypress_version.split(".")[0] : undefined;
12981298
let config_args = (bsConfig && bsConfig.run_settings && bsConfig.run_settings.config) ? bsConfig.run_settings.config : undefined;
12991299
if(this.isUndefined(user_cypress_version) || this.isUndefined(cypress_major_version) || parseInt(cypress_major_version) >= 13 ) {
1300-
logger.debug('Setting default video for cypress 13 and above');
13011300
let video_args = `video=${videoConfig.video},videoUploadOnPasses=${videoConfig.videoUploadOnPasses}`;
13021301
config_args = this.isUndefined(config_args) ? video_args : config_args + ',' + video_args;
1303-
logger.debug(`Setting video true in cli for cypress version ${user_cypress_version} with cli args - ${config_args}`)
1302+
logger.debug(`Setting default video true for cypress 13 and above in cli for cypress version ${user_cypress_version} with cli args - ${config_args}`)
13041303
}
13051304
if (bsConfig.run_settings && this.isNotUndefined(config_args)) bsConfig["run_settings"]["config"] = config_args;
13061305
}
@@ -1553,13 +1552,15 @@ exports.getVideoConfig = (cypressConfig, bsConfig = {}) => {
15531552
video: true,
15541553
videoUploadOnPasses: true
15551554
}
1556-
// Reading from bsconfig first to give precedance and cypress config will be empty in case of enforce_settings
1557-
if (!this.isUndefined(bsConfig.run_settings) && !this.isUndefined(bsConfig.run_settings.video)) conf.video = bsConfig.run_settings.video;
1558-
if (!this.isUndefined(bsConfig.run_settings) && !this.isUndefined(bsConfig.run_settings.videoUploadOnPasses)) conf.videoUploadOnPasses = bsConfig.run_settings.videoUploadOnPasses;
1555+
// Reading bsconfig in case of enforce_settings
15591556
if ( this.isUndefined(bsConfig.run_settings) || this.isUndefinedOrFalse(bsConfig.run_settings.enforce_settings) ) {
15601557
if (!this.isUndefined(cypressConfig.video)) conf.video = cypressConfig.video;
15611558
if (!this.isUndefined(cypressConfig.videoUploadOnPasses)) conf.videoUploadOnPasses = cypressConfig.videoUploadOnPasses;
15621559
}
1560+
else {
1561+
if (!this.isUndefined(bsConfig.run_settings) && !this.isUndefined(bsConfig.run_settings.video)) conf.video = bsConfig.run_settings.video;
1562+
if (!this.isUndefined(bsConfig.run_settings) && !this.isUndefined(bsConfig.run_settings.videoUploadOnPasses)) conf.videoUploadOnPasses = bsConfig.run_settings.videoUploadOnPasses;
1563+
}
15631564

15641565
// set video in cli config in case of cypress 13 or above as default value is false there.
15651566
this.setVideoCliConfig(bsConfig,conf);

test/unit/bin/helpers/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3517,20 +3517,20 @@ describe('utils', () => {
35173517
expect(outputConfig).to.be.eql(bsConfig.run_settings.config);
35183518
});
35193519

3520-
it('should add not default video config in cli config only for cyp 12 or below', () => {
3520+
it('should not add default video config in cli config only for cyp 12 or below', () => {
35213521
let bsConfig = {
35223522
run_settings: {cypress_version: '12.latest'},
35233523
};
35243524
utils.getVideoConfig({}, bsConfig);
35253525
expect(undefined).to.be.eql(bsConfig.run_settings.config);
35263526
});
35273527

3528-
it('should add bstack json video config in cli config if none in cypress config for cyp 13', () => {
3528+
it('should not add bstack json video config in cli config if none in cypress config for cyp 13', () => {
35293529
let bsConfig = {
35303530
run_settings: {cypress_version: '13.latest', video: true, videoUploadOnPasses: false}
35313531
};
35323532
let cypressConfig = {};
3533-
let outputConfig = 'video=true,videoUploadOnPasses=false';
3533+
let outputConfig = 'video=true,videoUploadOnPasses=true';
35343534
utils.getVideoConfig(cypressConfig, bsConfig);
35353535
expect(outputConfig).to.be.eql(bsConfig.run_settings.config);
35363536
});

0 commit comments

Comments
 (0)