Skip to content

Avoid failing the test for a given threshold but yet generating the difference image #63

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

Merged
merged 2 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ I.seeVisualDiff("image.png", {prepareBaseImage: true, tolerance: 1, ignoredBox:
After this, that specific mentioned part will be ignored while comparison.
This works for `seeVisualDiff` and `seeVisualDiffForElement`.

### Skip Failure
You can avoid the test fails for a given threshold but yet generates the difference image.
Just declare an object and pass it in options as `skipFailure`:
```
I.seeVisualDiff("image.png", {prepareBaseImage: true, tolerance: 1, skipFailure: true});
```
After this, the system generates the difference image but does not fail the test.
This works for `seeVisualDiff` and `seeVisualDiffForElement`.

### Allure Reporter
Allure reports may also be generated directly from the tool. To do so, add

Expand Down
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,10 @@ class ResembleHelper extends Helper {
}

this.debug("MisMatch Percentage Calculated is " + misMatch);
assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch);

if (options.skipFailure === false) {
assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch);
}
}

/**
Expand Down Expand Up @@ -426,4 +429,4 @@ class ResembleHelper extends Helper {
}
}

module.exports = ResembleHelper;
module.exports = ResembleHelper;