Skip to content

Commit 3732670

Browse files
jonataskJonatas Kirsch
andauthored
Avoid failing the test for a given threshold but yet generating the difference image (#63)
* Option bypassFailure allowing the user to avoid failing the test for a given threshold but yet generating the difference image * Renamed option to skipFailure Co-authored-by: Jonatas Kirsch <[email protected]>
1 parent 714c79a commit 3732670

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ I.seeVisualDiff("image.png", {prepareBaseImage: true, tolerance: 1, ignoredBox:
121121
After this, that specific mentioned part will be ignored while comparison.
122122
This works for `seeVisualDiff` and `seeVisualDiffForElement`.
123123

124+
### Skip Failure
125+
You can avoid the test fails for a given threshold but yet generates the difference image.
126+
Just declare an object and pass it in options as `skipFailure`:
127+
```
128+
I.seeVisualDiff("image.png", {prepareBaseImage: true, tolerance: 1, skipFailure: true});
129+
```
130+
After this, the system generates the difference image but does not fail the test.
131+
This works for `seeVisualDiff` and `seeVisualDiffForElement`.
132+
124133
### Allure Reporter
125134
Allure reports may also be generated directly from the tool. To do so, add
126135

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,10 @@ class ResembleHelper extends Helper {
326326
}
327327

328328
this.debug("MisMatch Percentage Calculated is " + misMatch);
329-
assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch);
329+
330+
if (options.skipFailure === false) {
331+
assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch);
332+
}
330333
}
331334

332335
/**

0 commit comments

Comments
 (0)