# inderbir001/practicesoftwaretesting architecture

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

- Interactive diagram: https://gitdiagram.com/inderbir001/practicesoftwaretesting
- Repository: https://github.com/inderbir001/practicesoftwaretesting

## Overview

This is **not** an application you deploy; it’s a **Playwright + TypeScript end-to-end (E2E) test automation framework** targeting the external site **https://practicesoftwaretesting.com/**.

The architecture you want to capture is therefore:
- How tests are organized and executed (Playwright runner, projects/browsers, config)
- How tests interact with the AUT (Application Under Test) via **Page Object Model (POM)**
- How reporting/artifacts work (HTML report, screenshots/videos on failure)
- How the **custom AI reporter** integrates with **Ollama** to analyze failures
- How CI runs the same pipeline in GitHub Actions

So your “system” is the **test harness + its integrations**, not the website being tested (treat the website as an external dependency).

##### File structure analysis → map folders to components
From the tree:

##### Core framework / shared abstractions
- `base/basePage.ts`
Likely provides shared page functionality (navigation, waits, common selectors, helpers). This is the base layer of the POM.

##### Page Objects (POM layer)
- `pages/**`
Represents screen/page abstractions and flows:
- `pages/homePage.ts`, `pages/contactPage.ts`
- `pages/Catagories/*` (hand tools, power tools, rentals, etc.)
- `pages/sign_In_Page/*` (register, forgot password, sign in)

##### Tests (specs)
- `tests/Sign In/*.spec.ts`

##### AI failure analysis integration
- `ai/aiReporter.ts`
Custom Playwright reporter implementation.
- `ai/ollama.ts`
Client wrapper to call local Ollama HTTP API (likely).

This is a major architectural differentiator; show it prominently as an optional path gated by env var.

##### Configuration / orchestration
- `playwright.config.ts`
Defines projects (Chromium/Firefox/WebKit), reporters, artifacts, timeouts, etc.
- `package.json`, `package-lock.json`
Execution scripts/dependencies (Playwright, dotenv, faker, etc.)

- `.github/workflows/playwright.yml`
The pipeline that installs deps/browsers and runs `npx playwright test`.

##### README insights to encode
Key behaviors called out explicitly:
- Cross-browser execution (Chromium, Firefox, WebKit) → model as “runner spawns projects”
- Artifacts on failure: HTML report, screenshots, videos
- AI Reporter:
- Triggered on failure
- Collects error + stack trace
- Sends to **local** Ollama instance
- Prints analysis + suggested fix to console
- Controlled via `.env` variable `AI_ENABLED=true` (dotenv)

##### Developer / CI Trigger
- Developer runs locally (`npx playwright test`)
- GitHub Actions triggers on push/PR

##### Playwright Test Runner
- Reads `playwright.config.ts`
- Loads reporters
- Creates browser projects

##### Browser Projects
- Chromium
- Firefox
- WebKit
(Optionally show as parallel lanes)

##### Test Specs
- `tests/Sign In/*.spec.ts` (and future suites)
- These import and orchestrate Page Objects

##### Page Object Model (POM) Layer
- `pages/**`
- Depends on `base/basePage.ts`

##### Application Under Test (External)
- `https://practicesoftwaretesting.com/`
- As an external system boundary

##### Reporting & Artifacts
- HTML report (`playwright-report`)
- Screenshots/videos/traces (if enabled in config)

##### AI Failure Analysis (Optional)
- `ai/aiReporter.ts` (reporter)
- `ai/ollama.ts` (client)
- **Ollama Local Service** (external process on localhost)
- Model `qwen2.5-coder:7b`

##### Environment Configuration
- `.env` via dotenv
- `AI_ENABLED` toggles AI path

##### GitHub Actions Workflow
- `.github/workflows/playwright.yml`
- Installs Node deps, installs Playwright browsers, runs tests, uploads artifacts (if configured)

**Execution flow**
- Developer/CI → `npx playwright test` → Playwright Test Runner
- Runner → loads `playwright.config.ts` → spawns Browser Projects
- Runner → executes Test Specs → calls Page Objects → uses BasePage helpers
- Browser Projects ↔ AUT (HTTP interactions via browser automation)

**Failure/reporting flow**
- Runner → Reporters
- On failure: Runner → Artifact capture (screenshots/video/trace) → saved to report output
- On failure (conditional): Runner → `aiReporter.ts`
- `aiReporter.ts` → prompt w/ error + stack trace → `ollama.ts`
- `ollama.ts` → Ollama service (localhost) → returns analysis
- `aiReporter.ts` → prints analysis to console (and/or attaches to report, if implemented)

**Configuration gating**
- `.env`/dotenv → controls whether AI reporter is active (`AI_ENABLED=true`)

##### Architectural patterns / design principles
- **Page Object Model**: tests are thin; selectors/actions live in `pages/**`
- **Shared base class**: `BasePage` centralizes common behavior
- **Pluggable reporting**: Playwright reporters + custom AI reporter
- **Environment-driven behavior**: AI analysis toggled via env var
- **CI parity**: same command locally and in GitHub Actions

- Playwright Test Runner (Node.js)
- TypeScript
- dotenv
- GitHub Actions
- Ollama + model name

##### Suggested “best possible” component breakdown (don’t overthink; split more)
- `tests/Sign In/*` as a “Sign-In Test Suite”
- `pages/sign_In_Page/*` as “Auth POM”
- `pages/Catagories/*` as “Catalog POM”
- `base/basePage.ts` as “POM Base Utilities”
- `ai/aiReporter.ts` as “Custom Reporter: Failure Analyzer”
- `ai/ollama.ts` as “Ollama Client Adapter”
- `playwright.config.ts` as “Execution/Projects/Reporters Config”
- `.github/workflows/playwright.yml` as “CI Job: install → test”

That level of separation is ideal for accuracy and future maintenance.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% Triggers
  %% =========================
  subgraph "Triggers"
    Dev["Developer (Local CLI)"]:::trigger
    GHA["GitHub Actions Runner"]:::ci
    WF["CI Workflow: Playwright Job"]:::ci
  end

  %% =========================
  %% E2E Test Framework (Repo)
  %% =========================
  subgraph "E2E Test Framework (Playwright + TypeScript)"
    subgraph "Configuration & Tooling"
      PKG["NPM Scripts & Dependencies\n(Node.js + Playwright + TypeScript + dotenv + faker)"]:::tooling
      LOCK["Dependency Lockfile"]:::tooling
      CFG["Playwright Runner Configuration\n(projects/reporters/artifacts)"]:::tooling
      DOC["Documentation (Usage/Behavior)"]:::tooling
      ENV[".env (dotenv)\nAI_ENABLED=true/false"]:::tooling
      RUN["Playwright Test Runner\n(npx playwright test)"]:::runner
    end

    subgraph "Test Suites (Entry Points)"
      TESTS["tests/ (All Specs)"]:::code
      SIGNIN_SUITE["Sign-In Test Suite"]:::code
      SIGNIN_SPEC["signin.spec.ts"]:::code
      REGISTER_SPEC["register.spec.ts"]:::code
      FORGOT_SPEC["forgotYourPassword.spec.ts"]:::code
    end

    subgraph "POM Layer (Pages)"
      PAGES["pages/ (All Page Objects)"]:::code

      subgraph "General Pages"
        HOME["Home Page Object"]:::code
        CONTACT["Contact Page Object"]:::code
      end

      subgraph "Catalog POM (Categories)"
        CAT_DIR["pages/Catagories/"]:::code
        HAND["Hand Tools Page"]:::code
        POWER["Power Tools Page"]:::code
        RENTALS["Rentals Page"]:::code
        SPECIAL["Special Tools Page"]:::code
        OTHER["Other Category Page"]:::code
      end

      subgraph "Auth POM (Sign-In)"
        AUTH_DIR["pages/sign_In_Page/"]:::code
        AUTH_SIGNIN["Sign-In Page"]:::code
        AUTH_REGISTER["Register Page"]:::code
        AUTH_FORGOT["Forgot Password Page"]:::code
      end

      BASE["POM Base Utilities\n(BasePage)"]:::code
    end

    subgraph "Execution Targets (Projects/Browsers)"
      CHROMIUM["Project: Chromium"]:::browser
      FIREFOX["Project: Firefox"]:::browser
      WEBKIT["Project: WebKit"]:::browser
    end

    subgraph "Reporting & Artifacts"
      REP["Playwright Reporters\n(HTML + console)"]:::report
      HTML[("HTML Report\n(playwright-report/)")]:::artifact
      ART[("Artifacts on failure\n(screenshots/videos/traces)")]:::artifact
    end

    subgraph "AI Failure Analysis (Optional)"
      AIR["Custom Reporter: Failure Analyzer\n(Trigger: on failure)"]:::ai
      OLL["Ollama Client Adapter\n(HTTP wrapper)"]:::ai
      AIFLAG["Conditional Gate:\nAI_ENABLED=true"]:::note
      AIOUT["Console Output:\nAnalysis + Suggested Fix"]:::artifact
    end
  end

  %% =========================
  %% External Dependencies
  %% =========================
  subgraph "External Systems"
    AUT["Application Under Test (External)\nhttps://practicesoftwaretesting.com/"]:::external
    OLLAMA["Local Ollama Service (localhost)\nModel: qwen2.5-coder:7b"]:::external
  end

  %% =========================
  %% Control Flow (solid)
  %% =========================
  Dev -->|"runs npx playwright test"| RUN
  GHA -->|"triggers workflow (push/PR)"| WF
  WF -->|"installs deps & browsers"| PKG
  WF -->|"runs npx playwright test"| RUN

  RUN -->|"reads config"| CFG
  RUN -->|"loads reporters"| REP
  RUN -->|"spawns projects"| CHROMIUM
  RUN -->|"spawns projects"| FIREFOX
  RUN -->|"spawns projects"| WEBKIT

  CHROMIUM -->|"executes specs"| TESTS
  FIREFOX -->|"executes specs"| TESTS
  WEBKIT -->|"executes specs"| TESTS

  TESTS -->|"runs suite"| SIGNIN_SUITE
  SIGNIN_SUITE -->|"executes"| SIGNIN_SPEC
  SIGNIN_SUITE -->|"executes"| REGISTER_SPEC
  SIGNIN_SUITE -->|"executes"| FORGOT_SPEC

  %% =========================
  %% Dependency/Import (dashed)
  %% =========================
  SIGNIN_SPEC -.->|"imports/uses POM"| AUTH_SIGNIN
  REGISTER_SPEC -.->|"imports/uses POM"| AUTH_REGISTER
  FORGOT_SPEC -.->|"imports/uses POM"| AUTH_FORGOT

  SIGNIN_SPEC -.->|"may use test data"| PKG
  REGISTER_SPEC -.->|"may use test data"| PKG

  PAGES -.->|"contains"| HOME
  PAGES -.->|"contains"| CONTACT
  PAGES -.->|"contains"| CAT_DIR
  PAGES -.->|"contains"| AUTH_DIR

  HOME -.->|"extends/uses"| BASE
  CONTACT -.->|"extends/uses"| BASE
  HAND -.->|"extends/uses"| BASE
  POWER -.->|"extends/uses"| BASE
  RENTALS -.->|"extends/uses"| BASE
  SPECIAL -.->|"extends/uses"| BASE
  OTHER -.->|"extends/uses"| BASE
  AUTH_SIGNIN -.->|"extends/uses"| BASE
  AUTH_REGISTER -.->|"extends/uses"| BASE
  AUTH_FORGOT -.->|"extends/uses"| BASE

  CAT_DIR -.->|"contains"| HAND
  CAT_DIR -.->|"contains"| POWER
  CAT_DIR -.->|"contains"| RENTALS
  CAT_DIR -.->|"contains"| SPECIAL
  CAT_DIR -.->|"contains"| OTHER

  AUTH_DIR -.->|"contains"| AUTH_SIGNIN
  AUTH_DIR -.->|"contains"| AUTH_REGISTER
  AUTH_DIR -.->|"contains"| AUTH_FORGOT

  %% =========================
  %% Network/IO (thicker)
  %% =========================
  CHROMIUM ==>|"browser automation (HTTP/UI)"| AUT
  FIREFOX ==>|"browser automation (HTTP/UI)"| AUT
  WEBKIT ==>|"browser automation (HTTP/UI)"| AUT

  %% =========================
  %% Reporting flow
  %% =========================
  RUN -->|"publishes results"| REP
  REP -->|"generates"| HTML
  RUN -->|"captures on failure"| ART
  ART -->|"referenced by"| HTML

  %% =========================
  %% AI failure analysis (conditional)
  %% =========================
  ENV -.->|"controls"| AIFLAG
  AIFLAG -.->|"enables/disables"| AIR
  RUN -->|"on test failure"| AIR
  AIR -->|"builds prompt (error+stack)"| OLL
  OLL ==>|"HTTP call"| OLLAMA
  OLLAMA ==>|"analysis response"| OLL
  AIR -->|"prints"| AIOUT
  AIR -.->|"optional attach to report"| REP

  %% =========================
  %% Click events (mapped paths)
  %% =========================
  click CFG "https://github.com/inderbir001/practicesoftwaretesting/blob/main/playwright.config.ts"
  click PKG "https://github.com/inderbir001/practicesoftwaretesting/blob/main/package.json"
  click LOCK "https://github.com/inderbir001/practicesoftwaretesting/blob/main/package-lock.json"
  click BASE "https://github.com/inderbir001/practicesoftwaretesting/blob/main/base/basePage.ts"
  click PAGES "https://github.com/inderbir001/practicesoftwaretesting/tree/main/pages/"
  click HOME "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/homePage.ts"
  click CONTACT "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/contactPage.ts"
  click CAT_DIR "https://github.com/inderbir001/practicesoftwaretesting/tree/main/pages/Catagories/"
  click HAND "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/Catagories/handToolsPage.ts"
  click POWER "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/Catagories/powerToolsPage.ts"
  click RENTALS "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/Catagories/rentals.ts"
  click SPECIAL "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/Catagories/specialToolsPage.ts"
  click OTHER "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/Catagories/otherPage.ts"
  click AUTH_DIR "https://github.com/inderbir001/practicesoftwaretesting/tree/main/pages/sign_In_Page/"
  click AUTH_SIGNIN "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/sign_In_Page/singInPage.ts"
  click AUTH_REGISTER "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/sign_In_Page/registerPage.ts"
  click AUTH_FORGOT "https://github.com/inderbir001/practicesoftwaretesting/blob/main/pages/sign_In_Page/forgotPassword.ts"
  click TESTS "https://github.com/inderbir001/practicesoftwaretesting/tree/main/tests/"
  click SIGNIN_SUITE "https://github.com/inderbir001/practicesoftwaretesting/tree/main/tests/Sign In/"
  click SIGNIN_SPEC "https://github.com/inderbir001/practicesoftwaretesting/blob/main/tests/Sign In/signin.spec.ts"
  click REGISTER_SPEC "https://github.com/inderbir001/practicesoftwaretesting/blob/main/tests/Sign In/register.spec.ts"
  click FORGOT_SPEC "https://github.com/inderbir001/practicesoftwaretesting/blob/main/tests/Sign In/forgotYourPassword.spec.ts"
  click AIR "https://github.com/inderbir001/practicesoftwaretesting/blob/main/ai/aiReporter.ts"
  click OLL "https://github.com/inderbir001/practicesoftwaretesting/blob/main/ai/ollama.ts"
  click WF "https://github.com/inderbir001/practicesoftwaretesting/blob/main/.github/workflows/playwright.yml"
  click DOC "https://github.com/inderbir001/practicesoftwaretesting/blob/main/README.md"

  %% =========================
  %% Styles
  %% =========================
  classDef trigger fill:#E3F2FD,stroke:#1565C0,color:#0D47A1,stroke-width:1px
  classDef ci fill:#E8F5E9,stroke:#2E7D32,color:#1B5E20,stroke-width:1px
  classDef tooling fill:#ECEFF1,stroke:#546E7A,color:#263238,stroke-width:1px
  classDef runner fill:#CFD8DC,stroke:#37474F,color:#102027,stroke-width:2px
  classDef code fill:#BBDEFB,stroke:#1E88E5,color:#0D47A1,stroke-width:1px
  classDef browser fill:#D1C4E9,stroke:#5E35B1,color:#311B92,stroke-width:1px
  classDef report fill:#FFF3E0,stroke:#EF6C00,color:#E65100,stroke-width:1px
  classDef artifact fill:#FFE0B2,stroke:#FB8C00,color:#E65100,stroke-width:1px
  classDef ai fill:#F8BBD0,stroke:#C2185B,color:#880E4F,stroke-width:1px
  classDef external fill:#FFCCBC,stroke:#D84315,color:#BF360C,stroke-width:2px
  classDef note fill:#FFFDE7,stroke:#F9A825,color:#7A5C00,stroke-width:1px,stroke-dasharray: 4 3
```
