From 6320defd9aa297808cc132c09f152cfba4e6c2bc Mon Sep 17 00:00:00 2001 From: Sergio Neves Barros Date: Fri, 26 Aug 2022 15:39:02 +0100 Subject: [PATCH] fixing an issue with dynamic image compare where path doesn't exists due to and old bug. --- app/utils/image-utils.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/utils/image-utils.js b/app/utils/image-utils.js index dafd66d..4f6737f 100644 --- a/app/utils/image-utils.js +++ b/app/utils/image-utils.js @@ -91,8 +91,13 @@ imageUtils.removeScreenshotDirectories = (buildsToDelete) => { }; imageUtils.generateDynamicBaseline = async (screenshot, screenshots) => { + // ensure path exists due to an old bug + const buildPath = `screenshots/${screenshot.build}`; + if (!fs.existsSync(buildPath)) { + fs.mkdirSync(buildPath); + } // file name we'll be overriding it a few times. - const fileName = `screenshots/${screenshot.build}/${screenshot.id}-${Date.now()}-dynamic-baseline.png`; + const fileName = `${buildPath}/${screenshot.id}-${Date.now()}-dynamic-baseline.png`; const currentScreenshotObject = screenshot.toObject(); delete currentScreenshotObject._id; const currentScreenshot = new Screenshot(currentScreenshotObject);