# veereshchetti0103/playwright-typescript-ui-tests architecture

> Architecture diagram of the GitHub repository veereshchetti0103/playwright-typescript-ui-tests, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/veereshchetti0103/playwright-typescript-ui-tests
- Repository: https://github.com/veereshchetti0103/playwright-typescript-ui-tests

## Overview

##### Project Type and Purpose
- This is a Playwright-based end-to-end test automation framework, not a user-facing application.
- Its purpose is to execute web UI tests against the “Todoapp” page model, generate reports (JSON, HTML), and email a summary using Gmail via the playwright-nodemailer-reporter. It integrates with GitHub Actions and Azure DevOps for CI/CD.

##### File Structure
- `/pages`: Implements the Page Object Model (POM). Each class (e.g., `TodoappPage.ts`) encapsulates selectors and actions for a UI page.
- `/tests/Web`: Contains the spec files that import POM classes and drive test scenarios (e.g., `todoapp.spec.ts`, visual regression specs).
- `/utils/Web`: Houses test data (`TestData.json`/`.ts`) and UI constants—shared helper functions or data fixtures.
- `/env-vars`: Stores environment-specific variables (`.env.test`).
- Root files:
- `playwright.config.ts` — configures test runner, browser options, timeouts, reporters.
- `package.json` / `package-lock.json` — dependency definitions, scripts.
- CI files: `.github/workflows/playwright.yml` and `azure-devope-pipeline.yml`.
- Snapshots folder under tests for visual diff results.

##### README for Insights
- Describes folder roles and setup steps.
- Notes support for JSON/HTML reports and email reporting via Gmail.
- Indicates CI/CD integration points (GitHub Actions & Azure Pipelines).

##### Main Architectural Components
a. Test Runner (Playwright CLI)
b. Page Object Layer (`/pages/Web`)
c. Test Suites (`/tests/Web`)
d. Utility Layer (`/utils/Web`)
e. Configuration/Environment (`playwright.config.ts`, `/env-vars`)
f. Reporters
- Built-in JSON/HTML reporter
- Email reporter (playwright-nodemailer-reporter) → Gmail SMTP
g. CI/CD Orchestrators
- GitHub Actions
- Azure DevOps Pipeline
h. External Systems
- Web browser instances (Chromium/Firefox/WebKit)
- Gmail SMTP server

##### Relationships and Data Flows
1. CI/CD triggers → executes `npx playwright test`
2. Playwright loads `playwright.config.ts` + `/env-vars` → spins up browser instances
3. Test Suites import POM classes → POM uses UI selectors & actions
4. Tests consume TestData & UIConstants from `/utils/Web`
5. On each test run completion → built-in reporters output JSON/HTML reports + snapshot diffs
6. Email Reporter collects summary from the test run → sends email via Gmail SMTP
7. CI/CD captures exit codes/reports → publishes test results

##### Architectural Patterns and Design Principles
- Layered Architecture:
- Presentation (Page Objects)
- Application Logic (Test Suites)
- Utilities & Config (Data/Constants)
- POM for maintainability and reuse
- Single Source of Truth for environment variables
- CI/CD as code (GitHub Actions, Azure DevOps YAML)
- Separation of concerns between test logic and reporting

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "CI/CD Layer"
        GH["GitHub Actions"]:::cicd
        AZ["Azure DevOps Pipeline"]:::cicd
    end

    subgraph "Config Layer"
        TR["Test Runner\n(Playwright CLI)"]:::config
        PC["playwright.config.ts"]:::config
        ENV[".env.test"]:::config
    end

    subgraph "Test Layer"
        TS1["todoapp.spec.ts"]:::test
        TS2["visualtest.spec.ts"]:::test
        VS["visualtest.spec.ts-snapshots"]:::test
    end

    subgraph "Page Object Layer"
        PG["pages/Pages.ts"]:::pom
        TP["TodoappPage.ts"]:::pom
    end

    subgraph "Utility Layer"
        UD1["TestData.json"]:::util
        UD2["TestData.ts"]:::util
        UC["UIConstants.ts"]:::util
    end

    subgraph "Reporting Layer"
        R1["JSON/HTML Reporter"]:::report
        R2["Email Reporter"]:::report
    end

    subgraph "External Systems"
        BROWSERS["Browser Instances\n(Chromium/Firefox/WebKit)"]:::external
        GMAIL["Gmail SMTP"]:::external
    end

    %% Connections
    GH -->|triggers| TR
    AZ -->|triggers| TR
    TR -->|"loads config"| PC
    TR -->|"loads env-vars"| ENV
    TR -->|"executes tests"| TS1
    TR -->|"executes tests"| TS2
    TR -->|"spins up"| BROWSERS
    TS1 -->|"uses POM"| TP
    TS1 -->|"uses POM"| PG
    TS2 -->|"uses POM"| TP
    TS2 -->|"uses POM"| PG
    TS1 -->|"consumes"| UD1
    TS1 -->|"consumes"| UD2
    TS1 -->|"consumes"| UC
    TS2 -->|"consumes"| UD1
    TS2 -->|"consumes"| UD2
    TS2 -->|"consumes"| UC
    TS2 -->|"generates snapshots"| VS
    TR -->|"generates reports"| R1
    TR -->|"generates reports"| R2
    R2 -->|"sends email"| GMAIL
    R1 -->|"reports to CI"| GH
    R2 -->|"reports to CI"| GH
    R1 -->|"reports to CI"| AZ
    R2 -->|"reports to CI"| AZ

    %% Click Events
    click GH "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/.github/workflows/playwright.yml"
    click AZ "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/azure-devope-pipeline.yml"
    click TR "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/playwright.config.ts"
    click PC "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/playwright.config.ts"
    click ENV "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/env-vars/.env.test"
    click PG "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/pages/Pages.ts"
    click TP "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/pages/Web/TodoappPage.ts"
    click TS1 "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/tests/Web/todoapp.spec.ts"
    click TS2 "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/tests/Web/visualtest.spec.ts"
    click VS "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/tests/Web/visualtest.spec.ts-snapshots"
    click UD1 "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/utils/Web/TestData.json"
    click UD2 "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/utils/Web/TestData.ts"
    click UC "https://github.com/veereshchetti0103/playwright-typescript-ui-tests/blob/master/utils/Web/UIConstants.ts"

    %% Styles
    classDef test fill:#CCE5FF,stroke:#3399FF,color:#000;
    classDef pom fill:#DFF7DF,stroke:#22AA44,color:#000;
    classDef util fill:#FFECB3,stroke:#FFB300,color:#000;
    classDef config fill:#E0E0E0,stroke:#888888,color:#000;
    classDef report fill:#E8DAEF,stroke:#9B59B6,color:#000;
    classDef cicd fill:#D1F2EB,stroke:#1ABC9C,color:#000;
    classDef external fill:#FFF2CC,stroke:#F1C40F,color:#000;
```
