# bondar-academy/playwright-api-testing-framework architecture

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

- Interactive diagram: https://gitdiagram.com/bondar-academy/playwright-api-testing-framework
- Repository: https://github.com/bondar-academy/playwright-api-testing-framework

## Overview

This repository is a Playwright API-testing framework. Its principal workflow provisions a worker-scoped auth token, creates a fluent request client, sends API requests, and records request/response context for failures; custom matchers add equality and JSON-schema checks. The README also documents environment switching and schema generation. The sampled files show fixture wiring and internal calls, but not how the smoke test consumes the fixtures, so that connection is omitted.

Main entry points: [`utils/fixtures.ts`](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/fixtures.ts) (Playwright fixtures), [`helpers/createToken.ts`](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/helpers/createToken.ts) (Auth token creation), [`utils/request-handler.ts`](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/request-handler.ts) (Fluent request handler), [`utils/logger.ts`](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/logger.ts) (API logger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Configuration and fixtures"]
  node_fixtures["Playwright fixtures<br/>[fixtures.ts]"]
  node_config["Environment config<br/>[api-test.config.ts]"]
  node_token["Auth token creation<br/>[createToken.ts]"]
end

subgraph group_requests["API requests"]
  node_handler["Fluent request handler<br/>[request-handler.ts]"]
  node_logger["API logger<br/>[logger.ts]"]
end

subgraph group_validation["Assertions and schemas"]
  node_custom_expect["Custom matchers<br/>[custom-exptect.ts]"]
  node_validator["Schema validator"]
  node_schemas["Response schemas"]
end

node_test_suite(("API test suite<br/>[smokeTest.spec.ts]"))
node_environment(("TEST_ENV"))
node_api{{"Conduit API"}}

node_environment -->|"selects environment"| node_config
node_fixtures -->|"reads config"| node_config
node_fixtures -->|"creates worker token"| node_token
node_fixtures -->|"provides client"| node_handler
node_fixtures -->|"creates logger"| node_logger
node_fixtures -->|"sets matcher logger"| node_custom_expect
node_token -->|"uses credentials"| node_config
node_token -->|"sends login request"| node_handler
node_token -->|"creates logger"| node_logger
node_handler -->|"sends HTTP requests"| node_api
node_handler -->|"records activity"| node_logger
node_custom_expect -->|"validates schema"| node_validator
node_custom_expect -->|"adds failure context"| node_logger
node_validator -->|"reads or generates"| node_schemas

click node_test_suite "https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/tests/smokeTest.spec.ts"
click node_fixtures "https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/fixtures.ts"
click node_config "https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/api-test.config.ts"
click node_token "https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/helpers/createToken.ts"
click node_handler "https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/request-handler.ts"
click node_logger "https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/logger.ts"
click node_custom_expect "https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/custom-exptect.ts"
click node_validator "https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/schema-validator.ts"
click node_schemas "https://github.com/bondar-academy/playwright-api-testing-framework/tree/main/response-schemas"

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_fixtures,node_config,node_token toneBlue
class node_handler,node_logger toneAmber
class node_custom_expect,node_validator,node_schemas,node_test_suite,node_api toneMint
class node_environment toneIndigo
```

## Components

### Configuration and fixtures

- [Playwright fixtures](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/fixtures.ts): `utils/fixtures.ts`
- [Environment config](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/api-test.config.ts): `api-test.config.ts`
- [Auth token creation](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/helpers/createToken.ts): `helpers/createToken.ts`

### API requests

- [Fluent request handler](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/request-handler.ts): `utils/request-handler.ts`
- [API logger](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/logger.ts): `utils/logger.ts`

### Assertions and schemas

- [Custom matchers](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/custom-exptect.ts): `utils/custom-exptect.ts`
- [Schema validator](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/utils/schema-validator.ts): `utils/schema-validator.ts`
- [Response schemas](https://github.com/bondar-academy/playwright-api-testing-framework/tree/main/response-schemas): `response-schemas`

### Other components

- [API test suite](https://github.com/bondar-academy/playwright-api-testing-framework/blob/main/tests/smokeTest.spec.ts): `tests/smokeTest.spec.ts`
- **TEST_ENV**
- **Conduit API**

## Connections

- TEST_ENV → Environment config: selects environment (evidence: `api-test.config.ts`)
- Playwright fixtures → Environment config: reads config (evidence: `utils/fixtures.ts`)
- Playwright fixtures → Auth token creation: creates worker token (evidence: `utils/fixtures.ts`)
- Playwright fixtures → Fluent request handler: provides client (evidence: `utils/fixtures.ts`)
- Playwright fixtures → API logger: creates logger (evidence: `utils/fixtures.ts`)
- Playwright fixtures → Custom matchers: sets matcher logger (evidence: `utils/fixtures.ts`)
- Auth token creation → Environment config: uses credentials (evidence: `helpers/createToken.ts`)
- Auth token creation → Fluent request handler: sends login request (evidence: `helpers/createToken.ts`)
- Auth token creation → API logger: creates logger (evidence: `helpers/createToken.ts`)
- Fluent request handler → Conduit API: sends HTTP requests (evidence: `utils/request-handler.ts`)
- Fluent request handler → API logger: records activity (evidence: `utils/request-handler.ts`)
- Custom matchers → Schema validator: validates schema (evidence: `utils/custom-exptect.ts`)
- Custom matchers → API logger: adds failure context (evidence: `utils/custom-exptect.ts`)
- Schema validator → Response schemas: reads or generates (evidence: `utils/schema-validator.ts`)
