# qa-learning-hub/e2e-automation-template-playwright architecture

> Architecture diagram of the GitHub repository qa-learning-hub/e2e-automation-template-playwright, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/qa-learning-hub/e2e-automation-template-playwright
- Repository: https://github.com/qa-learning-hub/e2e-automation-template-playwright

## Overview

##### Project Type and Purpose
- This is an E2E Automation Framework template, not a business application.
- Purpose: provide a scalable, maintainable foundation for UI and API tests using Playwright, TypeScript, POM, and CI integration.

##### File Structure
- src/pages: Page Object Model (POM) classes representing UI screens.
- src/utils: shared helpers (dataGenerator, dateUtils, validators).
- tests/ui and tests/api: test suites (UI spec files and API spec files).
- playwright.config.ts + env.config.ts: test configuration and environment settings.
- .github/workflows/playwright-tests.yml: CI workflow.
- package.json: dependencies (Playwright, Allure, TypeScript, etc.).

##### Extract Additional Insights from README
- Uses Page Object Model pattern.
- CI via GitHub Actions: install deps, install browsers, run tests, generate Allure report.
- Generates screenshots, videos, and Allure results.

a. Local/Developer Environment
- Node.js + npm
- Playwright CLI & Browsers (Chromium, Firefox, WebKit)
- TypeScript compiler (tsc)
b. Test Artifacts
- POM Classes (src/pages)
- Utility Modules (src/utils)
- UI Tests (tests/ui/*.spec.ts)
- API Tests (tests/api/*.spec.ts)
c. Configuration
- playwright.config.ts (projects, reporters, timeouts)
- env.config.ts (environment URLs, credentials)
d. CI/CD Pipeline
- GitHub Actions workflow
- Steps: checkout → npm install → npx playwright install → run UI & API tests → generate Allure results → publish artifacts
e. Reporting
- Allure-results & allure-report
- Screenshots & videos for failures

##### Relationships and Interactions
- Developer triggers `npm test` or `npx playwright test`, which:
1. Reads playwright.config.ts & env.config.ts
2. Compiles TypeScript → loads POM classes & utils
3. Executes UI tests: POM → HTTP/browser → Application Under Test (AUT)
4. Executes API tests: Playwright request → backend endpoints
5. Collects logs, screenshots, videos, and test results
6. Generates Allure reports
- CI pipeline automates the same sequence on each push/PR.

##### Architectural Patterns & Principles
- Page Object Model (separation of page definitions from test logic)
- Single Responsibility (utils vs. page objects vs. specs)
- Config-driven (env.config.ts + playwright.config.ts)
- Modular tests (UI vs. API)

##### Technologies & Frameworks
- Node.js, npm
- TypeScript, ts-node
- Playwright (test runner, browser automation)
- GitHub Actions (CI)
- Allure Playwright (reporting)
- ESLint & Prettier (code quality)

##### Final Checklist
- [ ] Components: Dev machine, CI server, AUT/API endpoint
- [ ] Modules: src/pages, src/utils, tests/ui, tests/api, config files
- [ ] Workflows: CLI commands, GitHub Actions steps
- [ ] Data flows: test execution → AUT/API → reporting

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer Environment
    subgraph "Developer Environment"
        A1["Node.js & npm"]:::external
        A2["TypeScript Compiler (tsc)"]:::process
        A3["Playwright CLI & Browsers"]:::process
    end

    %% Source Code Modules
    subgraph "Source Code"
        POM["LoginPage (POM Classes)"]:::code
        click POM "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/src/pages/login.page.ts"
        UG["dataGenerator.ts"]:::code
        click UG "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/src/utils/dataGenerator.ts"
        DU["dateUtils.ts"]:::code
        click DU "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/src/utils/dateUtils.ts"
        VAL["validators.ts"]:::code
        click VAL "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/src/utils/validators.ts"
        UI_TEST1["login.spec.ts"]:::code
        click UI_TEST1 "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/tests/ui/login.spec.ts"
        UI_TEST2["loginWithTestStep.spec.ts"]:::code
        click UI_TEST2 "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/tests/ui/loginWithTestStep.spec.ts"
        API_TEST["example-api.spec.ts"]:::code
        click API_TEST "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/tests/api/example-api.spec.ts"
        CFG1["playwright.config.ts"]:::code
        click CFG1 "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/playwright.config.ts"
        CFG2["env.config.ts"]:::code
        click CFG2 "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/env.config.ts"
        TS_CFG["tsconfig.json"]:::code
        click TS_CFG "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/tsconfig.json"
        PKG["package.json"]:::code
        click PKG "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/package.json"
        PLK["package-lock.json"]:::code
        click PLK "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/package-lock.json"
    end

    %% CI/CD Pipeline
    subgraph "CI/CD (GitHub Actions)"
        CI["playwright-tests.yml"]:::process
        click CI "https://github.com/qa-learning-hub/e2e-automation-template-playwright/blob/main/.github/workflows/playwright-tests.yml"
    end

    %% Application Under Test
    subgraph "Application Under Test"
        AUT["Web Application"]:::external
        API["API Endpoints"]:::external
    end

    %% Test Artifacts
    subgraph "Test Artifacts"
        SCR["Screenshots & Videos"]:::artifact
        ALLURE["Allure Results & Reports"]:::artifact
    end

    %% Flows
    A1 --> A2 --> A3
    CI --> A1
    CI --> A3
    CFG1 --> A3
    CFG2 --> A3

    A3 --> UI_TEST1
    A3 --> UI_TEST2
    A3 --> API_TEST

    UI_TEST1 -->|"uses"| POM
    UI_TEST1 -->|"uses"| UG
    UI_TEST1 -->|"uses"| DU
    UI_TEST1 -->|"uses"| VAL
    UI_TEST2 -->|"uses"| POM

    API_TEST -->|"uses"| CFG2

    UI_TEST1 -->|"run on"| AUT
    UI_TEST2 -->|"run on"| AUT
    API_TEST -->|"requests"| API

    UI_TEST1 --> SCR
    UI_TEST2 --> SCR

    UI_TEST1 --> ALLURE
    UI_TEST2 --> ALLURE
    API_TEST --> ALLURE

    CI -->|"publishes"| SCR
    CI -->|"publishes"| ALLURE

    %% Styles
    classDef code fill:#cfe2f3,stroke:#0366d6,color:#000;
    classDef process fill:#ffe4b5,stroke:#d2691e,color:#000;
    classDef artifact fill:#c2f0c2,stroke:#2e8b57,color:#000;
    classDef external fill:#f0f0f0,stroke:#696969,color:#000;
```
