A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.
This project is a complete end-to-end test automation framework using Playwright's sync API with Python. It tests """Test suite for the Login Page of The Internet.""" and includes modern testing practices such as Page Object Model, parallel execution, multi-browser testing, and detailed HTML reporting with screenshots and videos.
.
├── conftest.py # Pytest fixtures and hooks for browser/page setup
├── pytest.ini # Pytest configuration (multi-browser, parallel, reporting)
├── requirements.txt # Python dependencies
├── README.md # This file
├── pages/
│ └── feature_login_page.py # Page Object Model for Login
├── tests/
│ ├── __pycache__/
│ └── test_feature_login.py # """Test suite for the Login Page of The Internet."""
├── utils/
| |___ highlight.py # Utility functions (All Expected Validations In Highlight)
├── report/
│ └── index.html # Generated HTML test report
├── .github/workflows/
│ ├── generate_tests.prompt.md # Test generation guidelines
│ └── playwright.yml # GitHub Actions CI/CD pipeline
└── .gitignore # Git ignore rules
- Multi-Browser Testing: Runs tests on Chromium, Firefox, and WebKit
- Parallel Execution: Uses pytest-xdist for auto-detected parallel test runs
- Page Object Model: Clean separation of locators and test logic
- Comprehensive Reporting: Self-contained HTML reports with full-page screenshots
- Visual Debugging: Slow motion (200ms), video on failure, and trace recording
- CI/CD Ready: GitHub Actions workflow configured and ready to deploy
- Auto-Retrying: Built-in Playwright waits with no manual timeouts
- Avoid-Flakiness: pytest-rerunfailures to automatically retry failed tests
Total Tests: 1 (All Passing ✅)
- """Test suite for the Login Page of The Internet.""" (1 tests)
- Login into Secure Area with valid credentials
- Playwright: 1.58.0+ - Browser automation
- Python: 3.14.3
- Pytest: 8.2.2 - Test framework
- pytest-playwright: 0.7.2 - Playwright plugin
- pytest-xdist: 3.8.0 - Parallel execution
- pytest-html: 4.1.1 - HTML reporting
- pytest-base-url: 2.1.0 - Base URL configuration
- pytest-cov: 7.0.0 - Code Coverage Pytest
- coverage: 7.13.4 - Coverage reporting
- pytest-rerunfailures: 16.1 - Avoid Flakiness
See requirements.txt for the complete dependency list.
- Python 3.8 or higher
- Git
Clone and setup the project:
# Clone the repository
git clone <repository-url>
cd PlaywrightPython
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install Playwright browsers
playwright installRun all tests with parallel execution:
pytestRun tests for a specific module:
pytest tests/test_feature_login.py -vRun tests with specific browser:
pytest --browser chromium
pytest --browser firefox
pytest --browser webkitRun a single test:
pytest tests/test_feature_login.py::test_login_page_object -vRun in headed mode (see browser):
pytest --headedThe pytest.ini file configures:
- Multi-browser Testing: Chromium, Firefox, WebKit
- Parallel Execution:
-n auto(auto-detects CPU cores) - Visual Debugging:
- Slow motion: 200ms delay
- Screenshot: on failure only
- Video: on failure only
- Tracing: on failure only
- Reporting:
- Self-contained HTML report
- Full-page screenshots embedded
- Report location:
report/index.html
- Test Discovery:
- Test paths:
tests/ - Test files:
test_*.py
- Test paths:
Location: pages/feature_login_page.py
Key Features:
- Encapsulates all element locators
- Provides reusable methods for page interactions
- Separates test logic from locator management
Main Methods:
login()- Perform login action with given credentials.
pytest- Runs on all three browsers (Chromium, Firefox, WebKit)
- 8 parallel workers (auto-detected)
- Videos and screenshots on failure
- Slow motion enabled
- Full HTML report generated
The GitHub Actions workflow runs:
- Headless mode
- Optimized for CI/CD
- Parallel execution
- HTML reports as artifacts
After test execution, detailed HTML reports are generated at:
- Local:
report/index.html - CI/CD: Download from GitHub Actions artifacts
Report Includes:
- Test summary (passed/failed/skipped)
- Test execution time
- Full-page screenshots for each test
- Browser and platform information
- Test metadata
✅ Page Object Model - Clean separation of concerns
✅ No Hard Timeouts - Relies on Playwright's built-in waits
✅ Role-Based Locators - Uses accessible selectors (get_by_role)
✅ Auto-Retrying Assertions - Playwright handles automatic retries
✅ Descriptive Test Names - Clear test intent
✅ Comprehensive Documentation - Comments and docstrings
✅ Parallel Execution - Tests run efficiently
✅ Visual Debugging - Screenshots and videos for failed tests
playwright installchmod +x .venv/bin/activate- Increase wait time in code (if needed)
- Check network connectivity
- Verify target website is accessible
- Check
report/directory exists - Verify pytest-html is installed:
pip install pytest-html
# Run all tests
pytest pytest tests/test_feature_login.py -v
# Run specific tests
pytest pytest tests/test_feature_login.py::test_login_page_object -v# Run with verbose output
pytest -vv
# Run with print statements captured
pytest -s
# Run single test with detailed output
pytest pytest tests/test_feature_login.py::test_login_page_object -vv -s
# Run in debbug mode (see browser):
PWDEBUG=1 pytest -s
# Run in Browser Developer Tools debbug mode (see browser):
PWDEBUG=console pytest -sThe conftest.py provides:
browser: Session-scoped Chromium browser instancepage: Function-scoped page for each test- Screenshot hooks: Automatic full-page screenshots on test completion
- HTML report enhancements: Custom styling and formatting
Update dependencies:
pip install -r requirements.txt --upgradeCheck for outdated packages:
pip list --outdatedThe project includes a GitHub Actions workflow (playwright.yml) that:
- Runs on push to main/develop branches
- Executes tests in headless mode
- Generates and uploads HTML reports
- Supports multiple Python versions
This project is provided as-is for testing automation purposes.
Last Updated: March 13, 2026
Test Status: ✅ 1/1 Passing
Python Version: 3.14.3
Playwright Version: 1.58.0+