Skip to content

Commit

Permalink
Merge pull request #47 from Kartikeya99/dimension
Browse files Browse the repository at this point in the history
Error to show dimensions.
  • Loading branch information
puneet0191 authored Sep 2, 2019
2 parents a878ef7 + 8470e34 commit 9c741ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const mkdirp = require('mkdirp');
const getDirName = require('path').dirname;
const AWS = require('aws-sdk');
const path = require('path');
const sizeOf = require('image-size');

/**
* Resemble.js helper class for CodeceptJS, this allows screen comparison
Expand Down Expand Up @@ -54,7 +55,11 @@ class ResembleHelper extends Helper {
if (err) {
reject(err);
} else {
if(!data.isSameDimensions) reject(new Error("The images are not of same dimensions. Please use images of same dimensions so as to avoid any unexpected results."));
if(!data.isSameDimensions) {
let dimensions1 = sizeOf(image1);
let dimensions2 = sizeOf(image2);
reject(new Error("The image1 is of " +dimensions1.height + " X " + dimensions1.width + " and image2 is of " + dimensions2.height + " X " + dimensions2.width + ". 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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"resemblejs": "^3.0.0",
"mkdirp": "^0.5.1",
"path": "^0.12.7",
"aws-sdk": "^2.476.0"
"aws-sdk": "^2.476.0",
"image-size": "^0.7.4"
},
"keywords": [
"codeceptJS",
Expand Down

0 comments on commit 9c741ba

Please sign in to comment.