This repository contains a production-ready hybrid automation framework built using Python, Playwright, and Pytest.
It demonstrates how to design and scale a real-world UI + API test framework with clean architecture, CI integration, parallel execution, and professional reporting.
- Python
- Playwright (UI automation)
- Pytest
- Requests (API automation)
- Pytest Fixtures
- Pytest-xdist (parallel execution)
- Allure Reporting
- GitHub Actions (CI)
- Page Object Model (POM)
- Clear separation of concerns between UI, API, and test logic
- Page Object Model (POM) for maintainable UI automation
- Reusable API client abstraction for scalable API testing
- API → UI integration pattern for end-to-end validation
- Centralized browser and test lifecycle management
- Environment-based configuration (no hard-coded values)
- Automatic screenshot capture on test failure
- Parallel execution for faster feedback
- CI-ready design with GitHub Actions
Playwright-pytest-framework/
├── tests/
│ ├── ui/ # UI test cases
│ └── api/ # API test cases
├── pages/ # Page Object classes
├── api/ # API framework layer (clients)
├── config/ # Environment configuration
├── screenshots/ # Screenshots captured on failures
├── allure-results/ # Allure raw test results
├── .github/workflows/ # GitHub Actions CI
├── conftest.py # Pytest fixtures and hooks
├── pytest.ini # Pytest configuration
├── requirements.txt # Dependencies
└── README.md
pip install -r requirements.txt
playwright installpytestpytest -n autoTests run against the QA environment by default.
To switch environment:
ENV=prod pytestEnvironment values are managed centrally to keep tests flexible and clean.
def test_smoke(page):
home = HomePage(page)
home.open()
assert home.get_title() == "Example Domain"def test_get_users():
users_api = UsersAPI()
response = users_api.get_users()
assert response.status_code == 200def test_user_data_via_api_and_ui(page):
users_api = UsersAPI()
user = users_api.get_users().json()[0]
home = HomePage(page)
home.open()
assert home.get_title() == "Example Domain"- Screenshots are automatically captured on UI test failures
- Screenshots are stored in the
screenshots/directory - Screenshots are also attached directly to Allure reports
pytest
allure serve allure-resultsAllure provides:
- Unified UI + API reporting
- Test history and execution details
- Failure screenshots and logs
In CI, Allure results are stored as build artifacts.
This project uses GitHub Actions to:
- Run tests on every push and pull request
- Install dependencies and Playwright browsers
- Execute tests headlessly
- Generate and archive Allure results
CI ensures fast feedback and consistent test execution.
This repository showcases:
- Enterprise-level automation framework design
- Hybrid UI + API testing strategy
- API framework abstraction and reuse
- Parallel execution and CI integration
- Maintainability over complexity
It is intended as a portfolio-quality project demonstrating real-world automation skills.
Sumit Narang
Senior QA / Automation Engineer