Skip to content

Implement snapshot comparison assertion #27

@oleiade

Description

@oleiade

Problem Statement

In a recent internal discussion the potential need to be able to compare browser modules screenshot arise.

Users would like to have the ability to easily compare two screenshots taken by the browser module (unclear if this is prior, or during the test), and assert whether they are different or not.

As it turns out Playwright's assertion framework has matchers dedicated to that, namely toHaveScreenshot and toMatchScreenshot. See their Visual comparison guide, and Snapshot Assertions reference for more detail.

The general idea behind those matchers is to compare the result of a screenshot operation with a pre-existing image, or both pre-existing screenshots, to determine a level of similarity between them, and assert on it, based on acceptable difference parameters and controllable thresholds.

Under the hood, Playwright appears to be using Mapbox's pixelmatch library to perform comparisons.

Solution(s)

To be decided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions