diff --git a/screenshot_helper/screenshot_helper.ts b/screenshot_helper/screenshot_helper.ts index 5bf91f1..8c4fd5e 100644 --- a/screenshot_helper/screenshot_helper.ts +++ b/screenshot_helper/screenshot_helper.ts @@ -32,7 +32,7 @@ let looksSame: LooksSame = require('looks-same'); * saved. */ -export async function compareScreenshot(data, golden, outputFolder = undefined): Promise { +export async function compareScreenshot(data, golden, outputFolder = undefined, compareTolerance = 2.5): Promise { return new Promise(async (resolve, reject) => { const tempFolder = createTempFolder(); const screenshotPath = await writeScreenshot(tempFolder, data); @@ -46,7 +46,7 @@ export async function compareScreenshot(data, golden, outputFolder = undefined): const goldenName = path.basename(golden); looksSame(screenshotPath, golden, { strict: false, - tolerance: 2.5, + tolerance: compareThreshold, }, async (error, equal) => { if (error) { reject("There has been an error. Error: " + error);