Skip to content

About

Scalable Playwright Automation Framework using Python, Playwright, Pytest and Page Object Model.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Playwright Python Automation Framework

Pipeline Python Playwright Pytest

Production-style UI automation framework built with Playwright + Python + pytest.

Quick Start

python -m venv .venv
.venv\Scripts\activate          # Windows
pip install -r requirements.txt
playwright install --with-deps
pytest -m smoke                 # run smoke tests

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                         CI/CD Pipeline                          │
│              lint ──▶ resolve-config ──▶ test                   │
└─────────────────────────────────────────────────────────────────┘
                              │
┌─────────────────────────────────────────────────────────────────┐
│                    Configuration Layer                          │
│         config.yaml ◀── .env ◀── --env CLI flag                │
└─────────────────────────────────────────────────────────────────┘
                              │
┌─────────────────────────────────────────────────────────────────┐
│                      Page Object Model                          │
│                                                                 │
│   BasePage ──┬── Login      (OTP/2FA handling)                  │
│              ├── Home       (navigation, CTAs)                  │
│              ├── Signup     (registration form)                 │
│              └── Products   (listing, categories)               │
└─────────────────────────────────────────────────────────────────┘
                              │
┌─────────────────────────────────────────────────────────────────┐
│                        Test Suites                              │
│                                                                 │
│   test_homepage.py      5 tests   P1/P2/P3 validation          │
│   test_navigation.py    5 tests   routing & back/forward        │
│   test_products.py      4 tests   page content verification     │
│   test_signup.py        4 tests   form elements & validation    │
│   test_login.py         4 tests   data-driven Zoho login        │
└─────────────────────────────────────────────────────────────────┘
                              │
┌─────────────────────────────────────────────────────────────────┐
│                        Reporting                                │
│        Allure │ HTML │ JUnit XML │ Screenshots │ Traces         │
└─────────────────────────────────────────────────────────────────┘

Key Features

Feature Implementation
Page Object Model BasePage with logged wrappers; one page object per flow
Multi-env config YAML + dotenv + --env flag (case-insensitive)
Data-driven tests Excel sheets + @excel_data marker + pytest_generate_tests
Parallel execution pytest-xdist with per-worker browser profiles
OTP/2FA handling Persistent browser profiles + device trust bypass
Auto failure artifacts Screenshot + video + trace attached via pytest_runtest_makereport
CI/CD 3-job GitHub Actions pipeline with caching & artifact upload

Running Tests

# by priority
pytest -m smoke                # quick sanity (P1 tests)
pytest -m regression           # full suite

# by feature
pytest -m homepage
pytest -m navigation
pytest -m products
pytest -m signup
pytest -m login

# parallel + retry
pytest -n auto --reruns 1

# full reporting
pytest --alluredir=reports/allure-results \
       --html=reports/html-report/index.html --self-contained-html \
       --junitxml=reports/junit/results.xml

Test Suites

Suite Marker Tests Coverage
Homepage homepage 5 Title, heading, CTA, featured apps, footer
Navigation navigation 5 CRM, Mail, Products, Signup, back/forward
Products products 4 Title, heading, Zoho One, Mobile Apps
Signup signup 4 Title, form loads, sign-in link, validation
Login login 4 Data-driven Zoho sign-in flow

CI/CD Pipeline

Three-job pipeline in .github/workflows/playwright.yml:

Job Purpose Timeout
lint Ruff check + format 10 min
resolve-config Resolve env/browser/marker from trigger 5 min
test Run pytest + upload 7 artifact categories 45 min

Triggers: push (smoke), pull_request (smoke), workflow_dispatch (manual)

Artifacts: HTML report, Allure results, JUnit XML, screenshots, videos, traces, logs — retained 30 days.

Project Structure

config/           # YAML config + loader with .env overrides
pages/            # Page Object Model (BasePage + 4 page objects)
tests/            # Test files + data-driven parametrization
utils/            # Logger, Excel reader, CI detection
test_data/        # Excel test data
.github/          # CI/CD pipeline

Extending

  • New page: Subclass BasePage, add fixture in conftest.py
  • New test: Add marker to pyproject.toml, tag test with @pytest.mark.<name>
  • New environment: Add block in config.yaml, run with --env=<name>
  • New data-driven test: Add Excel sheet, mark with @pytest.mark.excel_data("Sheet", "col1", ...)

Resources

About

Scalable Playwright Automation Framework using Python, Playwright, Pytest and Page Object Model.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages