Skip to content

talha10/playwright-python-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playwright Python Automation Framework

Python Playwright pytest GitHub Actions

📌 Project Overview

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.

🏗️ Folder Structure

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

🚀 Tech Stack

  • Language: Python 3.11+
  • Browser Automation: Playwright for Python
  • Test Runner: pytest
  • Reporting: pytest-html
  • Configuration: python-dotenv
  • CI/CD: GitHub Actions

⚙️ Local Setup & Installation

  1. Clone the repository:

    git clone https://github.com/talha10/playwright-python-automation.git
    cd playwright-python-automation
  2. Create and activate a virtual environment (recommended):

    python -m venv venv
    source venv/Scripts/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Install Playwright browsers:

    playwright install chromium

🧪 Running Locally

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

🤖 Continuous Integration

This repository is configured with GitHub Actions. On every push to main or upon pull request creation, the CI pipeline automatically:

  1. Sets up Python 3.11
  2. Installs requirements and Playwright binaries
  3. Executes the full test suite in headless mode
  4. Uploads the generated standard pytest-html report as a build artifact.

See .github/workflows/playwright-tests.yml for exact configurations.


👤 Author

Talha Khan | Senior Software Quality Assurance Engineer
LinkedIn | Engineered for highly reliable, parallelized E2E test automation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages