# rajatt95/playwright_ts architecture

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

- Interactive diagram: https://gitdiagram.com/rajatt95/playwright_ts
- Repository: https://github.com/rajatt95/playwright_ts

## Overview

##### Project Type and Purpose
- This is an automation testing framework built with Playwright and TypeScript.
- It drives end-to-end UI tests, API tests, visual regression tests, and web-scraping experiments against a target application.
- It uses the Page Object Model (POM) for UI tests, organizes tests into conceptual “Sections,” and generates artifacts like screenshots, videos, traces, and Allure reports.

##### File-Structure Analysis
- Top Level
- playwright-*.config.ts – Playwright runner configurations (E2E, custom presets)
- page-objects/ – POM classes for each page and shared components
- tests/ – Organized test suites by section (UI basics, E2E, POM, visual, API, BDD, etc.)
- utils/ – Helper functions (data generators, example utilities)
- screenshots/, PDFs/ – Artifacts and course resources
- Patterns & Layers
- Configuration Layer: .config.ts files define browsers, reporters, retries, traces, fixtures
- Test Execution Layer: tests invoke Playwright runner, use POM classes & utils
- POM Layer: abstracts selectors and page interactions
- Utility Layer: common data-helpers, random data functions
- Artifact & Reporting Layer: file system writes (screenshots, videos), Allure or built-in HTML reports

##### Key README Insights
- Supports cross-browser parallel execution, API interceptors, tagging, retries, annotations
- Integrates reporters (Playwright HTML, Allure), trace viewer, Playwright Inspector
- Emphasizes parameterization, SSL handling, visual snapshots

a. Main Components
1. Test Runner (Playwright CLI/Node process)
2. Configuration Module (.config.ts)
3. Test Suites (organized under tests/)
4. Page Object Module (page-objects/)
5. Utility Module (utils/)
6. Target Application Under Test (UI & API endpoints)
7. Browser Engines (Chromium, Firefox, WebKit)
8. Artifact Store (file system: screenshots/, videos/, trace files)
9. Reporting Engine (HTML reporter, Allure)
10. CI/CD Pipeline (e.g., Jenkins – optional external service)
b. Relationships & Data Flows
- The Test Runner reads the Configuration Module.
- It loads Test Suites, instantiates POM classes and calls Utility functions.
- For UI tests, it launches Browser Engines and drives the Application Under Test via HTTP and DOM interactions.
- For API tests, it makes direct HTTP calls to the Application’s API endpoints.
- During execution, artifacts (screenshots, videos, traces) are written to disk.
- Upon completion, reported results are aggregated and fed into the Reporting Engine.
- Optionally, CI/CD orchestrates the entire Test Runner and publishes reports.
c. Architectural Patterns & Principles
- Page Object Model for UI abstraction and reusability
- Layered testing approach (unit of config, POM, test logic, reporting)
- Modular design for adding new suites or sections without impacting others
- Data-driven testing via parameterization helpers in utils
d. Technologies & Frameworks
- Playwright (browsers, runner, inspector, trace)
- TypeScript (type safety, async/await)
- Allure & Playwright HTML Reporter
- Jest-style or Jasmine-style syntax (Playwright Test)
- Node.js (execution environment)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Execution Layer
    subgraph "Execution Layer"
        direction TB
        Runner["Playwright Test Runner<br/>(package.json)"]:::execution
        Config["Configuration Module"]:::execution
    end

    %% Test Code Layer
    subgraph "Test Code Layer"
        direction TB
        subgraph "Test Suites"
            direction TB
            Sec02["Section_02_KO_UI_Tests"]:::testcode
            Sec03["Section_03_KO_UI_Tests_e2e"]:::testcode
            Sec04["Section_04_KO_UI_Tests_e2e_PageObjects"]:::testcode
            Sec05["Section_05_KO_UI_Tests_Visual"]:::testcode
            Sec06["Section_06_KO_API_Tests"]:::testcode
            Sec08["Section_08_KO_UI_Tests_Tips_&_Tricks"]:::testcode
            Sec09["Section_09_KO_UI_Tests_BDD_Cucumber"]:::testcode
            Sec10["Section_10_KO_UI_Tests_BDD_Codecept"]:::testcode
            Sec12["Section_12_KO_UI_Tests_Web_Scraping"]:::testcode
        end
        subgraph "Page Object Module"
            direction TB
            AbstractPage["AbstractPage.ts"]:::testcode
            HomePage["HomePage.ts"]:::testcode
            LoginPage["LoginPage.ts"]:::testcode
            FeedbackPage["FeedbackPage.ts"]:::testcode
            PaymentPage["PaymentPage.ts"]:::testcode
            Navbar["components/Navbar.ts"]:::testcode
        end
        subgraph "Utility Module"
            direction TB
            DataHelpers["Utils_DataHelpers.ts"]:::testcode
            ExampleUtil["Utils_Example.ts"]:::testcode
        end
    end

    %% Browsers & HTTP Client
    subgraph "External Systems"
        direction TB
        Browsers["Browser Engines<br/>(Chromium, Firefox, WebKit)"]:::external
        HTTPClient["HTTP Client"]:::external
        AUTUI["Application Under Test UI"]:::external
        AUTAPI["Application Under Test API"]:::external
        CICD["CI/CD Pipeline"]:::external
    end

    %% Artifacts & Reporting
    subgraph "Artifacts & Reporting"
        direction TB
        ArtifactStore["Artifact Store<br/>(screenshots/, videos/, traces)"]:::artifact
        Reports["Reporting Engine<br/>(HTML Reporter, Allure)"]:::artifact
        PDFs["PDF Resources"]:::artifact
    end

    %% Relationships
    Runner -->|reads| Config
    Runner -->|loads| Sec02
    Runner -->|loads| Sec03
    Runner -->|loads| Sec04
    Runner -->|loads| Sec05
    Runner -->|loads| Sec06
    Runner -->|loads| Sec08
    Runner -->|loads| Sec09
    Runner -->|loads| Sec10
    Runner -->|loads| Sec12

    Sec02 -->|uses| AbstractPage
    Sec03 -->|uses| AbstractPage
    Sec04 -->|uses| HomePage
    Sec04 -->|uses| LoginPage
    Sec04 -->|uses| FeedbackPage
    Sec04 -->|uses| PaymentPage
    Sec04 -->|uses| Navbar
    Sec05 -->|uses| DataHelpers
    Sec06 -->|uses| HTTPClient
    Sec08 -->|uses| ExampleUtil
    Sec12 -->|uses| HTTPClient

    Config -->|configures| Runner

    AbstractPage -->|drives| Browsers
    HomePage -->|drives| Browsers
    LoginPage -->|drives| Browsers
    FeedbackPage -->|drives| Browsers
    PaymentPage -->|drives| Browsers

    Browsers -->|interacts| AUTUI
    HTTPClient -->|calls| AUTAPI

    Runner -->|writes| ArtifactStore
    ArtifactStore -->|feeds| Reports
    Runner -->|produces| Reports
    CICD -->|orchestrates| Runner
    CICD -->|publishes| Reports

    %% Click Events - Configuration Module
    click Config "https://github.com/rajatt95/playwright_ts/blob/master/playwright-e2e.config.ts"
    click Config "https://github.com/rajatt95/playwright_ts/blob/master/playwright-e2e-page-objects.config.ts"
    click Config "https://github.com/rajatt95/playwright_ts/blob/master/playwright-custom.config.ts"

    %% Click Events - Runner
    click Runner "https://github.com/rajatt95/playwright_ts/blob/master/package.json"

    %% Click Events - Test Suites
    click Sec02 "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_02_KO_UI_Tests/"
    click Sec03 "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_03_KO_UI_Tests_e2e/"
    click Sec04 "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_04_KO_UI_Tests_e2e_PageObjects/"
    click Sec05 "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_05_KO_UI_Tests_Visual/"
    click Sec06 "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_06_KO_API_Tests/"
    click Sec08 "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_08_KO_UI_Tests_Tips_&_Tricks/"
    click Sec09 "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_09_KO_UI_Tests_BDD_Cucumber/"
    click Sec10 "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_10_KO_UI_Tests_BDD_Codecept/"
    click Sec12 "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_12_KO_UI_Tests_Web_Scraping/"

    %% Click Events - Page Objects
    click AbstractPage "https://github.com/rajatt95/playwright_ts/blob/master/page-objects/AbstractPage.ts"
    click HomePage "https://github.com/rajatt95/playwright_ts/blob/master/page-objects/HomePage.ts"
    click LoginPage "https://github.com/rajatt95/playwright_ts/blob/master/page-objects/LoginPage.ts"
    click FeedbackPage "https://github.com/rajatt95/playwright_ts/blob/master/page-objects/FeedbackPage.ts"
    click PaymentPage "https://github.com/rajatt95/playwright_ts/blob/master/page-objects/PaymentPage.ts"
    click Navbar "https://github.com/rajatt95/playwright_ts/blob/master/page-objects/components/Navbar.ts"

    %% Click Events - Utils
    click DataHelpers "https://github.com/rajatt95/playwright_ts/blob/master/utils/Utils_DataHelpers.ts"
    click ExampleUtil "https://github.com/rajatt95/playwright_ts/blob/master/utils/Utils_Example.ts"

    %% Click Events - Artifact Store
    click ArtifactStore "https://github.com/rajatt95/playwright_ts/tree/master/screenshots/"
    click ArtifactStore "https://github.com/rajatt95/playwright_ts/tree/master/tests/Section_05_KO_UI_Tests_Visual/*-snapshots/"

    %% Click Events - PDFs
    click PDFs "https://github.com/rajatt95/playwright_ts/blob/master/PDFs/Github_Page-Rajatt95.pdf"
    click PDFs "https://github.com/rajatt95/playwright_ts/blob/master/PDFs/Github_Profile-Rajatt95.pdf"

    %% Styles
    classDef execution fill:#add8e6,stroke:#000,stroke-width:1px
    classDef testcode fill:#90ee90,stroke:#000,stroke-width:1px
    classDef external fill:#ffa500,stroke:#000,stroke-width:1px
    classDef artifact fill:#d3d3d3,stroke:#000,stroke-width:1px
```
