@@ -3055,6 +3055,41 @@ describe('utils', () => {
3055
3055
} ) ;
3056
3056
} ) ;
3057
3057
3058
+ describe ( 'setVideoCliConfig' , ( ) => {
3059
+ it ( 'the args should be empty if any of videoconfig or bsconfig is undefined' , ( ) => {
3060
+ let bsConfig = {
3061
+ run_settings : { } ,
3062
+ } ;
3063
+ let videoConfig = {
3064
+ } ;
3065
+ utils . setVideoCliConfig ( bsConfig , videoConfig ) ;
3066
+ expect ( undefined ) . to . be . eql ( bsConfig . run_settings . config ) ;
3067
+ } ) ;
3068
+ it ( 'the config should have video true if video is passed true' , ( ) => {
3069
+ let bsConfig = {
3070
+ run_settings : { } ,
3071
+ } ;
3072
+ let videoConfig = { video :true , videoUploadOnPasses :true } ;
3073
+ let outputConfig = {
3074
+ config : 'video=true,videoUploadOnPasses=true'
3075
+ } ;
3076
+ utils . setVideoCliConfig ( bsConfig , videoConfig ) ;
3077
+ expect ( outputConfig . config ) . to . be . eql ( bsConfig . run_settings . config ) ;
3078
+ } ) ;
3079
+ it ( 'the config should have config with video false if video is passed false' , ( ) => {
3080
+ let bsConfig = {
3081
+ run_settings : { } ,
3082
+ } ;
3083
+ let videoConfig = { video :false , videoUploadOnPasses :true } ;
3084
+ let outputConfig = {
3085
+ config : 'video=false,videoUploadOnPasses=true'
3086
+ } ;
3087
+ utils . setVideoCliConfig ( bsConfig , videoConfig ) ;
3088
+ expect ( outputConfig . config ) . to . be . eql ( bsConfig . run_settings . config ) ;
3089
+ } ) ;
3090
+ } ) ;
3091
+
3092
+
3058
3093
describe ( 'setEnforceSettingsConfig' , ( ) => {
3059
3094
it ( 'the video config should be assigned to bsconfig run_settings config' , ( ) => {
3060
3095
let bsConfig = {
@@ -3081,7 +3116,7 @@ describe('utils', () => {
3081
3116
run_settings : { specs : 'somerandomspecs' , cypressTestSuiteType : 'CYPRESS_V9_AND_OLDER_TYPE' } ,
3082
3117
} ;
3083
3118
let args = {
3084
- config : 'video=false,videoUploadOnPasses=false,testFiles="somerandomspecs" '
3119
+ config : 'video=false,videoUploadOnPasses=false'
3085
3120
}
3086
3121
utils . setEnforceSettingsConfig ( bsConfig ) ;
3087
3122
expect ( args . config ) . to . be . eql ( bsConfig . run_settings . config ) ;
@@ -3463,6 +3498,43 @@ describe('utils', () => {
3463
3498
expect ( utils . getVideoConfig ( { video : false , videoUploadOnPasses : false } ) ) . to . be . eql ( { video : false , videoUploadOnPasses : false } ) ;
3464
3499
} ) ;
3465
3500
3501
+ it ( 'should add default video config in cli config only for cyp 13' , ( ) => {
3502
+ let bsConfig = {
3503
+ run_settings : { cypress_version : '13.latest' } ,
3504
+ } ;
3505
+ let outputConfig = 'video=true,videoUploadOnPasses=true' ;
3506
+ utils . getVideoConfig ( { } , bsConfig ) ;
3507
+ expect ( outputConfig ) . to . be . eql ( bsConfig . run_settings . config ) ;
3508
+ } ) ;
3509
+
3510
+ it ( 'should add not default video config in cli config only for cyp 12 or below' , ( ) => {
3511
+ let bsConfig = {
3512
+ run_settings : { cypress_version : '12.latest' } ,
3513
+ } ;
3514
+ utils . getVideoConfig ( { } , bsConfig ) ;
3515
+ expect ( undefined ) . to . be . eql ( bsConfig . run_settings . config ) ;
3516
+ } ) ;
3517
+
3518
+ it ( 'should add bstack json video config in cli config if none in cypress config for cyp 13' , ( ) => {
3519
+ let bsConfig = {
3520
+ run_settings : { cypress_version : '13.latest' , video : true , videoUploadOnPasses : false }
3521
+ } ;
3522
+ let cypressConfig = { } ;
3523
+ let outputConfig = 'video=true,videoUploadOnPasses=false' ;
3524
+ utils . getVideoConfig ( cypressConfig , bsConfig ) ;
3525
+ expect ( outputConfig ) . to . be . eql ( bsConfig . run_settings . config ) ;
3526
+ } ) ;
3527
+
3528
+ it ( 'should add cypress config video config in cli config over bstack json for cyp 13' , ( ) => {
3529
+ let bsConfig = {
3530
+ run_settings : { cypress_version : '13.latest' } ,
3531
+ } ;
3532
+ let cypressConfig = { video : false } ;
3533
+ let outputConfig = 'video=false,videoUploadOnPasses=true' ;
3534
+ utils . getVideoConfig ( cypressConfig , bsConfig ) ;
3535
+ expect ( outputConfig ) . to . be . eql ( bsConfig . run_settings . config ) ;
3536
+ } ) ;
3537
+
3466
3538
it ( 'should return default hash and ignore video config in cypress config if enforce_settings is passed by the user' , ( ) => {
3467
3539
expect ( utils . getVideoConfig ( { video : false } , { run_settings : { enforce_settings : true } } ) ) . to . be . eql ( { video : true , videoUploadOnPasses : true } ) ;
3468
3540
expect ( utils . getVideoConfig ( { videoUploadOnPasses : false } , { run_settings : { enforce_settings : true } } ) ) . to . be . eql ( { video : true , videoUploadOnPasses : true } ) ;
0 commit comments