# farhaanshareef/playwrightautomationframework architecture

> Architecture diagram of the GitHub repository farhaanshareef/playwrightautomationframework, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/farhaanshareef/playwrightautomationframework
- Repository: https://github.com/farhaanshareef/playwrightautomationframework

## Overview

##### Project Type and Purpose
- This is an **open-source Python-based web-automation framework** using Playwright and pytest.
- It’s designed for **end-to-end testing**, offering cross-browser support, parallel execution, and HTML reporting.

##### Main Components and Their Roles
a. **Test Runner (pytest)**
- Entry point: `pytest` CLI
- Orchestrates test discovery (in `test/`) and execution.
b. **Test Suites (`test/*.py`)**
- Individual test files (e.g., `test_form_submission.py`) using fixtures from `conftest.py`.
c. **Page Object Layer (`pageObject/`)**
- Implements the Page Object Model (`base_page.py`, `form_page.py`)
- Encapsulates page interactions via Playwright API.
d. **Configuration Module (`config/config.py`)**
- Holds environment settings, timeouts, URLs, browser flags.
e. **Utilities (`utils/logger.py`)**
- Centralized logging for debug info, writing to `logs/`.
f. **Playwright Engine & Browsers**
- External dependency managing Chromium, Firefox, WebKit.
- Configured via `playwright-config/playwright_config.json.py`.
g. **Reporting Module**
- pytest-html plugin generates `reports/report.html`.
- Static assets in `reports/assets/` and `assets/style.css`.
h. **Artifacts**
- `logs/` for runtime logs
- `reports/` for HTML reports & screenshots

##### Relationships and Data Flow
1. **pytest** launches → 2. **Test Suites**
2. **Test Suites** call → **Page Objects**
3. **Page Objects** use → **Playwright Engine** (via Python API)
4. **Playwright Engine** drives → **Browser Instances** → interacts with → **Web App Under Test**
5. Throughout execution, **Utilities** capture logs → write to `/logs`
6. On completion/failure, pytest-html plugin assembles → **HTML Report** in `/reports`
7. **Configuration Module** feeds parameters into Test Runner & Page Objects

##### Architectural Patterns and Design Principles
- **Page Object Model**: decouples test logic from UI specifics.
- **Modular Structure**: clearly separated layers—tests, page objects, config, utils.
- **Plugin-Based Reporting**: leverages pytest hooks for extensibility.
- **Parallel Execution**: concurrency handled by pytest-xdist or Playwright’s built-in parallelism.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Automation Framework"
        direction TB
        Runner["pytest CLI"]:::internal
        Tests["Test Suites"]:::internal
        Fixtures["conftest.py"]:::internal
        subgraph "Page Object Layer"
            direction TB
            BasePage["base_page.py"]:::internal
            FormPage["form_page.py"]:::internal
        end
        Config["config.py"]:::internal
        Logger["logger.py"]:::internal
    end

    subgraph "External Dependencies"
        direction TB
        PWEngine["Playwright Engine"]:::external
        Browsers["Browser Instances"]:::external
        App["Web App Under Test"]:::external
    end

    subgraph "Artifacts"
        direction TB
        Logs["logs/"]:::artifact
        Reports["reports/"]:::artifact
    end

    Runner -->|"discovers & runs"| Tests
    Runner -->|"reads config"| Config
    Runner -->|"uses fixtures"| Fixtures
    Tests -->|"calls"| BasePage
    Tests -->|"calls"| FormPage
    Fixtures -->|"reads config"| Config
    BasePage -->|"uses Playwright API"| PWEngine
    FormPage -->|"uses Playwright API"| PWEngine
    PWEngine -->|"drives"| Browsers
    Browsers -->|"interacts with"| App
    Logger -.->|"writes logs"| Logs
    Runner -->|"generates report"| Reports
    PWEngine -->|"reads config"| Config

    click Tests "https://github.com/farhaanshareef/playwrightautomationframework/blob/main/test/test_form_submission.py"
    click Fixtures "https://github.com/farhaanshareef/playwrightautomationframework/blob/main/test/conftest.py"
    click BasePage "https://github.com/farhaanshareef/playwrightautomationframework/blob/main/pageObject/base_page.py"
    click FormPage "https://github.com/farhaanshareef/playwrightautomationframework/blob/main/pageObject/form_page.py"
    click Config "https://github.com/farhaanshareef/playwrightautomationframework/blob/main/config/config.py"
    click Logger "https://github.com/farhaanshareef/playwrightautomationframework/blob/main/utils/logger.py"
    click PWEngine "https://github.com/farhaanshareef/playwrightautomationframework/blob/main/playwright-config/playwright_config.json.py"
    click Reports "https://github.com/farhaanshareef/playwrightautomationframework/tree/main/reports/"
    click Logs "https://github.com/farhaanshareef/playwrightautomationframework/tree/main/logs/"

    classDef internal fill:#D6EAF8,stroke:#1B4F72,color:#1B2631;
    classDef external fill:#D5F5E3,stroke:#196F3D,color:#0B5345;
    classDef artifact fill:#FCF3CF,stroke:#B7950B,color:#7D6608;
```
