@@ -3055,6 +3055,41 @@ describe('utils', () => {
30553055 } ) ;
30563056 } ) ;
30573057
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+
30583093 describe ( 'setEnforceSettingsConfig' , ( ) => {
30593094 it ( 'the video config should be assigned to bsconfig run_settings config' , ( ) => {
30603095 let bsConfig = {
@@ -3081,7 +3116,7 @@ describe('utils', () => {
30813116 run_settings : { specs : 'somerandomspecs' , cypressTestSuiteType : 'CYPRESS_V9_AND_OLDER_TYPE' } ,
30823117 } ;
30833118 let args = {
3084- config : 'video=false,videoUploadOnPasses=false,testFiles="somerandomspecs" '
3119+ config : 'video=false,videoUploadOnPasses=false'
30853120 }
30863121 utils . setEnforceSettingsConfig ( bsConfig ) ;
30873122 expect ( args . config ) . to . be . eql ( bsConfig . run_settings . config ) ;
@@ -3463,6 +3498,43 @@ describe('utils', () => {
34633498 expect ( utils . getVideoConfig ( { video : false , videoUploadOnPasses : false } ) ) . to . be . eql ( { video : false , videoUploadOnPasses : false } ) ;
34643499 } ) ;
34653500
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+
34663538 it ( 'should return default hash and ignore video config in cypress config if enforce_settings is passed by the user' , ( ) => {
34673539 expect ( utils . getVideoConfig ( { video : false } , { run_settings : { enforce_settings : true } } ) ) . to . be . eql ( { video : true , videoUploadOnPasses : true } ) ;
34683540 expect ( utils . getVideoConfig ( { videoUploadOnPasses : false } , { run_settings : { enforce_settings : true } } ) ) . to . be . eql ( { video : true , videoUploadOnPasses : true } ) ;
0 commit comments