Skip to main content

A pytest wrapper for snapshot testing with playwright

Project description

Pytest Plugin for Snapshot Testing with Playwright

This plugin enables snapshot testing in playwright like snapshotting screenshots of pages, element handles etc.


$ pip install pytest-playwright-snapshot


This plugin provides a assert_snapshot fixture which is used to create snapshots and compare it.


def test_myapp(page, assert_snapshot):
    assert_snapshot(page.screenshot(), "example.png")

Ths first time you run pytest, you will get error like

Failed: Snapshot not found, use --update-snapshots to create it.

As first you need to create golden snapshots to which this plugin will compare in future.

To create snapshots run:

$ pytest --update-snapshots

This will create snapshots for your tests, after that you can run the tests are usual and this will compare the snapshots.

There is threshold kwarg only option which can be used to set the threshold for the comparison of the screenshots and by default it is 0.1


Apache 2.0 LICENSE

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-playwright-snapshot-1.0.tar.gz (5.3 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page