{"id":24435,"library":"pytest-playwright-visual","title":"pytest-playwright-visual","description":"A pytest fixture for visual testing with Playwright. Version 2.1.2 (released 2025). Active development with monthly releases.","status":"active","version":"2.1.2","language":"python","source_language":"en","source_url":"https://github.com/symon-storozhenko/pytest-playwright-visual","tags":["pytest","playwright","visual testing","screenshot","snapshot"],"install":[{"cmd":"pip install pytest-playwright-visual","lang":"bash","label":"Install"}],"dependencies":[{"reason":"Test framework","package":"pytest","optional":false},{"reason":"Browser automation","package":"playwright","optional":false}],"imports":[{"note":"The plugin is registered as a pytest plugin; no direct import needed for the fixture. Fixture name is 'page' from pytest-playwright.","symbol":"page","correct":"from pytest_playwright_visual.plugin import VisualPlugin"}],"quickstart":{"code":"import pytest\nfrom playwright.sync_api import Page\n\ndef test_visual(page: Page):\n    page.goto('https://example.com')\n    page.screenshot(path='screenshot.png')  # snapshot auto-created on first run\n","lang":"python","description":"Basic visual test using the page fixture (provided by pytest-playwright). First run creates snapshots; subsequent runs compare."},"warnings":[{"fix":"Re-run tests with --update-snapshots after removing old snapshots, or manually restructure folders.","message":"v2.0 restructured snapshot folder from flat to hierarchical: snapshots/<file_name>/<test_name>/<test_name>[browser][os].png. All existing snapshots must be moved/recreated.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use --update-snapshots with caution; expect test failure to prompt manual review. Or use v1.x if automatic update is needed.","message":"v2.0 fails on --update-snapshots to force users to manually review images. Tests will fail if snapshots are updated without manual review.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Either omit snapshot_name to use default, or ensure unique names.","message":"Snapshot name argument ('snapshot_name') is optional in v2.0+. Default name is auto-generated as test_name[browser][os].png. If you explicitly pass a name, it may conflict with the auto-generated one.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use the pytest plugin registration; no direct import needed. Ensure you have installed the package.","cause":"Older import pattern from v1.x was 'from pytest_playwright_visual import ...'. v2.0 changed the package structure.","error":"ModuleNotFoundError: No module named 'pytest_playwright_visual'"},{"fix":"Adjust threshold parameter in the fixture or increase it: `threshold=0.1` (default is 0.0). See docs for details.","cause":"The visual comparison threshold is set too low or the screenshot differs significantly.","error":"Failed: Visual diff mismatch (threshold exceeded)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}