A pytest plugin that runs Axe-core on Playwright pages and takes snapshots of the results.
Project description
pytest-axe-playwright-snapshot
A pytest plugin that runs Axe-core on Playwright pages and takes snapshots of the results.
Installation
-
Install the plugin:
python3 -m pip install pytest-axe-playwright-snapshot
-
Install Playwright browsers:
python3 -m playwright install --with-deps
Usage
In your tests, use the page
fixture from pytest-playwright along with our plugin'saxe_pytest_snapshot
fixture. Once you've navigated to a page, call axe_pytest_snapshot
with the page
fixture as an argument:
from playwright.sync_api import Page
def test_violations(page: Page, axe_pytest_snapshot):
page.goto("https://www.example.com")
axe_pytest_snapshot(page)
When you run a test for the first time, you must tell it explicitly to save a snapshot:
pytest --snapshot-update
The plugin will take a snapshot of the page and save it to a file in the snapshots
directory. The snapshot directory will be named after the test function, and the file will be named 'violations.txt'.
On subsequent runs, the plugin will compare the latest snapshot against the snapshot and report any difference in the violations.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest_axe_playwright_snapshot-0.0.5.tar.gz
.
File metadata
- Download URL: pytest_axe_playwright_snapshot-0.0.5.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f7cf699292c130d8a0d7d091fdf952139a48ac1e5dbd9987c3dfc746d8bd697 |
|
MD5 | 4515ea0fada4196208caff337f09c28b |
|
BLAKE2b-256 | 3c66e6c074afaa39390de3c56be347bb7ef6ec333cd2a76a5a88f12384852170 |
File details
Details for the file pytest_axe_playwright_snapshot-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: pytest_axe_playwright_snapshot-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dd5cfe5cd4ef29941906178853b2f97dbe93f07bc706a2c43b5e3afd18dc672 |
|
MD5 | 9c637157c53784c1da94f114271dd1ad |
|
BLAKE2b-256 | 9b350a3895b6dae263d661aa8637891a2db9634242018623c00b22786fe83ab1 |