# mahiteja/playwright-e2e-framework architecture

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

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

## Overview

This TypeScript Playwright framework supports API and browser automation through separate fixture tracks. In the API workflow, a test uses an environment-configured request context and typed Users client to call a REST service, then applies response matchers and schema checks. In the web workflow, a test receives a page object, interacts with the TodoMVC browser app, and checks results. The graph shows the sampled runtime wiring; README-documented capabilities with unsampled implementations are marked as unverified where needed.

Main entry points: [`lib/api-fixtures.ts`](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/api-fixtures.ts) (API fixtures), [`lib/utils/resourceLoader.ts`](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/utils/resourceLoader.ts) (Resource loader), [`lib/clients/UsersClient.ts`](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/clients/UsersClient.ts) (Users client), [`lib/base/ApiClient.ts`](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/base/ApiClient.ts) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API runtime"]
  node_api_fixtures["API fixtures<br/>[api-fixtures.ts]"]
  node_users_client["Users client<br/>[UsersClient.ts]"]
  node_api_client["HTTP client<br/>[ApiClient.ts]"]
  node_matchers["API matchers<br/>[customMatchers.ts]"]
end

subgraph group_support["Shared support"]
  node_user_schema["User schema<br/>[userSchema.ts]"]
  node_env_loader["Environment loader<br/>[envLoader.ts]"]
  node_resource_loader["Resource loader<br/>[resourceLoader.ts]"]
  node_header_loader["Header adapter<br/>[headerLoader.ts]"]
end

subgraph group_web["Browser runtime"]
  node_web_fixtures["Web fixtures<br/>[web-fixtures.ts]"]
  node_todo_page["Todo page object<br/>[TodoPage.ts]"]
end

subgraph group_auth["Auth and resources"]
  node_header_files["Header bundles"]
  node_payload_files["User payloads"]
  node_auth_helpers["Bearer helpers<br/>[bearerAuth.ts]"]
  node_oauth_helpers["OAuth grants<br/>[oauth2.ts]"]
  node_mtls_helpers["mTLS options<br/>[mtls.ts]"]
end

node_api_actor(("API test"))
node_rest_service{{"REST API"}}
node_token_service{{"OAuth token service"}}
node_web_actor(("Web test"))
node_browser_app{{"TodoMVC app"}}

node_api_actor -->|"uses"| node_api_fixtures
node_api_fixtures -->|"loads settings"| node_env_loader
node_api_fixtures -->|"loads headers"| node_header_loader
node_header_loader -->|"re-exports"| node_resource_loader
node_resource_loader -->|"reads YAML"| node_header_files
node_resource_loader -->|"reads JSON"| node_payload_files
node_api_fixtures -->|"provides"| node_users_client
node_api_fixtures -->|"registers"| node_matchers
node_users_client -->|"extends"| node_api_client
node_api_client -->|"sends requests"| node_rest_service
node_matchers -.->|"validates with"| node_user_schema
node_api_actor -.->|"uses as needed"| node_auth_helpers
node_api_actor -.->|"requests token"| node_oauth_helpers
node_oauth_helpers -->|"exchanges grant"| node_token_service
node_api_actor -.->|"uses as needed"| node_mtls_helpers
node_web_actor -->|"uses"| node_web_fixtures
node_web_fixtures -->|"injects page"| node_todo_page
node_todo_page -->|"drives UI"| node_browser_app

click node_api_fixtures "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/api-fixtures.ts"
click node_users_client "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/clients/UsersClient.ts"
click node_api_client "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/base/ApiClient.ts"
click node_matchers "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/matchers/customMatchers.ts"
click node_user_schema "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/schemas/userSchema.ts"
click node_env_loader "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/utils/envLoader.ts"
click node_resource_loader "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/utils/resourceLoader.ts"
click node_header_loader "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/utils/headerLoader.ts"
click node_header_files "https://github.com/mahiteja/playwright-e2e-framework/tree/main/resources/headers"
click node_payload_files "https://github.com/mahiteja/playwright-e2e-framework/tree/main/resources/payloads/users"
click node_auth_helpers "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/auth/bearerAuth.ts"
click node_oauth_helpers "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/auth/oauth2.ts"
click node_mtls_helpers "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/auth/mtls.ts"
click node_web_fixtures "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/web-fixtures.ts"
click node_todo_page "https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/pages/TodoPage.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api_fixtures,node_users_client,node_api_client,node_matchers toneBlue
class node_user_schema,node_env_loader,node_resource_loader,node_header_loader toneAmber
class node_web_fixtures,node_todo_page,node_api_actor,node_rest_service toneMint
class node_header_files,node_payload_files,node_auth_helpers,node_oauth_helpers,node_mtls_helpers toneRose
class node_token_service,node_web_actor,node_browser_app toneIndigo
```

## Components

### API runtime

- [API fixtures](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/api-fixtures.ts): `lib/api-fixtures.ts`
- [Users client](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/clients/UsersClient.ts): `lib/clients/UsersClient.ts`
- [HTTP client](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/base/ApiClient.ts): `lib/base/ApiClient.ts`
- [API matchers](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/matchers/customMatchers.ts): `lib/matchers/customMatchers.ts`

### Shared support

- [User schema](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/schemas/userSchema.ts): `lib/schemas/userSchema.ts`
- [Environment loader](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/utils/envLoader.ts): `lib/utils/envLoader.ts`
- [Resource loader](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/utils/resourceLoader.ts): `lib/utils/resourceLoader.ts`
- [Header adapter](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/utils/headerLoader.ts): `lib/utils/headerLoader.ts`

### Browser runtime

- [Web fixtures](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/web-fixtures.ts): `lib/web-fixtures.ts`
- [Todo page object](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/pages/TodoPage.ts): `lib/pages/TodoPage.ts`

### Auth and resources

- [Header bundles](https://github.com/mahiteja/playwright-e2e-framework/tree/main/resources/headers): `resources/headers`
- [User payloads](https://github.com/mahiteja/playwright-e2e-framework/tree/main/resources/payloads/users): `resources/payloads/users`
- [Bearer helpers](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/auth/bearerAuth.ts): `lib/auth/bearerAuth.ts`
- [OAuth grants](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/auth/oauth2.ts): `lib/auth/oauth2.ts`
- [mTLS options](https://github.com/mahiteja/playwright-e2e-framework/blob/main/lib/auth/mtls.ts): `lib/auth/mtls.ts`

### Other components

- **API test**
- **REST API**
- **OAuth token service**
- **Web test**
- **TodoMVC app**

## Connections

- API test → API fixtures: uses (evidence: `README.md`)
- API fixtures → Environment loader: loads settings (evidence: `lib/api-fixtures.ts`)
- API fixtures → Header adapter: loads headers (evidence: `lib/api-fixtures.ts`)
- Header adapter → Resource loader: re-exports (evidence: `lib/utils/headerLoader.ts`)
- Resource loader → Header bundles: reads YAML (evidence: `lib/utils/resourceLoader.ts`)
- Resource loader → User payloads: reads JSON (evidence: `lib/utils/resourceLoader.ts`)
- API fixtures → Users client: provides (evidence: `lib/api-fixtures.ts`)
- API fixtures → API matchers: registers (evidence: `lib/api-fixtures.ts`)
- Users client → HTTP client: extends (evidence: `lib/clients/UsersClient.ts`)
- HTTP client → REST API: sends requests (evidence: `lib/base/ApiClient.ts`)
- API matchers → User schema: validates with (evidence: `README.md`)
- API test → Bearer helpers: uses as needed (evidence: `README.md`)
- API test → OAuth grants: requests token (evidence: `README.md`)
- OAuth grants → OAuth token service: exchanges grant (evidence: `lib/auth/oauth2.ts`)
- API test → mTLS options: uses as needed (evidence: `README.md`)
- Web test → Web fixtures: uses (evidence: `README.md`)
- Web fixtures → Todo page object: injects page (evidence: `lib/web-fixtures.ts`)
- Todo page object → TodoMVC app: drives UI (evidence: `lib/pages/TodoPage.ts`)
