Skip to content

Error to show dimensions. #47

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 1 commit into from
Sep 2, 2019
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
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