# elianamendez/specialization_at_js_results_reporting architecture

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

- Interactive diagram: https://gitdiagram.com/elianamendez/specialization_at_js_results_reporting
- Repository: https://github.com/elianamendez/specialization_at_js_results_reporting

## Overview

##### What this project is (type + purpose)
From the file tree, this is a **Node.js-based automated testing project** built around **Playwright**. It contains:
- **UI end-to-end tests** (`src/tests/ui/*.spec.js`) using a **Page Object Model** (`src/pages/*Page.js`)
- **API tests** (`src/tests/api/*.spec.js`) using a shared **API client** (`src/utils/apiClient.js`)
- **Test data construction utilities** (`src/utils/dataBuilder.js`)
- Playwright + runner configuration (`playwright.config.js`, `package.json`, `package-lock.json`)

##### How to read the structure (architecture clues in the tree)
Key architectural signals:

##### Test suites split by modality
- `src/tests/ui/…` = UI/E2E flows (browser-driven)
- `src/tests/api/…` = API-only verification (HTTP client-driven)

This implies two primary execution paths that share some utilities but interact with the **System Under Test (SUT)** differently.

##### Page Object Model (POM)
- `src/pages/BasePage.js`
- `src/pages/HomePage.js`
- `src/pages/BookingPage.js`

This implies UI tests should be diagrammed as: **Spec → Page Objects → Browser/DOM → Web App**.

##### Shared utilities
- `src/utils/apiClient.js` = centralizes HTTP calls, auth headers, base URL, etc.
- `src/utils/dataBuilder.js` = builds request payloads / test fixtures

This implies API tests: **Spec → dataBuilder → apiClient → Booking API** (and possibly shared usage from UI tests too, e.g., setup/cleanup).

##### Tooling/runtime
- `playwright.config.js` = test runner config (projects/browsers, baseURL, reporter, timeouts, retries, trace/video, etc.)
- `package.json` = scripts, dependencies

##### What the “system” is for diagramming purposes
A common mistake is diagramming only the app under test; here the “system” is **the test automation system** plus its dependencies.

##### System Under Test
- Web UI (Home/Booking pages)
- Booking API (endpoints used by `booking.spec.js`)
- Data store behind the API/UI (even if unknown, represent as “DB”)
##### Outputs: Playwright reports / artifacts (HTML report, traces, screenshots)

- “Run tests” (CI/Engineer → Playwright Runner)
- “Browser automation (CDP/WebDriver-like)” (Runner → Browsers)
- “HTTP REST calls (JSON)” (apiClient → Booking API)
- “Test data payload creation” (spec → dataBuilder)
- “Page Object method calls” (spec → HomePage/BookingPage)
- “Artifacts: html report, trace.zip, screenshot.png” (Runner → Output)

##### Architectural patterns / design principles evident here

- **Page Object Model (POM)**: separation of test intent (spec) from UI selectors/actions (pages)
- **Separation of concerns between UI and API tests**: `src/tests/ui` vs `src/tests/api`
- **Reusable infrastructure utilities**: shared `apiClient` and `dataBuilder`
- **Configuration-driven execution**: Playwright behavior controlled by `playwright.config.js`

##### Abstraction layers
- UI Specs → Pages → Playwright → Browser → Web App
- API Specs → dataBuilder/apiClient → Booking API
##### Where the truth is

- “Playwright Report” as a first-class component; this repo’s name references results reporting.

Use consistent visual semantics:

##### Clear labels for each component
Examples:
- “UI tests: src/tests/ui/*.spec.js”
- “POM layer: src/pages/*Page.js”
- “API client: src/utils/apiClient.js”
- “SUT: Booking API”
- “Artifacts: HTML report / traces / screenshots”

Good: “calls”, “sends HTTP request”, “drives browser”, “writes report”

- `playwright.config.js` (runner configuration)
- `src/tests/ui/home.spec.js`
- `src/tests/ui/booking.spec.js`
- `src/tests/api/booking.spec.js`
- `src/pages/BasePage.js`
- `src/pages/HomePage.js`
- `src/pages/BookingPage.js`
- `src/utils/apiClient.js`
- `src/utils/dataBuilder.js`
- `package.json` (scripts/deps)

##### Don’t overthink it: separate into many components
Given the small repo, it’s better to be explicit than abstract:

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% Diagram A — System Context
  %% =========================
  subgraph "Diagram A — System Context (C4-style)"
    direction TB

    A1["Engineer / CI Runner"]:::actor

    subgraph "Test Harness (this repo)"
      direction TB
      A2["Playwright Test Suite (Node.js)"]:::internal
      A2c["Playwright Runner + Reporter"]:::internal
      A2 -->|"executes"| A2c
    end

    subgraph "System Under Test (external)"
      direction TB
      A3(("Web Application (UI)")):::external
      A4(("Booking API")):::external
      A5[("Database")]:::datastore
      A3 <-->|"UIcallsAPI"| A4
      A4 <-->|"read/write"| A5
    end

    A6["Reports & Artifacts\n(HTML report / traces / screenshots / videos)"]:::artifact

    A1 -->|"Runtests"| A2
    A2c -->|"Browserautomation"| A3
    A2c -->|"HTTPREST(JSON)"| A4
    A2c -->|"writes"| A6
  end

  %% ==================================
  %% Diagram B — Repo Container / Module
  %% ==================================
  subgraph "Diagram B — Repo Container/Module (inside this repository)"
    direction TB

    subgraph "Test Runner + Config"
      direction TB
      B1["playwright.config.js"]:::config
      B2["package.json\n(scripts/deps)"]:::config
      B3["package-lock.json"]:::config
      B4["Playwright Runner + Reporter"]:::internal
      B2 -->|"npm/npxlaunch"| B4
      B1 -->|"configures"| B4
      B3 -->|"locksdeps"| B2
    end

    subgraph "UI Test Suite (src/tests/ui)"
      direction TB
      B5["UI suite folder\nsrc/tests/ui/"]:::internal
      B6["home.spec.js"]:::test
      B7["booking.spec.js (UI)"]:::test
      B5 -->|"contains"| B6
      B5 -->|"contains"| B7
    end

    subgraph "API Test Suite (src/tests/api)"
      direction TB
      B8["API suite folder\nsrc/tests/api/"]:::internal
      B9["booking.spec.js (API)"]:::test
      B8 -->|"contains"| B9
    end

    subgraph "Page Object Layer (POM) (src/pages)"
      direction TB
      B10["POM layer folder\nsrc/pages/"]:::internal
      B11["BasePage.js"]:::pom
      B12["HomePage.js"]:::pom
      B13["BookingPage.js"]:::pom
      B10 -->|"contains"| B11
      B10 -->|"contains"| B12
      B10 -->|"contains"| B13
      B12 -->|"extends/uses"| B11
      B13 -->|"extends/uses"| B11
    end

    subgraph "Utilities (src/utils)"
      direction TB
      B14["apiClient.js"]:::util
      B15["dataBuilder.js"]:::util
    end

    B6 -->|"PageObjectmethods"| B12
    B7 -->|"PageObjectmethods"| B12
    B7 -->|"PageObjectmethods"| B13

    B9 -->|"Testdatapayloadcreation"| B15
    B9 -->|"HTTPcalls"| B14

    B7 -.->|"optionalsetup/cleanup"| B14
    B7 -.->|"optionalfixtures"| B15

    B6 -->|"executedby"| B4
    B7 -->|"executedby"| B4
    B9 -->|"executedby"| B4

    B4 -->|"outputs"| B16["Reports & Artifacts\n(HTML report / traces / screenshots)"]:::artifact

    B17["Note: Patterns\n- Page Object Model (POM)\n- UIvsAPIseparation\n- ReusableapiClient/dataBuilder\n- Config-drivenexecution"]:::note
  end

  %% ======================================
  %% Diagram C — Key Runtime Sequence Flows
  %% ======================================
  subgraph "Diagram C — Key Sequence Flows (runtime call order)"
    direction TB

    subgraph "C1 — UI Booking Flow"
      direction TB
      C1a["ui/booking.spec.js"]:::test
      C1b["HomePage"]:::pom
      C1c["BookingPage"]:::pom
      C1d["Playwright page/browser"]:::runtime
      C1e(("Browser (Chromium/WebKit/Firefox)")):::external
      C1f(("Web Application (UI)")):::external
      C1g(("Booking API")):::external
      C1h["Artifacts on failure\n(screenshot/trace/video)"]:::artifact

      C1a -->|"calls"| C1b
      C1a -->|"calls"| C1c
      C1b -->|"usesselectors/actions"| C1d
      C1c -->|"usesselectors/actions"| C1d
      C1d -->|"drives"| C1e
      C1e -->|"renders/requests"| C1f
      C1f -.->|"maycall"| C1g
      C1d -->|"assertsUIstate"| C1a
      C1a -->|"onfailurewrites"| C1h
    end

    subgraph "C2 — API Booking Flow"
      direction TB
      C2a["api/booking.spec.js"]:::test
      C2b["dataBuilder"]:::util
      C2c["apiClient"]:::util
      C2d(("Booking API")):::external
      C2e[("Database")]:::datastore
      C2f["Report output"]:::artifact

      C2a -->|"buildpayload"| C2b
      C2a -->|"sendrequest"| C2c
      C2c -->|"HTTPREST(JSON)"| C2d
      C2d -->|"read/write"| C2e
      C2d -->|"response"| C2c
      C2c -->|"data"| C2a
      C2a -->|"asserts"| C2a
      C2a -->|"writes"| C2f
    end
  end

  %% ============
  %% Click Events
  %% ============
  click B1 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/playwright.config.js"
  click B2 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/package.json"
  click B3 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/package-lock.json"
  click B5 "https://github.com/elianamendez/specialization_at_js_results_reporting/tree/main/src/tests/ui/"
  click B6 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/tests/ui/home.spec.js"
  click B7 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/tests/ui/booking.spec.js"
  click B8 "https://github.com/elianamendez/specialization_at_js_results_reporting/tree/main/src/tests/api/"
  click B9 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/tests/api/booking.spec.js"
  click B10 "https://github.com/elianamendez/specialization_at_js_results_reporting/tree/main/src/pages/"
  click B11 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/pages/BasePage.js"
  click B12 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/pages/HomePage.js"
  click B13 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/pages/BookingPage.js"
  click B14 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/utils/apiClient.js"
  click B15 "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/utils/dataBuilder.js"

  click C1a "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/tests/ui/booking.spec.js"
  click C2a "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/tests/api/booking.spec.js"
  click C2b "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/utils/dataBuilder.js"
  click C2c "https://github.com/elianamendez/specialization_at_js_results_reporting/blob/main/src/utils/apiClient.js"

  %% =========
  %% Styling
  %% =========
  classDef actor fill:#E6F7FF,stroke:#096DD9,stroke-width:2,color:#003A8C;
  classDef internal fill:#D6E4FF,stroke:#1D39C4,stroke-width:1.5,color:#10239E;
  classDef test fill:#ADC6FF,stroke:#2F54EB,stroke-width:1.5,color:#10239E;
  classDef pom fill:#B5F5EC,stroke:#08979C,stroke-width:1.5,color:#00474F;
  classDef util fill:#FFD6E7,stroke:#C41D7F,stroke-width:1.5,color:#9E1068;
  classDef config fill:#D9F7BE,stroke:#389E0D,stroke-width:1.5,color:#135200;
  classDef runtime fill:#FFF7E6,stroke:#FA8C16,stroke-width:1.5,color:#874D00;
  classDef external fill:#FFE7BA,stroke:#FA8C16,stroke-width:2,color:#874D00;
  classDef datastore fill:#F5F5F5,stroke:#595959,stroke-width:2,color:#262626;
  classDef artifact fill:#E6FFFB,stroke:#13C2C2,stroke-width:1.5,color:#006D75;
  classDef note fill:#FFF1F0,stroke:#CF1322,stroke-width:1.5,color:#820014;
```
