Skip to content

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

Closed
@jpmschuler

Description

@jpmschuler

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions