# igniteram/appium-webdriverio-typescript architecture

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

- Interactive diagram: https://gitdiagram.com/igniteram/appium-webdriverio-typescript
- Repository: https://github.com/igniteram/appium-webdriverio-typescript

## Overview

##### Main Components
- Test Scripts & BDD Features: The “features” directory contains Cucumber feature files (e.g., appium.feature, calculator.feature) that define your test scenarios.
- Step Definitions: The “stepDefinitions” folder holds code that maps feature steps to executable test logic (e.g., appiumSteps.ts, calcSteps.ts).
- Page Objects: The “pages” directory uses the page-object design pattern to encapsulate selectors and actions for different screens or pages (e.g., appiumPage.ts, calcPage.ts).
- Configuration Files: The “config” folder includes two primary WebdriverIO configuration files (wdio.app.config.js for native app tests and wdio.browser.config.js for browser tests), which define capabilities and test environment settings.
- Mobile App Under Test: The “app” directory contains the Android application package (LGCalculator.apk) that is used in native testing.
- Tooling & Build Files: Files like package.json, tsconfig.json, and tslint.json set up the project’s dependencies, TypeScript compilation settings, and linting rules.
- Reporting & Auxiliary Assets: The images folder and instructions in the README indicate integration with Allure-Reports for generating test run reports.

##### Component Relationships and Interactions
- Test Runner and Execution Pipeline: Start with the command-line execution (npm scripts) that first launches the Appium server and then builds/transpiles the TypeScript code. This pipeline then triggers WebdriverIO, which uses one of the config files to select the test mode (native app or browser tests).
- Communication with the Mobile Device: The WebdriverIO instance interacts with the Appium server. Appium then relays commands to a real Android device (or emulator) where the LGCalculator.apk is installed; similarly, for browser testing, it sets up a Chrome session.
- BDD Layer Interaction: The Cucumber framework reads feature files from the “features” directory and delegates steps to the step definitions. These step definitions interact with Page Objects to perform actions and validations on the mobile app.
- Reporting: After execution, the Allure-Reports tool (configured in the reporting part of the tests) processes the generated results to produce HTML reports.

##### Architectural Patterns & Design Principles
- Page Object Model (POM): This design pattern is implemented in the “pages” folder to clearly separate the page structure and actions from the test logic.
- Behavior Driven Development (BDD): The framework uses Cucumber, which organizes tests in feature files and executes them using related step definitions.
- Configuration-Driven Testing: Two distinct configuration files (native vs. browser) allow switching test modes based on device capabilities and desired test contexts.
- Modularity & Separation of Concerns: Each aspect of the testing (feature definitions, test implementations, page objects, and configuration settings) is separated into distinct directories/files to allow easier maintenance and scalability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Test Execution Pipeline
    subgraph "Test Execution Pipeline"
        TR["Test Runner (npm scripts)"]:::infrastructure
        WD["WebdriverIO"]:::infrastructure
        AS["Appium Server"]:::infrastructure
        MD["Mobile Device/Emulator"]:::infrastructure
        TR -->|"triggers"| WD
        WD -->|"sendsCommands"| AS
        AS -->|"executesOn"| MD
    end

    %% Configuration Files
    subgraph "Configuration"
        CA["wdio.app.config.js"]:::infrastructure
        CB["wdio.browser.config.js"]:::infrastructure
        CA -->|"configures"| WD
        CB -->|"configures"| WD
    end

    %% BDD Testing Layer
    subgraph "BDD Testing Layer"
        subgraph "Features"
            F1["appium.feature"]:::testcode
            F2["calculator.feature"]:::testcode
        end
        subgraph "Step Definitions"
            S1["appiumSteps.ts"]:::testcode
            S2["calcSteps.ts"]:::testcode
        end
        subgraph "Page Objects"
            P1["appiumPage.ts"]:::testcode
            P2["calcPage.ts"]:::testcode
        end
        F1 -->|"defines"| S1
        F2 -->|"defines"| S2
        S1 -->|"triggersActions"| P1
        S2 -->|"triggersActions"| P2
        TR -->|"initiatesBDD"| F1
        TR -->|"initiatesBDD"| F2
        P1 -->|"actsOn"| MA
        P2 -->|"actsOn"| MA
    end

    %% Mobile App Under Test
    subgraph "Mobile App Under Test"
        MA["LGCalculator.apk"]:::external
    end

    %% Tooling & Reporting
    subgraph "Tooling & Reporting"
        subgraph "Tooling"
            PK["package.json"]:::infrastructure
            TS["tsconfig.json"]:::infrastructure
            TL["tslint.json"]:::infrastructure
        end
        subgraph "Reporting & Assets"
            IM["images"]:::infrastructure
            RD["README.md"]:::infrastructure
        end
    end

    %% Reporting connection
    WD -->|"reportsResults"| RD

    %% Classes for styling
    classDef testcode fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef infrastructure fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef external fill:#FFD580,stroke:#000,stroke-width:1px;

    %% Click Events for Component Mappings
    click F1 "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/features/appium.feature"
    click F2 "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/features/calculator.feature"
    click S1 "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/stepDefinitions/appiumSteps.ts"
    click S2 "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/stepDefinitions/calcSteps.ts"
    click P1 "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/pages/appiumPage.ts"
    click P2 "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/pages/calcPage.ts"
    click CA "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/config/wdio.app.config.js"
    click CB "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/config/wdio.browser.config.js"
    click MA "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/app/LGCalculator.apk"
    click PK "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/package.json"
    click TS "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/tsconfig.json"
    click TL "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/tslint.json"
    click IM "https://github.com/igniteram/appium-webdriverio-typescript/tree/master/images"
    click RD "https://github.com/igniteram/appium-webdriverio-typescript/blob/master/README.md"
```
