codeceptjs / codeceptjs-resemblehelper

MIT License
27 stars 53 forks source link

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

Closed jpmschuler closed 3 years ago

jpmschuler commented 3 years ago

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 https://github.com/codeceptjs/codeceptjs-resemblehelper/blob/3d9974df5db59206bfd2f322a5fb926ee652071d/index.js#L79-L83 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 commented 3 years ago

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.

puneet0191 commented 3 years ago

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