Skip to content

Commit 36072fc

Browse files
committed
create new image when baseline accepted
1 parent 46527ff commit 36072fc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/test-runs/test-runs.service.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ export class TestRunsService {
4040
testVariation: TestVariation;
4141
}> {
4242
const testRun = await this.findOne(id);
43+
44+
// remove old baseline
45+
if (testRun.testVariation.baselineName) {
46+
this.staticService.deleteImage(testRun.testVariation.baselineName);
47+
}
48+
49+
// save new baseline
50+
const baseline = this.staticService.getImage(testRun.imageName)
51+
const imageName = `${Date.now()}.baseline.png`;
52+
this.staticService.saveImage(imageName, baseline.data);
53+
4354
return this.prismaService.testRun.update({
4455
where: { id },
4556
include: {
@@ -49,7 +60,7 @@ export class TestRunsService {
4960
status: TestStatus.ok,
5061
testVariation: {
5162
update: {
52-
baselineName: testRun.imageName,
63+
baselineName: imageName,
5364
},
5465
},
5566
},

0 commit comments

Comments
 (0)