From 9bd90e20eb8a6b2b02e04aae2f2ed68cb630cd73 Mon Sep 17 00:00:00 2001 From: JANK Michael Date: Fri, 3 Jan 2020 10:48:39 +0100 Subject: [PATCH] passing through output settings to resemble.js --- README.md | 15 ++++++++++++++- index.js | 6 +++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bc75a17..b6a2f95 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,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, @@ -115,6 +115,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. + ### 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..4f0f8d0 100644 --- a/index.js +++ b/index.js @@ -57,9 +57,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);