# psalimath12/playwright-cura-test-automation architecture

> Architecture diagram of the GitHub repository psalimath12/playwright-cura-test-automation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/psalimath12/playwright-cura-test-automation
- Repository: https://github.com/psalimath12/playwright-cura-test-automation

## Overview

##### Project Type and Purpose
- Type: An end-to-end test automation framework (an open-source tool)
- Purpose: Automate and validate key workflows (login, appointment booking, logout) in the Katalon CURA Healthcare Service demo, using Playwright and the Page Object Model (POM).

##### File Structure
- pages/
- Defines Page Object Model classes (AppointmentPage.js, AppointmentSummaryPage.js, LoginPage.js).
- tests/ & tests-examples/
- tests/ contains suite-specific test specs (e.g., loginTest.spec.js).
- tests-examples/ shows demonstration specs (e.g., demo-todo-app.spec.js).
- playwright.config.js
- Configuration for browser projects (chromium, firefox, webkit), trace settings, reporters.
- package.json / package-lock.json
- Lists dependencies (playwright) and NPM scripts to run tests and reports.

##### README for Insights
- POM pattern for maintainability.
- Cross-browser support and HTML reporting.
- Debugging with Playwright Inspector and Trace Viewer.

##### Main Components & Relationships
a. Test Runner & CLI (npx playwright test)
b. Configuration (playwright.config.js, package.json scripts)
c. Test Suites (tests/*.spec.js)
d. Page Object Layer (pages/*.js)
e. Playwright Engine (browser drivers: Chromium, Firefox, WebKit)
f. System Under Test (remote Katalon CURA web application)
g. Reporting & Trace Module (HTML report generator, trace viewer)

Interaction Flow:
- Test Runner loads Config →
- Instantiates Browser Instances via Playwright Engine →
- Tests invoke Page Objects →
- Page Objects send browser commands (click, fill, navigate) to the CURA app →
- Browser Engine executes actions and returns responses →
- Test Runner captures results, errors, and optional trace →
- Reporting Module generates HTML reports & traces.

##### Architectural Patterns & Principles
- Page Object Model (Separation of concerns: UI selectors & actions in pages/, test logic in tests/)
- Configuration-driven cross-browser execution
- Modular, pluggable reporting & tracing
- NPM script orchestration for standardized CLI entry points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CLI and Configuration
    CLI["CLI Test Runner"]:::cli
    Config["Configuration\n(playwright.config.js)"]:::config
    Dependencies["Dependency Manifest\n(package-lock.json)"]:::config
    Metadata["Project Metadata\n(package.json)"]:::config

    %% Layers
    subgraph "Test Suites"
        direction TB
        LoginTest["Login Flow Test\n(tests/loginTest.spec.js)"]:::test
        DemoTest["Demo Todo Test\n(tests-examples/demo-todo-app.spec.js)"]:::test
    end

    subgraph "Page Object Model Layer"
        direction TB
        LoginPage["LoginPage.js"]:::page
        AppointmentPage["AppointmentPage.js"]:::page
        AppointmentSummaryPage["AppointmentSummaryPage.js"]:::page
    end

    %% Engine and External System
    PlaywrightEngine["Playwright Engine\n(Chromium, Firefox, WebKit)"]:::engine
    SUT["System Under Test\nKatalon CURA Demo"]:::external
    Reporter["Reporting & Trace Viewer"]:::reporter

    %% Interaction Flow
    CLI -->|"loads config"| Config
    CLI -->|"reads dependencies"| Dependencies
    CLI -->|"reads metadata"| Metadata
    CLI -->|"invokes tests"| LoginTest
    CLI -->|"invokes tests"| DemoTest

    LoginTest -->|"uses POM"| LoginPage
    LoginTest -->|"uses POM"| AppointmentPage
    LoginTest -->|"uses POM"| AppointmentSummaryPage
    DemoTest -->|"uses POM"| LoginPage
    DemoTest -->|"uses POM"| AppointmentPage
    DemoTest -->|"uses POM"| AppointmentSummaryPage

    LoginPage -->|"sends commands"| PlaywrightEngine
    AppointmentPage -->|"sends commands"| PlaywrightEngine
    AppointmentSummaryPage -->|"sends commands"| PlaywrightEngine

    PlaywrightEngine -->|"executes actions"| SUT
    SUT -->|"returns responses"| PlaywrightEngine

    CLI -->|"generates results"| Reporter
    Reporter -->|"reads trace settings"| Config

    %% Click Events
    click CLI "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/package.json"
    click Config "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/playwright.config.js"
    click Dependencies "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/package-lock.json"
    click Metadata "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/package.json"
    click LoginTest "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/tests/loginTest.spec.js"
    click DemoTest "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/tests-examples/demo-todo-app.spec.js"
    click LoginPage "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/pages/LoginPage.js"
    click AppointmentPage "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/pages/AppointmentPage.js"
    click AppointmentSummaryPage "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/pages/AppointmentSummaryPage.js"
    click Reporter "https://github.com/psalimath12/playwright-cura-test-automation/blob/master/playwright.config.js"

    %% Styles
    classDef cli fill:#f9f,stroke:#333,stroke-width:1px
    classDef config fill:#faa,stroke:#333,stroke-width:1px
    classDef test fill:#bbf,stroke:#333,stroke-width:1px
    classDef page fill:#8ef,stroke:#333,stroke-width:1px
    classDef engine fill:#bca,stroke:#333,stroke-width:1px
    classDef external fill:#afa,stroke:#333,stroke-width:1px
    classDef reporter fill:#d6b,stroke:#333,stroke-width:1px
```
