@@ -375,47 +375,66 @@ export default class httpClient {
375375 } , ctx . log )
376376 }
377377
378- processSnapshotCaps ( ctx : Context , snapshot : ProcessedSnapshot , snapshotUuid : string , capsBuildId : string , capsProjectToken : string , discoveryErrors : DiscoveryErrors ) {
378+ processSnapshotCaps ( ctx : Context , snapshot : ProcessedSnapshot , snapshotUuid : string , capsBuildId : string , capsProjectToken : string , discoveryErrors : DiscoveryErrors , variantCount : number , sync : boolean = false , approvalThreshold : number | undefined , rejectionThreshold : number | undefined ) {
379+ const requestData : any = {
380+ name : snapshot . name ,
381+ url : snapshot . url ,
382+ snapshotUuid : snapshotUuid ,
383+ variantCount : variantCount ,
384+ test : {
385+ type : ctx . testType ,
386+ source : 'cli'
387+ } ,
388+ doRemoteDiscovery : snapshot . options . doRemoteDiscovery ,
389+ discoveryErrors : discoveryErrors ,
390+ sync : sync
391+ }
392+ if ( approvalThreshold !== undefined ) {
393+ requestData . approvalThreshold = approvalThreshold ;
394+ }
395+ if ( rejectionThreshold !== undefined ) {
396+ requestData . rejectionThreshold = rejectionThreshold ;
397+ }
379398 return this . request ( {
380399 url : `/build/${ capsBuildId } /snapshot` ,
381400 method : 'POST' ,
382401 headers : {
383402 'Content-Type' : 'application/json' ,
384403 projectToken : capsProjectToken !== '' ? capsProjectToken : this . projectToken
385404 } ,
386- data : {
387- name : snapshot . name ,
388- url : snapshot . url ,
389- snapshotUuid : snapshotUuid ,
390- test : {
391- type : ctx . testType ,
392- source : 'cli'
393- } ,
394- doRemoteDiscovery : snapshot . options . doRemoteDiscovery ,
395- discoveryErrors : discoveryErrors ,
396- }
405+ data : requestData
397406 } , ctx . log )
398407 }
399408
400- uploadSnapshotForCaps ( ctx : Context , snapshot : ProcessedSnapshot , capsBuildId : string , capsProjectToken : string , discoveryErrors : DiscoveryErrors ) {
409+ uploadSnapshotForCaps ( ctx : Context , snapshot : ProcessedSnapshot , capsBuildId : string , capsProjectToken : string , discoveryErrors : DiscoveryErrors , variantCount : number , sync : boolean = false , approvalThreshold : number | undefined , rejectionThreshold : number | undefined ) {
401410 // Use capsBuildId if provided, otherwise fallback to ctx.build.id
402411 const buildId = capsBuildId !== '' ? capsBuildId : ctx . build . id ;
403-
412+
413+ const requestData : any = {
414+ snapshot,
415+ test : {
416+ type : ctx . testType ,
417+ source : 'cli'
418+ } ,
419+ discoveryErrors : discoveryErrors ,
420+ variantCount : variantCount ,
421+ sync : sync
422+ }
423+ if ( approvalThreshold !== undefined ) {
424+ requestData . approvalThreshold = approvalThreshold ;
425+ }
426+ if ( rejectionThreshold !== undefined ) {
427+ requestData . rejectionThreshold = rejectionThreshold ;
428+ }
429+
404430 return this . request ( {
405431 url : `/builds/${ buildId } /snapshot` ,
406432 method : 'POST' ,
407433 headers : {
408434 'Content-Type' : 'application/json' ,
409435 projectToken : capsProjectToken !== '' ? capsProjectToken : this . projectToken // Use capsProjectToken dynamically
410436 } ,
411- data : {
412- snapshot,
413- test : {
414- type : ctx . testType ,
415- source : 'cli'
416- } ,
417- discoveryErrors : discoveryErrors ,
418- }
437+ data : requestData
419438 } , ctx . log ) ;
420439 }
421440
@@ -660,9 +679,9 @@ export default class httpClient {
660679 } , ctx . log )
661680 }
662681
663- getSnapshotStatus ( snapshotName : string , snapshotUuid : string , ctx : Context ) : Promise < Record < string , any > > {
682+ getSnapshotStatus ( buildId : string , snapshotName : string , snapshotUuid : string , ctx : Context ) : Promise < Record < string , any > > {
664683 return this . request ( {
665- url : `/snapshot/status?buildId=${ ctx . build . id } &snapshotName=${ snapshotName } &snapshotUUID=${ snapshotUuid } ` ,
684+ url : `/snapshot/status?buildId=${ buildId } &snapshotName=${ snapshotName } &snapshotUUID=${ snapshotUuid } ` ,
666685 method : 'GET' ,
667686 headers : {
668687 'Content-Type' : 'application/json' ,
@@ -675,6 +694,9 @@ export default class httpClient {
675694 if ( ctx . build . name !== undefined && ctx . build . name !== '' ) {
676695 form . append ( 'buildName' , buildName ) ;
677696 }
697+ if ( ctx . options . markBaseline ) {
698+ form . append ( 'markBaseline' , ctx . options . markBaseline . toString ( ) ) ;
699+ }
678700
679701 try {
680702 const response = await this . axiosInstance . request ( {
0 commit comments