Skip to content

Improve reliability of Playwright visual regression testing #9713

Open

Description

Description

Recently (as of the date of creating this issue), the PW E2E tests started failing without any noticeable change to the codebase. When looking at the reasons, the source of the failures were a couple of toHaveScreenshot assertions.

When looking at the visual diff, we notice that the changes are minimal, the contents did not change at all, only moved slightly lower.

Image

These screenshots were updated in #9712 to make the tests pass again; however, we need to make sure that the tests are more reliable and at the same time help us to spot regressions/unintended behavior. (UPDATE: I had to disable all visual regression tests in #9718 since they started failing again.)

Acceptance criteria

We have a couple of options here:

A) Update the maxDiffPixelRatio setting in the playwright.config.ts file so it has a higher tolerance for changes; However, how can we decide which value is acceptable?
B) Avoid using toHaveScreenshot and use other assertions instead?

We could also have a combination of both, in which we make sure that the contents match our expectation, and that the visual diff is close enough (with a higher threshold for tolerated changes).

Testing instructions

  1. See instructions for running pw tests locally in the tests/e2e-pw/README.md file.

Dev notes

maxDiffPixelRatio location in the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    focus: devopsRelease processes, monitoring, automations, dev tools, CI/CD pipeline

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions