Skip to content

FEATURE: allow resemble.compare even if dimensions are not the same #94

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

Closed
jpmschuler opened this issue Aug 26, 2021 · 2 comments
Closed

Comments

@jpmschuler
Copy link
Contributor

The documentation says:

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.

which is found in the code

if (!data.isSameDimensions) {
let dimensions1 = sizeOf(baseImage);
let dimensions2 = sizeOf(actualImage);
reject(new Error(`The base image is of ${dimensions1.height} X ${dimensions1.width} and actual image is of ${dimensions2.height} X ${dimensions2.width}. Please use images of same dimensions so as to avoid any unexpected results.`));
}

However the underlying resemble.js works just fine in calculating the diff percentage and tolerance and taking that into account.

I propose to make this check optional and thus introduce an option/parameter to skip that check

Background:
We use visual regression testing for webpages and as we allow some tolerance for minor layout changes. But this could also make a full page screenshot some few pixel longer.
This should be able to fail the test (as is the state now), but in fact only with 0 tolerance. However if you have a tolerance defined, tests should be able to run fine nevertheless if the change is within the tolerance.

@puneet0191
Copy link
Member

Thanks a lot, I think it should fine to add this check as an optional parameter, which is defaulted to true.

@jpmschuler could you please have a PR for this request, if you have time. It would be great help. I will make a new release.

jpmschuler added a commit to jpmschuler/codeceptjs-resemblehelper that referenced this issue Sep 13, 2021
puneet0191 pushed a commit that referenced this issue Nov 2, 2021
…96)

* [FEATURE] allow resemble.compare even if dimensions are not the same \n\nsee #94

* fix default value overriding custom value "false"
puneet0191 added a commit that referenced this issue Nov 6, 2021
* Fixed optional param in JSDoc and generated TS definition (#99)

* [TASK] fix relative paths for Mochawesome context screenshots (#97)

* [TASK] fix relative paths for Mochawesome context screenshots

* [TASK] improve relative path generation for cases where report is not in default folder

* [TASK] switch to Path.relative

* [TASK] add more pessimistic check for undefined options

* [TASK] resolveRelativePath should not be public

* [FEATURE] allow resemble.compare even if dimensions are not the same (#96)

* [FEATURE] allow resemble.compare even if dimensions are not the same \n\nsee #94

* fix default value overriding custom value "false"

* Update Version, Prepare for release.

Co-authored-by: Jaromir Obr <[email protected]>
Co-authored-by: jpmschuler <[email protected]>
@puneet0191
Copy link
Member

Thank you, fixed with https://github.com/codeceptjs/codeceptjs-resemblehelper/releases/tag/v1.9.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants