# idavidov13/playwright-framework architecture

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

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

## Overview

##### Project type and purpose
- This is an open-source automation framework built on Playwright in TypeScript.
- Its purpose is to provide a reusable, configurable testing suite for both UI (Page Object Model) and REST API testing, with schema validation, custom fixtures, environment management, and CI/CD integration.

##### File structure
- Top-level “fixtures” folder holds custom fixtures for API and POM layers.
- “pages/clientSite” contains Page Object classes encapsulating UI interactions.
- “tests/API” and “tests/clientSite” contain the specs for API and UI tests respectively.
- “test-data” holds JSON files used to parameterize tests.
- Playwright configuration and environment (.env) files drive test setup.
- “.github/workflows” defines three CI pipelines (container, custom runner, default runner).

##### README for additional insights
- Uses Page Object Model pattern for UI.
- Supports REST API testing + Zod schema validation.
- Environment variables configurable per environment (.env.dev, etc.).
- npm scripts define grouped test runs (smoke, regression, full suite).
- GitHub Actions stages smoke → sanity → API → regression, with artifacts.

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph "Configuration"
    Env[".env/.env.{env} files"]:::config
    PWConfig["playwright.config.ts"]:::config
  end

  subgraph "Test Runner"
    Runner["Playwright Engine & Vitest"]:::code
    AuthSetup["Test Setup & Hooks"]:::code
  end

  subgraph "Custom Fixtures"
    POMFixture["POM Fixture Module"]:::code
    TestOptions["Test Options"]:::code
    APIRequest["API Request Fixture"]:::code
    PlainFunc["Plain Function"]:::code
    Schemas["Zod Schemas"]:::code
    TypeGuards["Type Guards"]:::code
  end

  subgraph "Test Data"
    ArticleData["articleData.json"]:::code
    InvalidCred["invalidCredentials.json"]:::code
  end

  subgraph "Layers"
    subgraph "UI Testing Layer"
      ArticlePage["ArticlePage"]:::code
      HomePage["HomePage"]:::code
      NavPage["NavPage"]:::code
      UITest1["article.spec.ts"]:::code
      UITest2["home.spec.ts"]:::code
      UITest3["nav.spec.ts"]:::code
    end
    subgraph "API Testing Layer"
      APITest1["article.spec.ts"]:::code
      APITest2["authentication.spec.ts"]:::code
    end
  end

  subgraph "External Systems"
    WebApp["Client Website"]:::external
    API["API Endpoints"]:::external
  end

  subgraph "CI/CD Pipelines"
    ContainerCI["playwright-container.yml"]:::ci
    CustomRunnerCI["playwright-custom-runner.yml"]:::ci
    DefaultRunnerCI["playwright-runner.yml"]:::ci
  end

  subgraph "Reporting"
    Reports["Test Reports & Artifacts"]:::external
  end

  Runner -->|loads config| PWConfig
  Runner -->|loads env| Env
  Runner -->|initializes| AuthSetup
  AuthSetup --> Runner

  Runner -->|uses fixtures| POMFixture
  Runner -->|uses fixtures| APIRequest
  Runner -->|uses fixtures| PlainFunc
  Runner -->|uses fixtures| Schemas
  Runner -->|uses fixtures| TypeGuards

  Runner -->|reads data| ArticleData
  Runner -->|reads data| InvalidCred

  POMFixture --> ArticlePage
  POMFixture --> HomePage
  POMFixture --> NavPage
  TestOptions --> Runner

  ArticleData --> ArticlePage
  ArticleData --> APITest1
  InvalidCred --> APITest2

  Runner -->|executes| UITest1
  Runner -->|executes| UITest2
  Runner -->|executes| UITest3
  Runner -->|executes| APITest1
  Runner -->|executes| APITest2

  ArticlePage -->|interacts| WebApp
  HomePage -->|interacts| WebApp
  NavPage -->|interacts| WebApp

  APITest1 -->|HTTP request| API
  APITest2 -->|HTTP request| API
  APITest1 -->|validate via schemas| Schemas
  APITest2 -->|validate via schemas| Schemas

  Runner -->|triggers| ContainerCI
  Runner -->|triggers| CustomRunnerCI
  Runner -->|triggers| DefaultRunnerCI

  ContainerCI -->|uploads| Reports
  CustomRunnerCI -->|uploads| Reports
  DefaultRunnerCI -->|uploads| Reports

  click PWConfig "https://github.com/idavidov13/playwright-framework/blob/main/playwright.config.ts"
  click AuthSetup "https://github.com/idavidov13/playwright-framework/blob/main/tests/auth.setup.ts"
  click ArticlePage "https://github.com/idavidov13/playwright-framework/blob/main/pages/clientSite/articlePage.ts"
  click HomePage "https://github.com/idavidov13/playwright-framework/blob/main/pages/clientSite/homePage.ts"
  click NavPage "https://github.com/idavidov13/playwright-framework/blob/main/pages/clientSite/navPage.ts"
  click APIRequest "https://github.com/idavidov13/playwright-framework/blob/main/fixtures/api/api-request-fixture.ts"
  click PlainFunc "https://github.com/idavidov13/playwright-framework/blob/main/fixtures/api/plain-function.ts"
  click Schemas "https://github.com/idavidov13/playwright-framework/blob/main/fixtures/api/schemas.ts"
  click TypeGuards "https://github.com/idavidov13/playwright-framework/blob/main/fixtures/api/types-guards.ts"
  click APITest1 "https://github.com/idavidov13/playwright-framework/blob/main/tests/API/article.spec.ts"
  click APITest2 "https://github.com/idavidov13/playwright-framework/blob/main/tests/API/authentication.spec.ts"
  click POMFixture "https://github.com/idavidov13/playwright-framework/blob/main/fixtures/pom/page-object-fixture.ts"
  click TestOptions "https://github.com/idavidov13/playwright-framework/blob/main/fixtures/pom/test-options.ts"
  click ArticleData "https://github.com/idavidov13/playwright-framework/blob/main/test-data/articleData.json"
  click InvalidCred "https://github.com/idavidov13/playwright-framework/blob/main/test-data/invalidCredentials.json"
  click ContainerCI "https://github.com/idavidov13/playwright-framework/blob/main/.github/workflows/playwright-container.yml"
  click CustomRunnerCI "https://github.com/idavidov13/playwright-framework/blob/main/.github/workflows/playwright-custom-runner.yml"
  click DefaultRunnerCI "https://github.com/idavidov13/playwright-framework/blob/main/.github/workflows/playwright-runner.yml"
  click UITest1 "https://github.com/idavidov13/playwright-framework/blob/main/tests/clientSite/article.spec.ts"
  click UITest2 "https://github.com/idavidov13/playwright-framework/blob/main/tests/clientSite/home.spec.ts"
  click UITest3 "https://github.com/idavidov13/playwright-framework/blob/main/tests/clientSite/nav.spec.ts"

  classDef code fill:#D0E8FF,stroke:#0366D6,color:#0366D6
  classDef external fill:#D4F8D4,stroke:#28A745,color:#28A745
  classDef config fill:#FFE4B5,stroke:#FF8C00,color:#FF8C00
  classDef ci fill:#EAD1DC,stroke:#A040A0,color:#A040A0
```
