Pytest Plugin for Snapshot Testing with Playwright
This plugin enables snapshot testing in playwright like snapshotting screenshots of pages, element handles etc.
Installation
$ pip install pytest-playwright-snapshot
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(), "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
License
Apache 2.0 LICENSE
Release files for pytest-playwright-snapshot 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest-playwright-snapshot-1.0.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_playwright_snapshot-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / pytest-playwright-snapshot-1.0.tar.gz
| Download URL | pytest-playwright-snapshot-1.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b22c06e2b70b08a36bda6d3106883d9a83fafae057eb8a18cc928f66fcac622
|
|
BLAKE2b-256 checksum How to use checksums |
ef7c94a5db046321053449a7947bfc089c26cb2e4dc7c52b076aa7dbc58da7f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
|
Release files / pytest_playwright_snapshot-1.0-py3-none-any.whl
| Download URL | pytest_playwright_snapshot-1.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c0bad6b647d50a52ac2b432695dbdd7aaae387e426794b2e66aa27493f65f42
|
|
BLAKE2b-256 checksum How to use checksums |
657cb8ead32d2880ce38d41f424270bd2143164d972aa93bc2a5aa14e7819184
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
|