# raj-tester/test_automation_project architecture

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

- Interactive diagram: https://gitdiagram.com/raj-tester/test_automation_project
- Repository: https://github.com/raj-tester/test_automation_project

## Overview

##### Project type and purpose
- This is a full-stack authentication application that also doubles as a test automation project.
- Frontend: React SPA; Backend: Node.js/Express REST API; Persistence: local JSON file.
- Test layer: Playwright E2E tests organized by modules (login), page objects, API helpers, plus GitHub Actions CI and Allure reporting.

##### File structure
- Top-level folders:
- client/ – React app plus Playwright tests under client/tests, Playwright config, Allure results, HTML report
- server/ – Express API entry point (index.js), package.json
- .github/workflows/playwright.yml – CI job definition for running Playwright tests
- Test patterns:
- client/tests/modules/{login}/api & ui – separates API and UI spec files
- client/tests/page-objects – implements the Page Object Model
- client/tests/utils – shared API helper functions
- Build & run: package.json files in both client and server, npm start commands.

##### Key insights from README
- Describes the three-tier stack (React → Express → JSON file)
- Lists features (signup/login/logout, session cookies)
- Shows dev-setup steps and URLs.

##### Elements
- HTTP traffic (UI ↔ API)
- File I/O (API → JSON)
- Test execution flows (CI → Runner → Browser/API)
- Report generation (Runner → Allure)
- Blue for runtime components (SPA, API, DB)
- Green for test-automation components (Playwright, page objects)
- Orange for CI/CD and reporting (GitHub Actions, Allure)

##### Final recommendations
- Be as granular as it makes sense: e.g., optionally show separate UI and API test modules, or group them under “Playwright Tests”.
- Session management with “HTTP-only cookies” on the API boundary.
- Local JSON file persistence to underscore the lightweight DB choice.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (React SPA)"
        direction TB
        Browser["User Browser"]:::runtime
        ReactSrc["src (App.js, index.js)"]:::runtime
        ReactPublic["public (index.html)"]:::runtime
        ReactPkgClient["package.json"]:::runtime
    end

    %% Backend Layer
    subgraph "Backend (Express API)"
        direction TB
        ServerIndex["index.js"]:::runtime
        ServerPkg["package.json"]:::runtime
        DB["users.json (JSON File DB)"]:::runtime
    end

    %% Playwright Test Runner
    subgraph "Playwright Test Runner"
        direction TB
        PWConfig["playwright.config.js"]:::test
        PWPkgClient["package.json (test scripts)"]:::test

        subgraph "API Tests"
            direction TB
            LoginApiSpec["login-api.spec.js"]:::test
            ApiHelpers["api-helpers.js"]:::test
        end

        subgraph "UI Tests"
            direction TB
            LoginUISpec["login.spec.js"]:::test
            LoginPagePO["LoginPage.js"]:::test
            SignupPagePO["SignupPage.js"]:::test
        end
    end

    %% Reporting Service
    subgraph "Allure Reporting Service"
        direction TB
        AllureResults["allure-results"]:::ci
        AllureReport["index.html"]:::ci
    end

    %% CI/CD Pipeline
    CI["GitHub Actions CI"]:::ci

    %% Connections
    Browser -->|"serves static assets"| ReactSrc
    Browser --> ReactPublic
    ReactSrc --> ReactPkgClient
    ReactPublic --> ReactPkgClient

    ReactPkgClient -->|"HTTP requests (port 3000)"| ServerIndex
    ServerIndex -->|"read/write"| DB

    CI -->|"checkout & install"| ReactPkgClient
    CI -->|"checkout & install"| ServerPkg
    CI -->|"start client & server"| ReactPkgClient
    CI -->|"start client & server"| ServerIndex
    CI -->|"run tests"| PWConfig

    PWConfig --> LoginUISpec
    PWConfig --> LoginApiSpec
    LoginUISpec --> Browser
    LoginApiSpec --> ServerIndex
    ApiHelpers --> LoginApiSpec
    LoginPagePO --> LoginUISpec
    SignupPagePO --> LoginUISpec

    PWConfig --> AllureResults
    AllureResults --> AllureReport

    CI --> AllureReport

    %% Click Events
    click ReactSrc "https://github.com/raj-tester/test_automation_project/tree/main/client/src"
    click ReactPublic "https://github.com/raj-tester/test_automation_project/tree/main/client/public"
    click ReactPkgClient "https://github.com/raj-tester/test_automation_project/blob/main/client/package.json"
    click ServerIndex "https://github.com/raj-tester/test_automation_project/blob/main/server/index.js"
    click ServerPkg "https://github.com/raj-tester/test_automation_project/blob/main/server/package.json"
    click PWConfig "https://github.com/raj-tester/test_automation_project/blob/main/client/playwright.config.js"
    click PWPkgClient "https://github.com/raj-tester/test_automation_project/blob/main/client/package.json"
    click LoginApiSpec "https://github.com/raj-tester/test_automation_project/blob/main/client/tests/modules/login/api/login-api.spec.js"
    click ApiHelpers "https://github.com/raj-tester/test_automation_project/blob/main/client/tests/utils/api-helpers.js"
    click LoginUISpec "https://github.com/raj-tester/test_automation_project/blob/main/client/tests/modules/login/ui/login.spec.js"
    click LoginPagePO "https://github.com/raj-tester/test_automation_project/blob/main/client/tests/page-objects/LoginPage.js"
    click SignupPagePO "https://github.com/raj-tester/test_automation_project/blob/main/client/tests/page-objects/SignupPage.js"
    click AllureResults "https://github.com/raj-tester/test_automation_project/tree/main/client/allure-results"
    click AllureReport "https://github.com/raj-tester/test_automation_project/blob/main/client/playwright-report/index.html"
    click CI "https://github.com/raj-tester/test_automation_project/blob/main/.github/workflows/playwright.yml"

    %% Styles
    classDef runtime fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef test fill:#E2F0D9,stroke:#2E7D32,stroke-width:1px
    classDef ci fill:#FFE4B2,stroke:#E65100,stroke-width:1px
```
