# svsatish/hybrid-playwright-framework architecture

> Architecture diagram of the GitHub repository svsatish/hybrid-playwright-framework, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/svsatish/hybrid-playwright-framework
- Repository: https://github.com/svsatish/hybrid-playwright-framework

## Overview

##### Project type and purpose
- This is a full-stack test automation framework built in TypeScript using Playwright.
- It supports UI tests (browser automation), API tests (HTTP requests), and hybrid flows combining both.
- Key goals: POM structure, dynamic test data, logging, Allure reporting, CI/CD via GitHub Actions, optional Docker packaging.

##### File structure
- Top-level:
- .github/workflows/playwright.yml → CI pipeline
- Dockerfile → containerizes the test runner
- playwright.config.ts, global-setup.ts → test runner configuration and environment metadata
- tsconfig.json → TypeScript compilation
- package.json → scripts and dependencies
- src/:
- config/env.ts → environment variables loader
- fixtures/ → static JSON fixtures
- pages/ → Playwright Page Object Models
- tests/api, tests/ui, tests/hybrid → separation of test types
- utils/logger.ts, utils/testUserGenerator.ts → logging and dynamic data
- test-results/ & reports/logs folders → artifacts (videos, error contexts, Allure history)

##### README for additional insights
- Architectural principles:
- Page Object Model for UI abstractions
- Layered tests: pure UI, pure API, hybrid
- Central config and environment metadata injection
- Pluggable reporting (Allure), logging (log4js)
- CI/CD pipeline that installs, runs tests headless, collects results, publishes reports
- Docker to run tests in a controlled environment

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "CI/CD Pipeline"
        GH["GitHub Actions"]:::cloud
    end
    GH -->|"runs in"| Docker[/"Docker Container"/]:::container
    Docker -->|"executes"| Runner["Test Runner\n(Playwright CLI & Node.js)"]:::component

    subgraph "Runner Setup"
        PlaywrightConfig["Playwright Config\n(playwright.config.ts)"]:::config
        GlobalSetup["Global Setup\n(global-setup.ts)"]:::config
        ConfigLoader["Config Loader\n(src/config/env.ts)"]:::config
    end
    Runner --> PlaywrightConfig
    Runner --> GlobalSetup
    Runner --> ConfigLoader

    subgraph "Project Config"
        TSConfig["TypeScript Config\n(tsconfig.json)"]:::config
        Package["Package Configuration\n(package.json)"]:::config
    end
    Runner --> TSConfig
    Runner --> Package

    subgraph "Test Suites Execution"
        UITests["UI Tests\n(src/tests/ui/homepage.spec.ts)"]:::test
        APITests["API Tests\n(src/tests/api/products.spec.ts)"]:::test
        HybridTests["Hybrid Tests\n(src/tests/hybrid/register-and-validate.spec.ts)"]:::test
    end
    Runner --> UITests
    Runner --> APITests
    Runner --> HybridTests

    subgraph "UI Test Flow"
        UITests --> POM["POM Layer"]:::component
        POM --> HomePage["HomePage\n(src/pages/HomePage.ts)"]:::component
        POM --> RegisterPage["RegisterPage\n(src/pages/RegisterPage.ts)"]:::component
        POM --> Browser((Browser Context)):::external
        Browser -->|"tests UI"| SUT["System Under Test\n(UI)"]:::external
    end

    subgraph "API Test Flow"
        APITests --> APIClient["API Client Layer"]:::component
        APIClient -->|"HTTP Requests"| SUTAPI["System Under Test\n(API)"]:::external
    end

    subgraph "Hybrid Test Flow"
        HybridTests --> POM
        HybridTests --> APIClient
    end

    subgraph "Data & Fixtures"
        Fixtures["Static Fixtures\n(src/fixtures/user.json)"]:::data
        Faker["Test Data Generator\n(src/utils/testUserGenerator.ts)"]:::data
    end
    ConfigLoader --> Fixtures
    ConfigLoader --> Faker
    UITests --> Fixtures
    APITests --> Fixtures
    HybridTests --> Fixtures
    UITests --> Faker
    APITests --> Faker

    subgraph "Services"
        Logger["Logging Service\n(src/utils/logger.ts)"]:::service
        Reporter["Reporting Service\n(Allure)"]:::service
    end
    Runner --> Logger
    Runner --> Reporter
    Logger --> Logs["Logs\n(reports/logs)"]:::artifact
    Reporter --> Reports["Reports & History\n(reports/logs)"]:::artifact

    subgraph "Artifacts"
        RawResults["Raw Results JSON\n(test-results/.last-run.json)"]:::artifact
        HybridArtifacts["Hybrid Artifacts\n(test-results/hybrid-register-and-validate-UI-registration-API-validation)"]:::artifact
    end
    Runner --> RawResults
    HybridTests --> HybridArtifacts
    Reporter --> RawResults
    Reporter --> HybridArtifacts

    GH --> Runner

    click GH "https://github.com/svsatish/hybrid-playwright-framework/blob/main/.github/workflows/playwright.yml"
    click Docker "https://github.com/svsatish/hybrid-playwright-framework/tree/main/Dockerfile"
    click PlaywrightConfig "https://github.com/svsatish/hybrid-playwright-framework/blob/main/playwright.config.ts"
    click GlobalSetup "https://github.com/svsatish/hybrid-playwright-framework/blob/main/global-setup.ts"
    click ConfigLoader "https://github.com/svsatish/hybrid-playwright-framework/blob/main/src/config/env.ts"
    click HomePage "https://github.com/svsatish/hybrid-playwright-framework/blob/main/src/pages/HomePage.ts"
    click RegisterPage "https://github.com/svsatish/hybrid-playwright-framework/blob/main/src/pages/RegisterPage.ts"
    click APITests "https://github.com/svsatish/hybrid-playwright-framework/blob/main/src/tests/api/products.spec.ts"
    click UITests "https://github.com/svsatish/hybrid-playwright-framework/blob/main/src/tests/ui/homepage.spec.ts"
    click HybridTests "https://github.com/svsatish/hybrid-playwright-framework/blob/main/src/tests/hybrid/register-and-validate.spec.ts"
    click Fixtures "https://github.com/svsatish/hybrid-playwright-framework/blob/main/src/fixtures/user.json"
    click Faker "https://github.com/svsatish/hybrid-playwright-framework/blob/main/src/utils/testUserGenerator.ts"
    click Logger "https://github.com/svsatish/hybrid-playwright-framework/blob/main/src/utils/logger.ts"
    click RawResults "https://github.com/svsatish/hybrid-playwright-framework/blob/main/test-results/.last-run.json"
    click HybridArtifacts "https://github.com/svsatish/hybrid-playwright-framework/tree/main/test-results/hybrid-register-and-validate-UI-registration-API-validation"
    click TSConfig "https://github.com/svsatish/hybrid-playwright-framework/blob/main/tsconfig.json"
    click Package "https://github.com/svsatish/hybrid-playwright-framework/blob/main/package.json"

    classDef cloud fill:#ade1f9,stroke:#0288d1,color:#000;
    classDef container fill:#f0d9ff,stroke:#9c27b0,color:#000;
    classDef component fill:#c8e6c9,stroke:#388e3c,color:#000;
    classDef config fill:#fff9c4,stroke:#fbc02d,color:#000;
    classDef test fill:#ffe0b2,stroke:#fb8c00,color:#000;
    classDef data fill:#d1c4e9,stroke:#7e57c2,color:#000;
    classDef service fill:#b2dfdb,stroke:#00796b,color:#000;
    classDef artifact fill:#ffccbc,stroke:#e64a19,color:#000;
    classDef external fill:#e1f5fe,stroke:#0288d1,color:#000;
```
