A pytest fixture for visual testing with Playwright
Likely abandoned. No release or commit for years (last release over 4 years ago).
Consider insteadpytest-playwright-visual-snapshotPythie’s Index: 65463.7K downloads/moCompare →
pip install pytest-playwright-visualPytest Plugin for Visual Testing with Playwright
Based on pixelmatch-py image comparison library.
Expands assert_snapshot fixture from pytest-playwright-snapshot library
Main Features:
- snapshots creation on the first run
- visual review of mismatches
- failing on
--update-snapshotsto make users manually review images - snapshot name is optional,
test_name[browser][os].pngis auto-generated by default - updated folder structure:
snapshots/file_name/test_name/test_name[browser][os].png
Installation
$ pip install pytest-playwright-visual
Usage
This plugin provides a assert_snapshot fixture which is used to create snapshots and compare it.
Example:
def test_myapp(page, assert_snapshot):
page.goto("https://example.com")
assert_snapshot(page.screenshot())
Then, run pytest:
$ pytest
The first time you run pytest, snapshots will be created, and you will get the error:
Failed: --> New snapshot(s) created. Please review images
The next run, the snapshots comparison will take place.
To update snapshots, run:
$ pytest --update-snapshots
After updating, tests will fail and you will need to review images.
In case of a mismatch, snapshot_tests_failures folder will be created with Actual_.., Expected_.. and Diff_.. images generated.
Folder Structure Example

API
assert_snapshot(page.screenshot(), threshold: float = 0.1, name='test_name[browser][os].png', fail_fast=False)
threshold- sets the threshold for the comparison of the screenshots:0to1. Default is0.1name- extensions only. Default is (recommended)