# tahanima/playwright-python-test-automation-boilerplate architecture

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

- Interactive diagram: https://gitdiagram.com/tahanima/playwright-python-test-automation-boilerplate
- Repository: https://github.com/tahanima/playwright-python-test-automation-boilerplate

## Overview

##### Project type and purpose
- This is a Test Automation Boilerplate built in Python, leveraging Playwright for browser automation and Pytest as the test runner. It implements a Page Object Model (POM) pattern and a data‐driven approach to UI testing.

##### File structure
Top‐level directories and their roles:
- data/
– Holds Python modules that model test data as classes or structures (base_data.py, login_data.py).
- helper/
– Contains utility and manager classes: browser_manager (handles Playwright browser lifecycle), configuration_manager (loads config.properties), csv_parser (reads CSV test files), and misc utils.
- pages/
– Implements the POM: base_page (common page methods), login_page, products_page.
- resources/
– Static assets: config.properties and test_data (CSV files).
- tests/
– Pytest test cases (login_test.py) which drive the POM classes using test data.

##### README
- Confirms use of Python 3.10, Playwright, and Pytest.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Test Runner
    TR["Pytest CLI\n(Test Runner)"]:::code
    %% Test Layer
    subgraph "Test Layer"
        TC["Test Cases\n(tests/login_test.py)"]:::code
    end

    %% Page Layer
    subgraph "Page Layer"
        PP_base["Base Page\n(pages/base_page.py)"]:::code
        PP_login["Login Page\n(pages/login_page.py)"]:::code
        PP_products["Products Page\n(pages/products_page.py)"]:::code
    end

    %% Utility Layer
    subgraph "Utility Layer"
        BM["Browser Manager\n(helper/browser_manager.py)"]:::code
        CM["Configuration Manager\n(helper/configuration_manager.py)"]:::code
        CSVP["CSV Parser\n(helper/csv_parser.py)"]:::code
        UTILS["Misc Utilities\n(helper/utils.py)"]:::code
    end

    %% Data Layer
    subgraph "Data Layer"
        BD["Base Data Model\n(data/base_data.py)"]:::code
        LD["Login Data Model\n(data/login_data.py)"]:::code
    end

    %% Resources
    subgraph "Resources"
        RES_CFG["config.properties\n(resources/config.properties)"]:::resources
        RES_CSV["login.csv\n(resources/test_data/login.csv)"]:::resources
    end

    %% External Systems
    PL["Playwright Engine"]:::external
    BROWSER["Browser Instance"]:::external
    AUT["Application Under Test (AUT)"]:::external

    %% Connections - Control Flow
    TR --> TC
    TC --> PP_login
    TC --> PP_products
    TC --> CM
    TC --> BM
    TC --> CSVP
    TC --> LD
    PP_login --> BM
    PP_products --> BM
    CM -->|"loads"| RES_CFG
    CSVP -->|"reads"| RES_CSV
    BM --> PL
    PL --> BROWSER
    BROWSER --> AUT

    %% Connections - Data Flow (dashed)
    CSVP --- BD
    CSVP --- LD
    CM --- RES_CFG
    TC --- LD

    %% Inheritance
    PP_base --> PP_login
    PP_base --> PP_products

    %% Click Events
    click TC "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/tests/login_test.py"
    click PP_base "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/pages/base_page.py"
    click PP_login "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/pages/login_page.py"
    click PP_products "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/pages/products_page.py"
    click BM "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/helper/browser_manager.py"
    click CM "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/helper/configuration_manager.py"
    click CSVP "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/helper/csv_parser.py"
    click UTILS "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/helper/utils.py"
    click BD "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/data/base_data.py"
    click LD "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/data/login_data.py"
    click RES_CFG "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/resources/config.properties"
    click RES_CSV "https://github.com/tahanima/playwright-python-test-automation-boilerplate/blob/main/resources/test_data/login.csv"

    %% Styles
    classDef code fill:#AED6F1,stroke:#1F618D,color:#1B2631;
    classDef resources fill:#ABEBC6,stroke:#1D8348,color:#145A32;
    classDef external fill:#F5B041,stroke:#B9770E,color:#7E5109;
```
