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.4.tar.gz
.
File metadata
- Download URL: pytest_axe_playwright_snapshot-0.0.4.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77178ee08acbe094e09708d74720509635420d023269b11729da46f7ca4c7a39 |
|
MD5 | 653e785f7f225b448dc5d41442c617c8 |
|
BLAKE2b-256 | 302c3f910157a2378e93ba6c0cd94b1ca828855be4c6ba87c752ac5defb841b2 |
File details
Details for the file pytest_axe_playwright_snapshot-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: pytest_axe_playwright_snapshot-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 951c62b54a42463b106c600f683c45040e5c3698fdd3507603aee412e16a979a |
|
MD5 | 05915b643ff4b8085e5c19b3c192b566 |
|
BLAKE2b-256 | cc26c7b484cb87da47427479df5c5e4d4b08e80e06e1c44e3b3a755457b92ddf |