# dntthuan064/e2e-pw-frwd architecture

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

- Interactive diagram: https://gitdiagram.com/dntthuan064/e2e-pw-frwd
- Repository: https://github.com/dntthuan064/e2e-pw-frwd

## Overview

##### Main Components
- Testing Orchestrator: At the core of the system is Cucumber that drives the test scenarios. Represent how Cucumber step definitions (located under src/features) execute test cases defined by the feature files.
- Web Testing Module:
- Use Playwright (with configuration in playwright.config.ts) to run web tests.
- Page Object Model for web pages under src/pages/web.
- Mobile Testing Module:
- Use Appium (configured via src/config/appium.config.ts) for mobile testing (Android/iOS).
- Mobile Page Objects under src/pages/mobile.
- Mobile driver utility (src/utils/mobile-driver.ts) that interacts with the Appium server.
- Common Utilities & Configuration:
- Shared utilities and types (located in src/common, src/common/types) that support both web and mobile testing.
- Configuration files (in src/config) that define environment settings.
- CI/CD Integration:
- Jenkins integration, represented by the Jenkinsfile and GitHub workflows, which trigger test execution and reporting.
- External Dependencies:
- Mention external services, such as the Playwright browsers, the Appium server and mobile emulators (Android SDK and Xcode), and Node.js/Yarn environment usage.

##### Relationships and Interactions
- Cucumber (test orchestrator) triggers the execution of test scenarios that use step definitions from src/features. These definitions invoke the appropriate page objects and utilities based on the platform.
- For web tests, the step definitions interact with the Playwright-driven page objects (src/pages/web) and then back to Cucumber for result assertions.
- For mobile tests, the step definitions interact with mobile page objects (src/pages/mobile) using mobile-driver utilities that communicate with the Appium server.
- Environment configurations and common shared types ensure consistency across tests.
- CI/CD (with Jenkins) integrates the entire test process, including dependency setup, environment variable usage (from .env), and report generation.

##### Architectural Patterns and Design Principles
- Page Object Model (POM): Separate page objects for web and mobile interfaces stored in src/pages, simplifying maintenance and reusability.
- Separation of Concerns: Dividing the framework into distinct directories for configuration, features (step definitions and hooks), page objects, common utilities, and scenarios.
- Behavior-Driven Development (BDD): Emphasizing tests written in Gherkin syntax (located in src/scenarios) that are mapped to step definitions.
- CI/CD integration: Use of Jenkinsfile and GitHub workflows to automate test executions.

##### Final Recommendations
- Every component is clearly named (e.g., “src/pages/web/login.page.ts” also representing a broader component “Web Login Page Object”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    CICD["CI/CD Pipeline (Jenkins & GitHub Workflows)"]:::cicd
    Runner["Cucumber Runner (src/features)"]:::orchestrator
    U1["Common Utilities & Config (src/common, src/config)"]:::util

    subgraph "Web Testing Branch"
        WPO["Web Page Objects (src/pages/web)"]:::web
        WPC["Playwright config (playwright.config.ts)"]:::web
    end

    subgraph "Mobile Testing Branch"
        MPO["Mobile Page Objects (src/pages/mobile)"]:::mobile
        MAC["Appium config (src/config/appium.config.ts)"]:::mobile
        MD["Mobile Driver Utility (src/utils/mobile-driver.ts)"]:::mobile
    end

    EX["External Dependencies (Browsers, Appium Server, Emulators)"]:::external

    CICD -->|"triggers"| Runner
    CICD -->|"collects_reports"| Runner
    Runner -->|"executes"| WPO
    Runner -->|"executes"| MPO
    WPO -->|"uses"| WPC
    MPO -->|"uses"| MAC
    MPO -->|"invokes"| MD
    MD -->|"communicates_with"| EX
    WPC -->|"calls"| EX
    U1 ---|"supports"| WPO
    U1 ---|"supports"| MPO

    click Runner "https://github.com/dntthuan064/e2e-pw-frwd/tree/master/src/features"
    click WPC "https://github.com/dntthuan064/e2e-pw-frwd/blob/master/playwright.config.ts"
    click WPO "https://github.com/dntthuan064/e2e-pw-frwd/tree/master/src/pages/web"
    click MAC "https://github.com/dntthuan064/e2e-pw-frwd/blob/master/src/config/appium.config.ts"
    click MPO "https://github.com/dntthuan064/e2e-pw-frwd/tree/master/src/pages/mobile"
    click MD "https://github.com/dntthuan064/e2e-pw-frwd/blob/master/src/utils/mobile-driver.ts"
    click U1 "https://github.com/dntthuan064/e2e-pw-frwd/tree/master/src/common"
    click CICD "https://github.com/dntthuan064/e2e-pw-frwd/tree/master/Jenkinsfile"

    classDef orchestrator fill:#F7DC6F,stroke:#000,stroke-width:2px;
    classDef web fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef mobile fill:#A3E4D7,stroke:#117864,stroke-width:2px;
    classDef util fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef cicd fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef external fill:#D7BDE2,stroke:#7D3C98,stroke-width:2px;
```
