Production-grade Playwright E2E test framework built for teams that need maintainable automation — not scripts that break when a developer changes a class name.
Covers full browser automation with parallel execution, Allure reporting, and CI/CD integration out of the box. Designed to be extended, not rewritten.
- Page Object Model architecture with a typed base class
- Parallel execution across browsers via
pytest-xdist - Allure reporting with automatic screenshot and trace attachment on failure
- Playwright trace capture for every failed test (viewable in trace viewer)
- Configuration via environment variables — no hardcoded values
- Authenticated session fixture for tests that require login
- Smoke / regression / flaky test marker system
- GitHub Actions workflow: smoke on PR, cross-browser regression on merge
playwright-e2e-framework/
├── .github/workflows/ # CI pipeline (smoke + cross-browser regression)
├── config/
│ └── settings.py # Centralized config, reads from env vars
├── core/
│ └── browser.py # Browser/context lifecycle management
├── pages/
│ ├── base_page.py # Base POM class: interactions, assertions, utils
│ └── login_page.py # Example page object
├── tests/
│ ├── conftest.py # Fixtures: page, context, authenticated_page
│ └── test_login.py # Example test class
├── utils/
│ └── helpers.py # Retry logic, test data loader, name sanitizer
├── reports/ # Generated at runtime (gitignored)
├── pytest.ini # Test discovery, markers, Allure config
└── requirements.txt
All browser and context management is handled in conftest.py. Page objects
receive a Page object and do not interact with Playwright internals directly.
Test failures automatically attach screenshots and trace files to the Allure
report.
- Python 3.10+
- pip
git clone https://github.com/ac0z/playwright-e2e-framework
cd playwright-e2e-framework
pip install -r requirements.txt
playwright install --with-deps chromiumConfigure your target environment:
export BASE_URL=https://your-app.example.com
export TEST_USERNAME=testuser@example.com
export TEST_PASSWORD=yourpassword# Smoke tests only
pytest -m smoke
# Full regression, 4 workers
pytest -m "not flaky" -n 4
# Specific browser
BROWSER=firefox pytest -m regression
# Headed mode for local debugging
HEADLESS=false pytest tests/test_login.py -vAllure results are written to reports/allure-results/ by default.
# Serve the report locally (requires allure CLI)
allure serve reports/allure-resultsIn CI, the report is automatically published to GitHub Pages on merge to main.
| Trigger | Job | Browsers |
|---|---|---|
| Pull request | Smoke tests | Chromium |
| Push to main/develop | Regression | Chromium, Firefox, WebKit |
| Nightly (02:00 UTC) | Full regression | Chromium, Firefox, WebKit |
Failed runs upload screenshots and Playwright trace files as artifacts.
- Create
pages/your_page.pyextendingBasePage - Define locators as
@propertymethods - Define action methods using
self.click(),self.fill(), etc. - Add
@allure.step()decorators to action methods - Write tests in
tests/test_your_feature.py
MIT