Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to change looks-same threshold #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions screenshot_helper/screenshot_helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let looksSame: LooksSame = require('looks-same');

* saved.
*/
export async function compareScreenshot(data, golden, outputFolder = undefined): Promise<string> {
export async function compareScreenshot(data, golden, outputFolder = undefined, compareTolerance = 2.5): Promise<string> {
return new Promise<string>(async (resolve, reject) => {
const tempFolder = createTempFolder();
const screenshotPath = await writeScreenshot(tempFolder, data);
Expand All @@ -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);
Expand Down