Skip to content

passing through output settings to resemble.js #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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`:
Expand All @@ -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

Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down