https://github.com/kasprzakqa/playwright-pytest-toolshop
E2E test automation for the Toolshop demo app - Python, Playwright, pytest: UI, REST API and accessibility, CI-gated.
https://github.com/kasprzakqa/playwright-pytest-toolshop
accessibility-testing api-testing e2e-testing page-object-model playwright pytest python qa-automation test-automation
Last synced: 26 days ago
JSON representation
E2E test automation for the Toolshop demo app - Python, Playwright, pytest: UI, REST API and accessibility, CI-gated.
- Host: GitHub
- URL: https://github.com/kasprzakqa/playwright-pytest-toolshop
- Owner: kasprzakqa
- License: mit
- Created: 2026-06-23T07:50:06.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-06-28T11:39:34.000Z (29 days ago)
- Last Synced: 2026-06-28T13:17:43.461Z (29 days ago)
- Topics: accessibility-testing, api-testing, e2e-testing, page-object-model, playwright, pytest, python, qa-automation, test-automation
- Language: Python
- Size: 31.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Toolshop Automation - Playwright + pytest
[](https://github.com/kasprzakqa/playwright-pytest-toolshop/actions/workflows/ci.yml)
[](https://www.python.org/)
[](https://playwright.dev/python/)
End-to-end test automation framework for the [Practice Software Testing](https://practicesoftwaretesting.com)
("Toolshop") application - UI journeys, REST API, and accessibility - built with Python,
Playwright (sync) and pytest, with the API layer gated continuously in GitHub Actions.
## What it covers
| Layer | Coverage |
|-------|----------|
| **API** | Products & catalog (schema-validated), pagination, 404, authentication (token + 401) |
| **UI E2E** | Login (valid / invalid), catalog search, full checkout (cart -> billing -> payment -> confirmation) |
| **Accessibility** | axe-core scan gated on serious/critical, keyboard operability |
## Design highlights
- **Page Object Model** - locators live in page classes; tests read as scenarios.
- **Role-first locators** - `get_by_role` / `get_by_placeholder` / `get_by_test_id`; no brittle CSS.
- **Deterministic waiting** - Playwright web-first assertions only; zero `time.sleep`.
- **Isolation** - authentication injected via `storage_state`, not re-driven per test.
- **Typed API contracts** - `pydantic` models make a renamed/missing field fail loudly.
- **Suite markers** - `smoke` (deploy gate) / `regression` / `sanity`, plus `api` / `a11y`.
- **Parallel** - `pytest-xdist` (`-n auto`).
## Project layout
```
pages/ Page Object Model (base, login, home, product, checkout)
tests/
conftest.py shared fixtures (API context, storage_state auth)
api/ API tests (pydantic-validated)
e2e/ UI journeys: auth, catalog, checkout
a11y/ axe scan + keyboard
data/ pydantic models + Faker factories
utils/ config + API clients
docs/ test strategy & test plan
```
## Running locally
```bash
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python -m playwright install chromium
pytest -n auto # full suite, parallel
pytest -m smoke # critical-path gate
pytest --headed tests/e2e # watch the browser
```
Configuration is environment-driven (`.env`, see `.env.example`) so the same suite runs against
the public demo or a local instance.
## CI
GitHub Actions runs **lint + the API suite** on every push and PR (one controlled retry, HTML report
artifact), plus a nightly API regression. The UI e2e and accessibility suites are not on hosted CI:
GitHub runners cannot reliably reach the public Toolshop SPA (the demo throttles datacenter IPs), so
they run locally and via a clean-clone check, with a containerized CI job as the documented next step
(see the [test strategy](docs/test-strategy.md)). The same suite passes for anyone who clones and runs it.
## Documentation
- [Test strategy](docs/test-strategy.md)
- [Test plan](docs/test-plan.md)