Repository files navigation

Playwright Python Test Automation - The Heroku App The Internet. Login Demo

A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.

📋 Project Overview

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.

The approach used was the AI-Assisted Development, This framework was engineered using an AI-assisted workflow which I leveraged to accelerate development while maintaining full ownership of architecture, implementation, and validation. AI was used to speed up development, but all design decisions, debugging, and test validation were driven and verified by me through real execution — ensuring a stable, production-style automation framework.

📁 Project Structure

.
├── 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

✨ Key Features

  • 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

📊 Test Coverage

Total Tests: 1 (All Passing ✅)

Test Suites[DEMO]:

  1. """Test suite for the Login Page of The Internet.""" (1 tests)
    • Login into Secure Area with valid credentials

🛠️ Tech Stack

  • 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.

🚀 Quick Start

1. Prerequisites

  • Python 3.8 or higher
  • Git

2. Setup

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 install

3. Run Tests

Run all tests with parallel execution:

pytest

Run tests for a specific module:

pytest tests/test_feature_login.py -v

Run tests with specific browser:

pytest --browser chromium
pytest --browser firefox
pytest --browser webkit

Run a single test:

pytest tests/test_feature_login.py::test_login_page_object -v

Run in headed mode (see browser):

pytest --headed

📋 Test Configuration

The 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

📖 Page Object Model

LoginPage

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.

📈 Execution Details

Local Testing

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

Continuous Integration

The GitHub Actions workflow runs:

  • Headless mode
  • Optimized for CI/CD
  • Parallel execution
  • HTML reports as artifacts

📊 HTML Reports

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

🔍 Best Practices Implemented

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

🐛 Troubleshooting

Playwright Not Found

playwright install

Permission Denied on .venv

chmod +x .venv/bin/activate

Tests Failing with Timeout

  • Increase wait time in code (if needed)
  • Check network connectivity
  • Verify target website is accessible

Report Not Generated

  • Check report/ directory exists
  • Verify pytest-html is installed: pip install pytest-html

📝 Test Examples

Running Specific Test Classes

# 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

Debugging Tests

# 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 -s

🔐 Fixtures

The conftest.py provides:

  • browser: Session-scoped Chromium browser instance
  • page: Function-scoped page for each test
  • Screenshot hooks: Automatic full-page screenshots on test completion
  • HTML report enhancements: Custom styling and formatting

📦 Dependencies Management

Update dependencies:

pip install -r requirements.txt --upgrade

Check for outdated packages:

pip list --outdated

🔄 CI/CD Integration

The 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

📚 Resources

📝 License

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+

About

A comprehensive test automation project using Playwright with Python and Pytest.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

Playwright Python Test Automation - The Heroku App The Internet. Login Demo

A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.

📋 Project Overview

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.

The approach used was the AI-Assisted Development, This framework was engineered using an AI-assisted workflow which I leveraged to accelerate development while maintaining full ownership of architecture, implementation, and validation. AI was used to speed up development, but all design decisions, debugging, and test validation were driven and verified by me through real execution — ensuring a stable, production-style automation framework.

📁 Project Structure

.
├── 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

✨ Key Features

  • 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

📊 Test Coverage

Total Tests: 1 (All Passing ✅)

Test Suites[DEMO]:

  1. """Test suite for the Login Page of The Internet.""" (1 tests)
    • Login into Secure Area with valid credentials

🛠️ Tech Stack

  • 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.

🚀 Quick Start

1. Prerequisites

  • Python 3.8 or higher
  • Git

2. Setup

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 install

3. Run Tests

Run all tests with parallel execution:

pytest

Run tests for a specific module:

pytest tests/test_feature_login.py -v

Run tests with specific browser:

pytest --browser chromium
pytest --browser firefox
pytest --browser webkit

Run a single test:

pytest tests/test_feature_login.py::test_login_page_object -v

Run in headed mode (see browser):

pytest --headed

📋 Test Configuration

The 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

📖 Page Object Model

LoginPage

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.

📈 Execution Details

Local Testing

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

Continuous Integration

The GitHub Actions workflow runs:

  • Headless mode
  • Optimized for CI/CD
  • Parallel execution
  • HTML reports as artifacts

📊 HTML Reports

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

🔍 Best Practices Implemented

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

🐛 Troubleshooting

Playwright Not Found

playwright install

Permission Denied on .venv

chmod +x .venv/bin/activate

Tests Failing with Timeout

  • Increase wait time in code (if needed)
  • Check network connectivity
  • Verify target website is accessible

Report Not Generated

  • Check report/ directory exists
  • Verify pytest-html is installed: pip install pytest-html

📝 Test Examples

Running Specific Test Classes

# 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

Debugging Tests

# 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 -s

🔐 Fixtures

The conftest.py provides:

  • browser: Session-scoped Chromium browser instance
  • page: Function-scoped page for each test
  • Screenshot hooks: Automatic full-page screenshots on test completion
  • HTML report enhancements: Custom styling and formatting

📦 Dependencies Management

Update dependencies:

pip install -r requirements.txt --upgrade

Check for outdated packages:

pip list --outdated

🔄 CI/CD Integration

The 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

📚 Resources

📝 License

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+

About

A comprehensive test automation project using Playwright with Python and Pytest.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Playwright Python Test Automation - The Heroku App The Internet. Login Demo

A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.

📋 Project Overview

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.

The approach used was the AI-Assisted Development, This framework was engineered using an AI-assisted workflow which I leveraged to accelerate development while maintaining full ownership of architecture, implementation, and validation. AI was used to speed up development, but all design decisions, debugging, and test validation were driven and verified by me through real execution — ensuring a stable, production-style automation framework.

📁 Project Structure

.
├── 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

✨ Key Features

  • 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

📊 Test Coverage

Total Tests: 1 (All Passing ✅)

Test Suites[DEMO]:

  1. """Test suite for the Login Page of The Internet.""" (1 tests)
    • Login into Secure Area with valid credentials

🛠️ Tech Stack

  • 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.

🚀 Quick Start

1. Prerequisites

  • Python 3.8 or higher
  • Git

2. Setup

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 install

3. Run Tests

Run all tests with parallel execution:

pytest

Run tests for a specific module:

pytest tests/test_feature_login.py -v

Run tests with specific browser:

pytest --browser chromium
pytest --browser firefox
pytest --browser webkit

Run a single test:

pytest tests/test_feature_login.py::test_login_page_object -v

Run in headed mode (see browser):

pytest --headed

📋 Test Configuration

The 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

📖 Page Object Model

LoginPage

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.

📈 Execution Details

Local Testing

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

Continuous Integration

The GitHub Actions workflow runs:

  • Headless mode
  • Optimized for CI/CD
  • Parallel execution
  • HTML reports as artifacts

📊 HTML Reports

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

🔍 Best Practices Implemented

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

🐛 Troubleshooting

Playwright Not Found

playwright install

Permission Denied on .venv

chmod +x .venv/bin/activate

Tests Failing with Timeout

  • Increase wait time in code (if needed)
  • Check network connectivity
  • Verify target website is accessible

Report Not Generated

  • Check report/ directory exists
  • Verify pytest-html is installed: pip install pytest-html

📝 Test Examples

Running Specific Test Classes

# 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

Debugging Tests

# 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 -s

🔐 Fixtures

The conftest.py provides:

  • browser: Session-scoped Chromium browser instance
  • page: Function-scoped page for each test
  • Screenshot hooks: Automatic full-page screenshots on test completion
  • HTML report enhancements: Custom styling and formatting

📦 Dependencies Management

Update dependencies:

pip install -r requirements.txt --upgrade

Check for outdated packages:

pip list --outdated

🔄 CI/CD Integration

The 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

📚 Resources

📝 License

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+

About

A comprehensive test automation project using Playwright with Python and Pytest.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Playwright Python Test Automation - The Heroku App The Internet. Login Demo

A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.

📋 Project Overview

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.

The approach used was the AI-Assisted Development, This framework was engineered using an AI-assisted workflow which I leveraged to accelerate development while maintaining full ownership of architecture, implementation, and validation. AI was used to speed up development, but all design decisions, debugging, and test validation were driven and verified by me through real execution — ensuring a stable, production-style automation framework.

📁 Project Structure

.
├── 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

✨ Key Features

  • 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

📊 Test Coverage

Total Tests: 1 (All Passing ✅)

Test Suites[DEMO]:

  1. """Test suite for the Login Page of The Internet.""" (1 tests)
    • Login into Secure Area with valid credentials

🛠️ Tech Stack

  • 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.

🚀 Quick Start

1. Prerequisites

  • Python 3.8 or higher
  • Git

2. Setup

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 install

3. Run Tests

Run all tests with parallel execution:

pytest

Run tests for a specific module:

pytest tests/test_feature_login.py -v

Run tests with specific browser:

pytest --browser chromium
pytest --browser firefox
pytest --browser webkit

Run a single test:

pytest tests/test_feature_login.py::test_login_page_object -v

Run in headed mode (see browser):

pytest --headed

📋 Test Configuration

The 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

📖 Page Object Model

LoginPage

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.

📈 Execution Details

Local Testing

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

Continuous Integration

The GitHub Actions workflow runs:

  • Headless mode
  • Optimized for CI/CD
  • Parallel execution
  • HTML reports as artifacts

📊 HTML Reports

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

🔍 Best Practices Implemented

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

🐛 Troubleshooting

Playwright Not Found

playwright install

Permission Denied on .venv

chmod +x .venv/bin/activate

Tests Failing with Timeout

  • Increase wait time in code (if needed)
  • Check network connectivity
  • Verify target website is accessible

Report Not Generated

  • Check report/ directory exists
  • Verify pytest-html is installed: pip install pytest-html

📝 Test Examples

Running Specific Test Classes

# 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

Debugging Tests

# 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 -s

🔐 Fixtures

The conftest.py provides:

  • browser: Session-scoped Chromium browser instance
  • page: Function-scoped page for each test
  • Screenshot hooks: Automatic full-page screenshots on test completion
  • HTML report enhancements: Custom styling and formatting

📦 Dependencies Management

Update dependencies:

pip install -r requirements.txt --upgrade

Check for outdated packages:

pip list --outdated

🔄 CI/CD Integration

The 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

📚 Resources

📝 License

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+

About

A comprehensive test automation project using Playwright with Python and Pytest.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

Playwright Python Test Automation - The Heroku App The Internet. Login Demo

A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.

📋 Project Overview

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.

The approach used was the AI-Assisted Development, This framework was engineered using an AI-assisted workflow which I leveraged to accelerate development while maintaining full ownership of architecture, implementation, and validation. AI was used to speed up development, but all design decisions, debugging, and test validation were driven and verified by me through real execution — ensuring a stable, production-style automation framework.

📁 Project Structure

.
├── 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

✨ Key Features

  • 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

📊 Test Coverage

Total Tests: 1 (All Passing ✅)

Test Suites[DEMO]:

  1. """Test suite for the Login Page of The Internet.""" (1 tests)
    • Login into Secure Area with valid credentials

🛠️ Tech Stack

  • 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.

🚀 Quick Start

1. Prerequisites

  • Python 3.8 or higher
  • Git

2. Setup

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 install

3. Run Tests

Run all tests with parallel execution:

pytest

Run tests for a specific module:

pytest tests/test_feature_login.py -v

Run tests with specific browser:

pytest --browser chromium
pytest --browser firefox
pytest --browser webkit

Run a single test:

pytest tests/test_feature_login.py::test_login_page_object -v

Run in headed mode (see browser):

pytest --headed

📋 Test Configuration

The 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

📖 Page Object Model

LoginPage

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.

📈 Execution Details

Local Testing

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

Continuous Integration

The GitHub Actions workflow runs:

  • Headless mode
  • Optimized for CI/CD
  • Parallel execution
  • HTML reports as artifacts

📊 HTML Reports

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

🔍 Best Practices Implemented

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

🐛 Troubleshooting

Playwright Not Found

playwright install

Permission Denied on .venv

chmod +x .venv/bin/activate

Tests Failing with Timeout

  • Increase wait time in code (if needed)
  • Check network connectivity
  • Verify target website is accessible

Report Not Generated

  • Check report/ directory exists
  • Verify pytest-html is installed: pip install pytest-html

📝 Test Examples

Running Specific Test Classes

# 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

Debugging Tests

# 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 -s

🔐 Fixtures

The conftest.py provides:

  • browser: Session-scoped Chromium browser instance
  • page: Function-scoped page for each test
  • Screenshot hooks: Automatic full-page screenshots on test completion
  • HTML report enhancements: Custom styling and formatting

📦 Dependencies Management

Update dependencies:

pip install -r requirements.txt --upgrade

Check for outdated packages:

pip list --outdated

🔄 CI/CD Integration

The 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

📚 Resources

📝 License

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+

About

A comprehensive test automation project using Playwright with Python and Pytest.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Playwright Python Test Automation - The Heroku App The Internet. Login Demo

A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.

📋 Project Overview

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.

The approach used was the AI-Assisted Development, This framework was engineered using an AI-assisted workflow which I leveraged to accelerate development while maintaining full ownership of architecture, implementation, and validation. AI was used to speed up development, but all design decisions, debugging, and test validation were driven and verified by me through real execution — ensuring a stable, production-style automation framework.

📁 Project Structure

.
├── 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

✨ Key Features

  • 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

📊 Test Coverage

Total Tests: 1 (All Passing ✅)

Test Suites[DEMO]:

  1. """Test suite for the Login Page of The Internet.""" (1 tests)
    • Login into Secure Area with valid credentials

🛠️ Tech Stack

  • 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.

🚀 Quick Start

1. Prerequisites

  • Python 3.8 or higher
  • Git

2. Setup

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 install

3. Run Tests

Run all tests with parallel execution:

pytest

Run tests for a specific module:

pytest tests/test_feature_login.py -v

Run tests with specific browser:

pytest --browser chromium
pytest --browser firefox
pytest --browser webkit

Run a single test:

pytest tests/test_feature_login.py::test_login_page_object -v

Run in headed mode (see browser):

pytest --headed

📋 Test Configuration

The 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

📖 Page Object Model

LoginPage

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.

📈 Execution Details

Local Testing

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

Continuous Integration

The GitHub Actions workflow runs:

  • Headless mode
  • Optimized for CI/CD
  • Parallel execution
  • HTML reports as artifacts

📊 HTML Reports

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

🔍 Best Practices Implemented

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

🐛 Troubleshooting

Playwright Not Found

playwright install

Permission Denied on .venv

chmod +x .venv/bin/activate

Tests Failing with Timeout

  • Increase wait time in code (if needed)
  • Check network connectivity
  • Verify target website is accessible

Report Not Generated

  • Check report/ directory exists
  • Verify pytest-html is installed: pip install pytest-html

📝 Test Examples

Running Specific Test Classes

# 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

Debugging Tests

# 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 -s

🔐 Fixtures

The conftest.py provides:

  • browser: Session-scoped Chromium browser instance
  • page: Function-scoped page for each test
  • Screenshot hooks: Automatic full-page screenshots on test completion
  • HTML report enhancements: Custom styling and formatting

📦 Dependencies Management

Update dependencies:

pip install -r requirements.txt --upgrade

Check for outdated packages:

pip list --outdated

🔄 CI/CD Integration

The 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

📚 Resources

📝 License

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+

About

A comprehensive test automation project using Playwright with Python and Pytest.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Playwright Python Test Automation - The Heroku App The Internet. Login Demo

A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.

📋 Project Overview

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.

The approach used was the AI-Assisted Development, This framework was engineered using an AI-assisted workflow which I leveraged to accelerate development while maintaining full ownership of architecture, implementation, and validation. AI was used to speed up development, but all design decisions, debugging, and test validation were driven and verified by me through real execution — ensuring a stable, production-style automation framework.

📁 Project Structure

.
├── 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

✨ Key Features

  • 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

📊 Test Coverage

Total Tests: 1 (All Passing ✅)

Test Suites[DEMO]:

  1. """Test suite for the Login Page of The Internet.""" (1 tests)
    • Login into Secure Area with valid credentials

🛠️ Tech Stack

  • 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.

🚀 Quick Start

1. Prerequisites

  • Python 3.8 or higher
  • Git

2. Setup

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 install

3. Run Tests

Run all tests with parallel execution:

pytest

Run tests for a specific module:

pytest tests/test_feature_login.py -v

Run tests with specific browser:

pytest --browser chromium
pytest --browser firefox
pytest --browser webkit

Run a single test:

pytest tests/test_feature_login.py::test_login_page_object -v

Run in headed mode (see browser):

pytest --headed

📋 Test Configuration

The 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

📖 Page Object Model

LoginPage

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.

📈 Execution Details

Local Testing

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

Continuous Integration

The GitHub Actions workflow runs:

  • Headless mode
  • Optimized for CI/CD
  • Parallel execution
  • HTML reports as artifacts

📊 HTML Reports

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

🔍 Best Practices Implemented

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

🐛 Troubleshooting

Playwright Not Found

playwright install

Permission Denied on .venv

chmod +x .venv/bin/activate

Tests Failing with Timeout

  • Increase wait time in code (if needed)
  • Check network connectivity
  • Verify target website is accessible

Report Not Generated

  • Check report/ directory exists
  • Verify pytest-html is installed: pip install pytest-html

📝 Test Examples

Running Specific Test Classes

# 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

Debugging Tests

# 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 -s

🔐 Fixtures

The conftest.py provides:

  • browser: Session-scoped Chromium browser instance
  • page: Function-scoped page for each test
  • Screenshot hooks: Automatic full-page screenshots on test completion
  • HTML report enhancements: Custom styling and formatting

📦 Dependencies Management

Update dependencies:

pip install -r requirements.txt --upgrade

Check for outdated packages:

pip list --outdated

🔄 CI/CD Integration

The 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

📚 Resources

📝 License

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+

About

A comprehensive test automation project using Playwright with Python and Pytest.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

Playwright Python Test Automation - The Heroku App The Internet. Login Demo

A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.

📋 Project Overview

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.

The approach used was the AI-Assisted Development, This framework was engineered using an AI-assisted workflow which I leveraged to accelerate development while maintaining full ownership of architecture, implementation, and validation. AI was used to speed up development, but all design decisions, debugging, and test validation were driven and verified by me through real execution — ensuring a stable, production-style automation framework.

📁 Project Structure

.
├── 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

✨ Key Features

  • 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

📊 Test Coverage

Total Tests: 1 (All Passing ✅)

Test Suites[DEMO]:

  1. """Test suite for the Login Page of The Internet.""" (1 tests)
    • Login into Secure Area with valid credentials

🛠️ Tech Stack

  • 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.

🚀 Quick Start

1. Prerequisites

  • Python 3.8 or higher
  • Git

2. Setup

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 install

3. Run Tests

Run all tests with parallel execution:

pytest

Run tests for a specific module:

pytest tests/test_feature_login.py -v

Run tests with specific browser:

pytest --browser chromium
pytest --browser firefox
pytest --browser webkit

Run a single test:

pytest tests/test_feature_login.py::test_login_page_object -v

Run in headed mode (see browser):

pytest --headed

📋 Test Configuration

The 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

📖 Page Object Model

LoginPage

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.

📈 Execution Details

Local Testing

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

Continuous Integration

The GitHub Actions workflow runs:

  • Headless mode
  • Optimized for CI/CD
  • Parallel execution
  • HTML reports as artifacts

📊 HTML Reports

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

🔍 Best Practices Implemented

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

🐛 Troubleshooting

Playwright Not Found

playwright install

Permission Denied on .venv

chmod +x .venv/bin/activate

Tests Failing with Timeout

  • Increase wait time in code (if needed)
  • Check network connectivity
  • Verify target website is accessible

Report Not Generated

  • Check report/ directory exists
  • Verify pytest-html is installed: pip install pytest-html

📝 Test Examples

Running Specific Test Classes

# 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

Debugging Tests

# 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 -s

🔐 Fixtures

The conftest.py provides:

  • browser: Session-scoped Chromium browser instance
  • page: Function-scoped page for each test
  • Screenshot hooks: Automatic full-page screenshots on test completion
  • HTML report enhancements: Custom styling and formatting

📦 Dependencies Management

Update dependencies:

pip install -r requirements.txt --upgrade

Check for outdated packages:

pip list --outdated

🔄 CI/CD Integration

The 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

📚 Resources

📝 License

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+

About

A comprehensive test automation project using Playwright with Python and Pytest.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages