diff --git a/README.md b/README.md index 8abff09..e7519f9 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Scenario('Compare CPU Usage Images', async (I) => { ### Ignored Box You can also exclude part of the image from comparison, by specifying the excluded area in pixels from the top left. Just declare an object and pass it in options as `ignoredBox`: -``` +```js const box = { left: 0, top: 10, @@ -121,6 +121,19 @@ 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`. +### resemble.js Output Settings +You can set further output settings used by resemble.js. Declare an object specifying them and pass it in the options as `outputSettings`: + +```js +const outputSettings = { + ignoreAreasColoredWith: {r: 250, g: 250, b: 250, a: 0}, + // read more here: https://github.com/rsmbl/Resemble.js +}; +I.seeVisualDiff("image.png", {prepareBaseImage: true, tolerance: 1, outputSettings: outputSettings}); +``` + +Refer to the [resemble.js](https://github.com/rsmbl/Resemble.js) documentation for available output settings. + ### 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`: @@ -130,6 +143,7 @@ I.seeVisualDiff("image.png", {prepareBaseImage: true, tolerance: 1, skipFailure: 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 f4ccfb6..e24bee8 100644 --- a/index.js +++ b/index.js @@ -58,9 +58,13 @@ class ResembleHelper extends Helper { return new Promise((resolve, reject) => { + if (!options.outputSettings) { + options.outputSettings = {}; + } resemble.outputSettings({ boundingBox: options.boundingBox, - ignoredBox: options.ignoredBox + ignoredBox: options.ignoredBox, + ...options.outputSettings, }); this.debug("Tolerance Level Provided " + options.tolerance);