Local-first visual regression capture for playwright-python and Selenium — pixel + DOM diff, tunable tolerances, PR approvals; shares baselines with the JS/TS TestivAI adapters
Project description
testivai (Python)
Local-first visual regression for playwright-python — pixel + DOM comparison with tunable tolerances, a self-contained HTML report, and PR-comment baseline approvals. Shares the exact on-disk contract with the JS/TS TestivAI adapters, so mixed-language repos use one set of baselines, one report, one approval flow.
pip install testivai[playwright]
With pytest (pytest-playwright)
def test_homepage(page, testivai_witness):
page.goto("http://localhost:3000")
testivai_witness(page, "homepage")
The bundled pytest plugin runs testivai report at session end: captures are
diffed against .testivai/baselines/, tolerances from .testivai/config.json
apply, and visual-report/index.html + results.json are written. Approve
baselines with npx testivai approve --all (or a /testivai approve PR
comment via the GitHub Action).
Without pytest
from testivai import witness, run_report
witness(page, "homepage", ignore_selectors=[".live-feed"], variant="firefox")
run_report()
What captures do (identical to the JS adapters)
- Stabilization by default: animations/transitions complete instantly at their final state, caret hidden, web fonts awaited — the top causes of flaky visual diffs, neutralized.
ignore_selectors: hidden from the pixels and excluded from the DOM snapshot (dynamic content never counts as a change).variant: folds into the snapshot name (homepage__firefox) so parallel browsers/viewports never overwrite each other's baselines.
The compare/report half runs via the @testivai/witness CLI — Node.js is
already present wherever playwright-python is (Playwright for Python ships a
Node driver). Resolution order: TESTIVAI_CLI env → testivai on PATH →
npx --yes @testivai/witness.
Docs: https://github.com/mcbuddy/testivai-oss/blob/main/docs/frameworks/python.md
MIT.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file testivai-0.1.0.tar.gz.
File metadata
- Download URL: testivai-0.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
697a9c6f4b3b6f2632510b14eb80674bd9e648c4df96c47fdd56873e25589aec
|
|
| MD5 |
d6287bfadbf261ad15c6dc495cc1c7a6
|
|
| BLAKE2b-256 |
c4a415ab8ad32b7bb1308ca1ffda3ba72ef0c64dbe2c5849ad6bdfbaaa1feb25
|
File details
Details for the file testivai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: testivai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cb9a487ef1bbc52fd952249d1cf6762310b9c01109d0b7b04dbd56d924b7286
|
|
| MD5 |
a059c68471d4b55c35662422ba0906df
|
|
| BLAKE2b-256 |
8cedef669091bb1d4353e326a212640430e9563534460a81154dda3af6aace03
|