From 4638fd3259da43e7bf829f083ee4530b8a67b13a Mon Sep 17 00:00:00 2001 From: Jonatas Kirsch Date: Sun, 26 Apr 2020 00:10:18 +0200 Subject: [PATCH 1/2] Option bypassFailure allowing the user to avoid failing the test for a given threshold but yet generating the difference image --- README.md | 9 +++++++++ index.js | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bc75a17..4b5ecff 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`. +### Bypass 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 `bypassFailure`: +``` +I.seeVisualDiff("image.png", {prepareBaseImage: true, tolerance: 1, bypassFailure: 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..516add2 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.bypassFailure === 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; From ea032d4026c7fbecdb73c48ce708d2c034d52e64 Mon Sep 17 00:00:00 2001 From: Jonatas Kirsch Date: Sun, 26 Apr 2020 10:22:09 +0200 Subject: [PATCH 2/2] Renamed option to skipFailure --- README.md | 6 +++--- index.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4b5ecff..44f8738 100644 --- a/README.md +++ b/README.md @@ -115,11 +115,11 @@ 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`. -### Bypass Failure +### 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 `bypassFailure`: +Just declare an object and pass it in options as `skipFailure`: ``` -I.seeVisualDiff("image.png", {prepareBaseImage: true, tolerance: 1, bypassFailure: true}); +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`. diff --git a/index.js b/index.js index 516add2..d5714dc 100644 --- a/index.js +++ b/index.js @@ -322,7 +322,7 @@ class ResembleHelper extends Helper { this.debug("MisMatch Percentage Calculated is " + misMatch); - if (options.bypassFailure === false) { + if (options.skipFailure === false) { assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch); } }