A robust and scalable test automation framework built with Python and Playwright for web application testing. This framework follows best practices and provides a solid foundation for implementing automated tests.
- Page Object Model implementation for better maintainability
- Configuration Management for different environments
- Comprehensive Logging system
- Screenshot Capture on test failures
- Cross-browser Testing support (Chromium, Firefox, WebKit)
- Parallel Test Execution capability
- Test Categories (Smoke, Regression, E2E)
- Detailed Test Reports
- Python 3.8 or higher
- pip (Python package installer)
- Git
- Clone the repository:
git clone <repository-url>
cd python-playwright- Create and activate a virtual environment:
# Windows
python -m venv venv
.\venv\Scripts\activate
# Linux/Mac
python3 -m venv venv
source venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Install Playwright browsers:
playwright installpytest# Run smoke tests
pytest -m smoke
# Run regression tests
pytest -m regression
# Run end-to-end tests
pytest -m e2e# Run in Firefox
BROWSER=firefox pytest
# Run in WebKit
BROWSER=webkit pytestHEADLESS=false pytestpytest -n autopython-playwright/
├── config/
│ └── config.py # Configuration settings
├── docs/
│ └── images/ # Documentation images
├── framework/
│ └── page_base/ # Base page objects
├── pages/ # Page objects
├── tests/ # Test files
│ ├── conftest.py # Test configurations
│ └── test_*.py # Test cases
├── utils/ # Utility functions
├── test-results/ # Test execution results
├── test-data/ # Test data files
├── pytest.ini # Pytest configuration
└── requirements.txt # Project dependencies
- Smoke Tests: Basic functionality tests
- Regression Tests: Comprehensive test suite
- E2E Tests: End-to-end user journey tests
The framework supports different configurations through environment variables:
BROWSER: Browser to use (chromium, firefox, webkit)HEADLESS: Run tests in headless mode (true/false)BASE_URL: Application base URL
Test reports are generated in the test-results directory:
- Screenshots of failed tests
- HTML reports (when using pytest-html)
- Log files
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Your Name - Initial work
- Playwright team for the amazing automation tool
- Python community for the excellent testing libraries
