File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ export class TestRunsService {
5656 } ) : Promise < TestRunResultDto > {
5757 const project = await this . prismaService . project . findUnique ( { where : { id : createTestRequestDto . projectId } } ) ;
5858
59+ //createTestRequestDto.branchName===createTestRequestDto.baselineBranchName
5960 let testVariation = await this . testVariationService . find ( {
6061 ...createTestRequestDto ,
6162 sourceBranch : createTestRequestDto . baselineBranchName ,
@@ -104,12 +105,14 @@ export class TestRunsService {
104105 if ( ! testVariation ) {
105106 throw new Error ( 'No test variation found. Re-create test run' ) ;
106107 }
108+ const isManualApprove = ! autoApprove ;
109+ const isLocalBaseline = testRun . baselineBranchName === testRun . branchName ;
107110
108111 // save new baseline
109112 const baseline = this . staticService . getImage ( testRun . imageName ) ;
110113 const baselineName = this . staticService . saveImage ( 'baseline' , PNG . sync . write ( baseline ) ) ;
111114
112- if ( testRun . baselineBranchName !== testRun . branchName && ! merge && ! autoApprove ) {
115+ if ( ! merge && isManualApprove && ! isLocalBaseline ) {
113116 // replace main branch with feature branch test variation
114117 const featureBranchTestVariation = await this . testVariationService . findUnique ( {
115118 ...testRun ,
@@ -140,7 +143,7 @@ export class TestRunsService {
140143 ) ;
141144 }
142145
143- if ( ! autoApprove || ( autoApprove && testRun . baselineBranchName === testRun . branchName ) ) {
146+ if ( isManualApprove || isLocalBaseline ) {
144147 // add baseline
145148 await this . testVariationService . addBaseline ( {
146149 id : testVariation . id ,
You can’t perform that action at this time.
0 commit comments