Short overview: A Python-based Playwright + pytest example repository illustrating recommended patterns for reliable UI tests: page object; centralized locators, environment overlays, fixtures for per-test browser contexts, artifact collection, and CI-ready reporting.
docs/environment_setup.md
— environment,uv
setup, creating virtualenv, running tests, and generating Allure reports.docs/ui-testing-best-practices.md
— design decisions, locator strategy, fixtures, artifacts.
tests/
— test suites and parametrized cases.test_client/
— helpers, page objects, locator resolution (e.g.test_client/util/util.py
).tests/fixtures/
— pytest fixtures (browser/page lifecycle).docs/
— Markdown guides (linked above).reports/
— Allure result json and generated HTML.pytest.ini
,conftest.py
,pyproject.toml
— config and dependency metadata.
- Python 3.12+
uv
(project package manager) on PATH- Playwright browsers installed when prompted (
uv run playwright install
)
Set required environment variables:
export APP_USER="standard_user"
export APP_PASSWORD="secret_sauce"
Create venv, sync deps and run tests:
uv venv --python 3.12 .venv
source .venv/bin/activate
uv sync --group dev
uv run pytest
Generate Allure HTML:
uv run task generate-report
# or
uv run allure generate reports/json -o test-results/html --clean
- Sensitive credentials are supplied via
APP_USER
andAPP_PASSWORD
and referenced inpytest.ini
via placeholders. - Use
pytest --env=qa
to pick environment overlays defined inpytest.ini
. - Artifacts (videos/screenshots) are written to predictable folders for CI collection:
test-results/videos
,reports/json
.