Skip to content

Commit

Permalink
Merge pull request #32 from Kartikeya99/ignoredBox
Browse files Browse the repository at this point in the history
Fixed bug when dimensions aren't same
  • Loading branch information
puneet0191 authored Jul 24, 2019
2 parents 030c5ce + 33ec041 commit ca32b30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ Scenario('Compare CPU Usage Images', async (I) => {
I.seeVisualDiffForElement("//div[@class='panel-container']", "Complete_Dashboard_Image.png", {prepareBaseImage: false, tolerance: 3});
});
```
>Note: `seeVisualDiff` and `seeVisualDiffElement` work only when the dimensions of the screenshot as well as the base image are same so as to avoid unexpected results.
### 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 options as `ignoredBox`:
Just declare an object and pass it in options as `ignoredBox`:
```
const box = {
left: 0,
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ResembleHelper extends Helper {
if (err) {
reject(err);
} else {
if(!data.isSameDimensions) throw new Error("The images are not of same dimensions. Please use images of same dimensions so as to avoid any unexpected results.")
resolve(data);
if (data.misMatchPercentage >= tolerance) {
mkdirp(getDirName(this.config.diffFolder + diffImage), function (err) {
Expand Down

0 comments on commit ca32b30

Please sign in to comment.