# skumar0922/playwright_pom_fixtures architecture

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

- Interactive diagram: https://gitdiagram.com/skumar0922/playwright_pom_fixtures
- Repository: https://github.com/skumar0922/playwright_pom_fixtures

## Overview

##### Main Components
- Test Runner & Configuration:
- A central component driven by Playwright (see playwright.config.ts) that defines execution parameters (parallel execution, browser configurations, retries, etc.).
- Test Cases Directory:
- Organized under the tests folder with subdirectories for uiTests, snapshotTests, apiTests, pages (which contain the POM classes), and screenshots.
- Page Object Model (POM):
- Encapsulates UI component interactions (examples include HomePage.ts, LoginPage.ts, common.page.ts, etc.) and is a reusable abstraction layer in the testing setup.
- Utilities:
- The utils folder contains helper files like encrypt&decrypt.ts (for secure handling such as encryption/decryption) and environment.ts (to manage environment variables).
- Reporting and Test Results:
- Allure reporting (allure-results and generated allure-report) alongside the playwright report (HTML report in playwright-report) that encapsulates the test results and visual debug info.
- Containerization & Deployment:
- Dockerfile, docker-compose.yml, and supplemental files (.dockerignore, .env) support running tests in containerized environments, enabling smooth integration with CI/CD pipelines.

##### Visualizing Relationships and Interactions
- How the Test Runner (Playwright) sits at the center, initiating test execution based on the configuration in playwright.config.ts.
- That tests may rely on utility functions (from the utils folder) for environment configurations and data handling.
- Data/report flow: after execution, results are generated and stored in directories (allure-results, playwright-report) which then produce reports.
- Docker setup as an outer environment/container that packages the complete testing framework to run in isolated instances.

##### Architectural Patterns/Design Principles
- Modular Page Object Model (POM): This abstraction is crucial and should be separately highlighted to show how UI interactions are decoupled from test logic.
- Separation of Concerns: Configuration, test scripts, utility operations, and reporting are well separated into distinct folders.
- Containerization: Using Docker to encapsulate dependencies and environment settings, making the framework portable, maintainable, and CI/CD friendly.
- Parallel and Isolated Test Execution: As detailed in playwright.config.ts, tests are designed to execute in parallel with isolated test contexts.

##### Relevant Technologies, Frameworks, and Libraries
- Node.js: The overall runtime environment.
- Playwright: The primary testing framework, responsible for browser automation.
- Allure & HTML Reporters: Generate detailed test execution reports.
- Docker: For containerizing and orchestrating test runs.
- NPM: Dependency management (as seen in package.json and package-lock.json).

##### Elements
- Use clear labels for each component:
- "Test Runner (Playwright)" for the central orchestrator.
- "Test Cases" with sub-components: "uiTests", "snapshotTests", "apiTests".
- "Page Objects (POM)" indicating individual pages like LoginPage, HomePage, etc.
- "Utilities" for environment management and encryption.
- "Reports" to represent Allure and HTML reporting mechanisms.
- "Docker Environment" to encapsulate the entire architecture for containerized execution.
- Data flow from Test Runner → Test Cases → Page Objects.

This comprehensive approach ensures that all key aspects – from configuration and test execution to reporting and environment management – are clearly represented, providing an accurate architectural view tailored to this specific testing framework.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Components
    TR["Test Runner (Playwright)"]:::runner
    TC["Test Cases"]:::test
    PO["Page Objects (POM)"]:::pom
    UT["Utilities"]:::utils
    RP["Reporting"]:::report
    DC["Docker Environment"]:::docker

    %% Sub-components for Test Cases
    subgraph "Test Cases"
        UIT["UI Tests"]:::test
        ST["Snapshot Tests"]:::test
        AT["API Tests"]:::test
    end

    %% Sub-components for Page Objects (POM)
    subgraph "Page Objects"
        HP["HomePage.ts"]:::pom
        LP["LoginPage.ts"]:::pom
        CP["common.page.ts"]:::pom
        EWP["exploreWorkspace.page.ts"]:::pom
        LNP["landingPage.ts"]:::pom
    end

    %% Sub-components for Utilities
    subgraph "Utilities"
        ED["encrypt&decrypt.ts"]:::utils
        ENV["environment.ts"]:::utils
    end

    %% Sub-components for Reporting
    subgraph "Reporting"
        AR["Allure Results"]:::report
        HR["HTML Report"]:::report
    end

    %% Sub-components for Docker Environment
    subgraph "Containerization & Deployment"
        DF["Dockerfile"]:::docker
        DCY["docker-compose.yml"]:::docker
        DDI[".dockerignore"]:::docker
        ENVF[".env"]:::docker
    end

    %% Relationships
    UT -->|"configures"| TR
    TR -->|"executes"| TC
    TC -->|"utilizes"| PO
    TR -->|"generates"| RP
    DC -->|"hosts"| TR

    %% Styles for vertical layout
    style TR fill:#FFD700,stroke:#333,stroke-width:2px
    style TC fill:#ADD8E6,stroke:#333,stroke-width:2px
    style PO fill:#87CEFA,stroke:#333,stroke-width:2px
    style UT fill:#90EE90,stroke:#333,stroke-width:2px
    style RP fill:#FFB6C1,stroke:#333,stroke-width:2px
    style DC fill:#FFE4B5,stroke:#333,stroke-width:2px

    %% Click Events
    click TR "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/playwright.config.ts"
    click UIT "https://github.com/skumar0922/playwright_pom_fixtures/tree/main/tests/uiTests"
    click ST "https://github.com/skumar0922/playwright_pom_fixtures/tree/main/tests/snapshotTests"
    click HP "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/tests/pages/HomePage.ts"
    click LP "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/tests/pages/LoginPage.ts"
    click CP "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/tests/pages/common.page.ts"
    click EWP "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/tests/pages/exploreWorkspace.page.ts"
    click LNP "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/tests/pages/landingPage.ts"
    click ED "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/utils/encrypt&decrypt.ts"
    click ENV "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/utils/environment.ts"
    click AR "https://github.com/skumar0922/playwright_pom_fixtures/tree/main/allure-results"
    click HR "https://github.com/skumar0922/playwright_pom_fixtures/tree/main/playwright-report"
    click DF "https://github.com/skumar0922/playwright_pom_fixtures/tree/main/Dockerfile"
    click DCY "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/docker-compose.yml"
    click DDI "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/.dockerignore"
    click ENVF "https://github.com/skumar0922/playwright_pom_fixtures/blob/main/.env"

classDef runner fill:#FFD700,stroke:#333,stroke-width:2px;
classDef test fill:#ADD8E6,stroke:#333,stroke-width:2px;
classDef pom fill:#87CEFA,stroke:#333,stroke-width:2px;
classDef utils fill:#90EE90,stroke:#333,stroke-width:2px;
classDef report fill:#FFB6C1,stroke:#333,stroke-width:2px;
classDef docker fill:#FFE4B5,stroke:#333,stroke-width:2px;
```
