This is an example project demonstrating how to run Playwright tests with Pytest and report results, presumably to TestBeats.
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Create a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate
-
Install dependencies: This project uses
uv
for dependency management.uv sync pyproject.toml
-
Install Playwright browsers:
playwright install
To run the tests, use Pytest:
pytest --output=reports --screenshot=only-on-failure --junitxml=reports/junit.xml
This will execute the tests found in files like test_example.py
.
This project is configured to generate a JUnit XML report, which is a common format for test reporting tools like TestBeats.
-
Generate JUnit XML report: Pytest can generate a JUnit XML report using the
--junitxml
flag.pytest --junitxml=reports/junit.xml
Make sure the
reports
directory exists, or create it:mkdir -p reports
-
Upload to TestBeats: The method for uploading
reports/junit.xml
to TestBeats depends on your specific TestBeats setup. This typically involves:- Using a TestBeats CLI tool.
- A CI/CD integration that automatically picks up the report.
Please refer to the TestBeats documentation for the specific command or procedure to upload the JUnit XML file.
Example (conceptual - replace with actual TestBeats command):
npx testbeats@latest publish --slack <slack-webhook-url> --junit reports/junit.xml
Please feel free to submit issues and pull requests.
This project is licensed under the MIT License. See the LICENSE file for details, which mentions TestBeats.