diff --git a/README.md b/README.md index bc75a17..44f8738 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/index.js b/index.js index ecb5383..d5714dc 100644 --- a/index.js +++ b/index.js @@ -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); + } } /** @@ -426,4 +429,4 @@ class ResembleHelper extends Helper { } } -module.exports = ResembleHelper; \ No newline at end of file +module.exports = ResembleHelper;