Python bridge for Playwright Smart Reporter - AI-powered test analysis and reporting
Project description
Playwright Smart Reporter - Python
Python integration for Playwright Smart Reporter - brings AI-powered failure analysis, flakiness detection, and beautiful HTML reports to your pytest test suites.
Features
All the features from the main Playwright Smart Reporter, now available for Python/pytest:
- AI Failure Analysis - Claude/OpenAI/Gemini powered suggestions
- Smart Analytics - Flakiness detection, performance regression alerts
- Trend Charts - Visual history of test health over time
- Stability Scoring - A+ to F grades for test reliability
- Failure Clustering - Group similar errors automatically
- Modern Dashboard - Interactive sidebar navigation, light/dark themes
Prerequisites
- Python 3.9+
- Node.js 18+ (runtime only - no
npm installneeded)
Installation
pip install playwright-smart-reporter-python
The package is self-contained. The compiled JavaScript report generator is bundled in the wheel - Node.js is only needed at runtime to execute it.
Quick Start
Option 1: Pytest Plugin (Automatic)
Run your tests with the --smart-reporter flag:
pytest --json-report --smart-reporter
Report automatically generated at smart-report.html.
Option 2: Manual Generation
from playwright_smart_reporter_python import SmartReporterBridge
bridge = SmartReporterBridge()
bridge.generate_report(
pytest_json_path=".pytest-report.json",
output_html="smart-report.html"
)
Configuration
pytest.ini / pyproject.toml
[pytest]
addopts =
--json-report
--json-report-file=.pytest-report.json
--smart-reporter
--smart-reporter-output=test-reports/smart-report.html
Environment Variables
# AI Analysis (optional)
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-..."
export GEMINI_API_KEY="..."
Usage with Playwright for Python
# test_example.py
from playwright.sync_api import Page
def test_homepage(page: Page):
page.goto("https://playwright.dev")
assert page.title() == "Fast and reliable end-to-end testing"
pytest --headed --smart-reporter
How It Works
- pytest runs your tests with JSON reporting enabled
- Converter transforms pytest JSON to Playwright Smart Reporter format
- Node.js bridge calls the bundled HTML generator
- Output interactive HTML report
Development
This is part of a monorepo. The Python package lives in python/ and can use either the bundled JS dist (PyPI install) or the monorepo dist/ (local development).
# From repository root
npm run build # Compile TypeScript
cd python
python scripts/bundle_dist.py # Bundle JS into package
pip install -e ".[dev]" # Editable install
pytest tests/ -v # Run tests
Troubleshooting
Node.js not found
The package needs Node.js at runtime to execute the report generator:
# macOS
brew install node
# Linux
sudo apt install nodejs
# Windows
# Download from https://nodejs.org
License
MIT - See LICENSE.
Related
- Playwright Smart Reporter (Node.js) - Main package
- Playwright for Python - Playwright Python bindings
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 playwright_smart_reporter_python-1.0.7.tar.gz.
File metadata
- Download URL: playwright_smart_reporter_python-1.0.7.tar.gz
- Upload date:
- Size: 113.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd6aee23370f9633b7807003c8871d8cad4be8f0b029d3b6af97e3ef7ade1ae8
|
|
| MD5 |
749a70ad53d10532c4bf0257076c9ac5
|
|
| BLAKE2b-256 |
24d7494722acfc24883c702dc116e34fdb5c879d4cb8d748f8d72080de44515c
|
Provenance
The following attestation bundles were made for playwright_smart_reporter_python-1.0.7.tar.gz:
Publisher:
publish-python.yml on qa-gary-parker/playwright-smart-reporter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
playwright_smart_reporter_python-1.0.7.tar.gz -
Subject digest:
dd6aee23370f9633b7807003c8871d8cad4be8f0b029d3b6af97e3ef7ade1ae8 - Sigstore transparency entry: 924409158
- Sigstore integration time:
-
Permalink:
qa-gary-parker/playwright-smart-reporter@19ac56035f121ea4754a0323010c6b0aa0c9db49 -
Branch / Tag:
refs/tags/python-v1.0.7 - Owner: https://github.com/qa-gary-parker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@19ac56035f121ea4754a0323010c6b0aa0c9db49 -
Trigger Event:
push
-
Statement type:
File details
Details for the file playwright_smart_reporter_python-1.0.7-py3-none-any.whl.
File metadata
- Download URL: playwright_smart_reporter_python-1.0.7-py3-none-any.whl
- Upload date:
- Size: 116.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1c01244f3f74caeaec8e07d5087d28b79071d6a7db41a8b538e65aa707d8e75
|
|
| MD5 |
7435b0075c61048008434629999b7c96
|
|
| BLAKE2b-256 |
4a2eded4954cffe6d5a86211f51781f8d46a73aea23c4331dd99dd503dcd4438
|
Provenance
The following attestation bundles were made for playwright_smart_reporter_python-1.0.7-py3-none-any.whl:
Publisher:
publish-python.yml on qa-gary-parker/playwright-smart-reporter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
playwright_smart_reporter_python-1.0.7-py3-none-any.whl -
Subject digest:
e1c01244f3f74caeaec8e07d5087d28b79071d6a7db41a8b538e65aa707d8e75 - Sigstore transparency entry: 924409180
- Sigstore integration time:
-
Permalink:
qa-gary-parker/playwright-smart-reporter@19ac56035f121ea4754a0323010c6b0aa0c9db49 -
Branch / Tag:
refs/tags/python-v1.0.7 - Owner: https://github.com/qa-gary-parker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@19ac56035f121ea4754a0323010c6b0aa0c9db49 -
Trigger Event:
push
-
Statement type: