# ekanto/ecommerce-test architecture

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

- Interactive diagram: https://gitdiagram.com/ekanto/ecommerce-test
- Repository: https://github.com/ekanto/ecommerce-test

## Overview

##### Project type and purpose
- This is an automated testing suite (open-source tool) built with Playwright and Node.js, designed to validate the Next.js Commerce demo application.
- It includes E2E, regression, and smoke tests, cross-browser and mobile emulation, CI/CD integration, and rich reporting.

##### File structure
- Top-level components:
- `.github/workflows/test.yml` → CI/CD pipeline definition
- `playwright.config.js` → Test runner configuration
- `tests/e2e`, `tests/regression`, `tests/smoke` → Organized test suites
- `pages/*` → Page-model abstractions (landingPage.js, productPage.js)
- `screenshots/`, `test-results/` → Artifacts storage
- `package.json` → Scripts and dependencies
- Patterns:
- Layered architecture separating test orchestration, page abstractions, and CI workflows
- Single test runner (Playwright) driving multiple suites
- External system under test (the live Next.js Commerce app)

##### README for additional insights
- States baseURL (`https://demo.vercel.store`), parallel workers, retry strategy
- CI pipeline stages: Smoke → E2E → Regression → Report generation → Artifact upload
- Reporting outputs: HTML, JSON, JUnit, screenshots, video

a. Main components:
1. Test Runner (Playwright)
2. Test Suites (Smoke, E2E, Regression)
3. Page Models (landingPage.js, productPage.js)
4. CI/CD Pipeline (GitHub Actions)
5. Artifact Store (screenshots, videos, HTML reports)
6. Target Application (Next.js Commerce demo)
7. External Services (Browsers: Chromium, Firefox, WebKit)
b. Relationships & interactions:
- CI/CD triggers Playwright test runner on code push or PR
- Playwright reads `playwright.config.js` & page models, runs tests against the live demo URL
- During each test step, screenshots/videos are captured on failures
- On completion, reports and artifacts are generated and published back to GitHub (Actions tab, PR comments)
c. Architectural patterns & principles:
- Separation of concerns: configuration vs. test logic vs. page models
- Directory-based modularization of test suites
- CI pipeline orchestration with fail-fast on smoke tests, staged testing
- Use of external interfaces (baseURL, environment variables) for flexibility
d. Key technologies & frameworks:
- Node.js & npm for package management
- Playwright for cross-browser automation
- GitHub Actions for CI/CD
- HTML/JSON/JUnit reporters for results

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "CI/CD Pipeline"
        CI["CI/CD (GitHub Actions)"]:::ci
    end
    CI -->|triggers| Runner["Playwright Test Runner"]:::runner

    subgraph "Test Code"
        Config["playwright.config.js"]:::config
        Package["package.json"]:::config
        subgraph "Page Models"
            Landing["landingPage.js"]:::config
            Product["productPage.js"]:::config
        end
        subgraph "Test Suites"
            Smoke["Smoke Tests"]:::suite
            E2E["E2E Tests"]:::suite
            Regression["Regression Tests"]:::suite
        end
    end

    Runner --> Config
    Runner --> Package
    Runner --> Smoke
    Runner --> E2E
    Runner --> Regression
    Config -->|defines parameters| Runner

    subgraph "External Services"
        DemoApp["Next.js Commerce Demo"]:::external
        Browsers["Browsers\nChromium, Firefox, WebKit"]:::external
    end

    Runner -->|"runs against"| DemoApp
    Runner -->|"runs on"| Browsers

    Artifact["Artifacts\nScreenshots, Videos, Reports"]:::artifact
    Runner -->|"generates"| Artifact
    Artifact -->|"published to"| CI

    subgraph "GitHub Actions UI"
        UI["Actions Tab & PR Comments"]:::external
    end

    CI --> UI
    Artifact --> UI

    click CI "https://github.com/ekanto/ecommerce-test/blob/main/.github/workflows/test.yml"
    click Config "https://github.com/ekanto/ecommerce-test/blob/main/playwright.config.js"
    click E2E "https://github.com/ekanto/ecommerce-test/tree/main/tests/e2e/"
    click Landing "https://github.com/ekanto/ecommerce-test/blob/main/pages/landingPage.js"
    click Product "https://github.com/ekanto/ecommerce-test/blob/main/pages/productPage.js"
    click Artifact "https://github.com/ekanto/ecommerce-test/tree/main/screenshots/"
    click Package "https://github.com/ekanto/ecommerce-test/blob/main/package.json"

    classDef config fill:#cce5ff,stroke:#004085,color:#004085
    classDef suite fill:#d4edda,stroke:#155724,color:#155724
    classDef artifact fill:#fff3cd,stroke:#856404,color:#856404
    classDef ci fill:#f5c6cb,stroke:#721c24,color:#721c24
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef runner fill:#d1ecf1,stroke:#0c5460,color:#0c5460
```
