This repository contains an industry-standard, fully scalable automated testing framework built from scratch using Python, Playwright, and pytest. It implements the Page Object Model (POM) design pattern for optimal maintainability and readability.
The target application under test is Automation Exercise, a comprehensive e-commerce sandbox designed specifically for test automation practice.
playwright-python-automation/
├── tests/ # Business logic tests by functionality
├── pages/ # Page Object Model (POM) classes
├── utils/ # Configuration and helper functions
├── .github/workflows/ # CI/CD pipelines
├── conftest.py # Pytest fixtures and browser setup
├── pytest.ini # Pytest configuration and markers
└── requirements.txt # Project dependencies
- Language: Python 3.11+
- Browser Automation: Playwright for Python
- Test Runner: pytest
- Reporting: pytest-html
- Configuration: python-dotenv
- CI/CD: GitHub Actions
-
Clone the repository:
git clone https://github.com/talha10/playwright-python-automation.git cd playwright-python-automation -
Create and activate a virtual environment (recommended):
python -m venv venv source venv/Scripts/activate -
Install dependencies:
pip install -r requirements.txt
-
Install Playwright browsers:
playwright install chromium
By default, tests run in headless mode pointing to the production URL.
- Run all tests:
pytest
- Run a specific test file:
pytest tests/test_login.py
- Run tests in headed mode (opens browser):
set HEADLESS=false pytest - Generate HTML Report:
pytest --html=reports/report.html
This repository is configured with GitHub Actions. On every push to main or upon pull request creation, the CI pipeline automatically:
- Sets up Python 3.11
- Installs requirements and Playwright binaries
- Executes the full test suite in headless mode
- Uploads the generated standard
pytest-htmlreport as a build artifact.
See .github/workflows/playwright-tests.yml for exact configurations.
Talha Khan | Senior Software Quality Assurance Engineer
LinkedIn | Engineered for highly reliable, parallelized E2E test automation.