Skip to content

Commit ca32b30

Browse files
authored
Merge pull request #32 from Kartikeya99/ignoredBox
Fixed bug when dimensions aren't same
2 parents 030c5ce + 33ec041 commit ca32b30

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ Scenario('Compare CPU Usage Images', async (I) => {
101101
I.seeVisualDiffForElement("//div[@class='panel-container']", "Complete_Dashboard_Image.png", {prepareBaseImage: false, tolerance: 3});
102102
});
103103
```
104+
>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.
104105
105106
### Ignored Box
106107
You can also exclude part of the image from comparison, by specifying the excluded area in pixels from the top left.
107-
Just declare an object and pass it options as `ignoredBox`:
108+
Just declare an object and pass it in options as `ignoredBox`:
108109
```
109110
const box = {
110111
left: 0,

Diff for: index.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class ResembleHelper extends Helper {
3939
if (err) {
4040
reject(err);
4141
} else {
42+
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.")
4243
resolve(data);
4344
if (data.misMatchPercentage >= tolerance) {
4445
mkdirp(getDirName(this.config.diffFolder + diffImage), function (err) {

0 commit comments

Comments
 (0)