# freeautomationlearning/playwritepom architecture

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

- Interactive diagram: https://gitdiagram.com/freeautomationlearning/playwritepom
- Repository: https://github.com/freeautomationlearning/playwritepom

## Overview

##### Main Components
- Test Runner & Configuration: Represent Maven (pom.xml) and TestNG (test suite XML files in testsuites/) as the entry point for running tests.
- Base Framework Components: Highlight the “com.freeautomationlearning.base” package that provides shared base classes and utilities for common functionality (session management, browser contexts, reporting).
- UI Module:
– UI Factories & Utilities: Show UIFactoryBase and its implementation classes, which manage browser launch, context, and overall UI operations.
– UI Page Objects: Include key page classes in “com.freeautomationlearning/ui/pages” (like HomePage, DashboardPage, ResetPassword) encapsulating user interactions.
– UI Test Scripts: Represent the tests in “src/test/java/com/freeautomationlearning/ui/testscripts” where the actual UI flows are executed.
- API Module:
– API Factories & Utilities: Display APIFactoryBase and its implementation classes for managing HTTP contexts and API calls.
– API Page Objects: Incorporate API classes in “com.freeautomationlearning/api/pages” (like LoginPage and Users) which encapsulate API endpoint interactions.
– API Test Scripts: Separate out the tests under “src/test/java/com/freeautomationlearning/api/testscripts” that drive API testing.
- Reporting & Listeners:
– Show the ExtentReportManager handling report creation and flushing.
– Include the TestListeners class that integrates with TestNG to capture events and trigger reporting.
- Utilities & Data Handling:
– Highlight the “utlis” package which houses APIConstants, Constants, UtilClass and shows how test data is read from JSON files under “src/test/resources”.

##### Establish Relationships and Interactions
- How the test scripts depend on Page Objects (using UI or API factories) and interact with utility classes for configuration and JSON test data.
- That both UI and API tests share common base classes and factories from the “base” package.
- Test Listeners to both the test execution process and the reporting component (ExtentReportManager) to illustrate logging and result aggregation.
- Dependency on external libraries such as Playwright for browser/API interactions and Extent Reports for the reporting layer.

##### Architectural Patterns
- Use of the Page Object Model (POM) which segments interactions for UI and API in dedicated classes.
- Separation of concerns: base functionalities, page interactions, and test scripts are clearly isolated which aids in maintainability.
- The use of TestNG listeners and Maven for integration and build management should be depicted.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Test Runner & Configuration"
        A1["Maven Build (pom.xml)"]:::external
        A2["TestNG Suites (APISuite.xml)"]:::external
        A3["TestNG Suites (UISuite.xml)"]:::external
    end

    subgraph "Base Framework Components"
        B1["Base Package"]:::base
        B2["Shared Utilities"]:::base
    end

    subgraph "UI Module"
        C1["UI Factories & Utilities"]:::ui
        C2["UI Page Objects"]:::ui
        C3["UI Test Scripts"]:::ui
    end

    subgraph "API Module"
        D1["API Factories & Utilities"]:::api
        D2["API Page Objects"]:::api
        D3["API Test Scripts"]:::api
    end

    subgraph "Reporting & Listeners"
        E1["Reporting Manager"]:::reporting
        E2["TestNG Listeners"]:::reporting
    end

    subgraph "Utilities & Data Handling"
        F1["Utilities Package"]:::utilities
        F2["Test Data & Locators"]:::utilities
    end

    P1["Playwright"]:::external

    %% Connections from Test Runner to Base Framework and Modules
    A1 -->|"triggers"| B1
    A1 -->|"triggers"| B2
    A2 -->|"executes"| C3
    A3 -->|"executes"| D3

    %% Base Framework used by UI and API Factories
    B1 -->|"provides base"| C1
    B1 -->|"provides base"| D1
    B2 -->|"provides utilities"| C1
    B2 -->|"provides utilities"| D1

    %% UI Module flow
    C1 -->|"initializes"| C2
    C2 -->|"drives"| C3

    %% API Module flow
    D1 -->|"sets up"| D2
    D2 -->|"drives"| D3

    %% Reporting & Listeners integration
    C3 -->|"reports to"| E2
    D3 -->|"reports to"| E2
    E2 -->|"updates"| E1

    %% Utilities & Data Handling usage
    C3 -->|"reads"| F2
    D3 -->|"reads"| F2
    C3 -->|"uses"| F1
    D3 -->|"uses"| F1
    F1 -->|"organizes"| F2

    %% External tool integration
    P1 -->|"used by"| C1
    P1 -->|"used by"| D1

    %% Click Events
    click A1 "https://github.com/freeautomationlearning/playwritepom/blob/main/pom.xml"
    click A2 "https://github.com/freeautomationlearning/playwritepom/blob/main/testsuites/APISuite.xml"
    click A3 "https://github.com/freeautomationlearning/playwritepom/blob/main/testsuites/UISuite.xml"
    click B1 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/main/java/com/freeautomationlearning/base"
    click B2 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/main/java/com/freeautomationlearning/base/utilty"
    click C1 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/main/java/com/freeautomationlearning/base/ui"
    click C2 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/test/java/com/freeautomationlearning/ui/pages"
    click C3 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/test/java/com/freeautomationlearning/ui/testscripts"
    click D1 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/main/java/com/freeautomationlearning/base/api"
    click D2 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/test/java/com/freeautomationlearning/api/pages"
    click D3 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/test/java/com/freeautomationlearning/api/testscripts"
    click E1 "https://github.com/freeautomationlearning/playwritepom/blob/main/src/main/java/com/freeautomationlearning/reports/ExtentReportManager.java"
    click E2 "https://github.com/freeautomationlearning/playwritepom/blob/main/src/main/java/com/freeautomationlearning/listeners/TestListeners.java"
    click F1 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/test/java/com/freeautomationlearning/utlis"
    click F2 "https://github.com/freeautomationlearning/playwritepom/tree/main/src/test/resources"

    %% Styling Classes
    classDef external fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef base fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef ui fill:#d6eaf8,stroke:#2980b9,stroke-width:2px;
    classDef api fill:#e8daef,stroke:#8e44ad,stroke-width:2px;
    classDef reporting fill:#fadbd8,stroke:#e74c3c,stroke-width:2px;
    classDef utilities fill:#fcf3cf,stroke:#f1c40f,stroke-width:2px;
```
