Skip to content
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

Exposed fetchMisMatchPercentage #83

Open
wants to merge 2 commits into
base: 1.9.4
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class ResembleHelper extends Helper {
resemble.outputSettings({
boundingBox: options.boundingBox,
ignoredBox: options.ignoredBox,
boundingBoxes: options.boundingBoxes,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mlincoln4 this change is probably going to impact https://github.com/codeceptjs/codeceptjs-resemblehelper/blob/master/index.js#L379 could you please make sure it works as expected

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see where we set the boundingBox option,

options.boundingBox = await this._getBoundingBox(selector);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that is checking the visual difference for an element, in which case I don't think bounding boxes need to be supported since you are already specifying an element for the bounds. I am not sure though. That part isn't as important to me, I just happened to notice the plural ones weren't currently supported.

ignoredBoxes: options.ignoredBoxes,
...options.outputSettings,
});

Expand Down Expand Up @@ -101,7 +103,7 @@ class ResembleHelper extends Helper {
* @param options
* @returns {Promise<*>}
*/
async _fetchMisMatchPercentage(image, options) {
async fetchMisMatchPercentage(image, options) {
const diffImage = "Diff_" + image.split(".")[0];
const result = this._compareImages(image, diffImage, options);
const data = await Promise.resolve(result);
Expand Down Expand Up @@ -321,7 +323,7 @@ class ResembleHelper extends Helper {
if (selector) {
options.boundingBox = await this._getBoundingBox(selector);
}
const misMatch = await this._fetchMisMatchPercentage(baseImage, options);
const misMatch = await this.fetchMisMatchPercentage(baseImage, options);
this._addAttachment(baseImage, misMatch, options.tolerance);
this._addMochaContext(baseImage, misMatch, options.tolerance);
if (awsC !== undefined) {
Expand Down