# webdriverio/cucumber-boilerplate architecture

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

- Interactive diagram: https://gitdiagram.com/webdriverio/cucumber-boilerplate
- Repository: https://github.com/webdriverio/cucumber-boilerplate

## Overview

##### Main Components Identification
- Test Specifications (Features): Represented by .feature files under src/features. They are written using Gherkin syntax to describe test scenarios.
- Step Definitions: Separated into given.ts, when.ts, and then.ts under src/steps that parse the feature files and link them to the underlying test logic.
- Support Layer:
- Action Functions (src/support/action): Contains functions to simulate user interactions (clicks, dragging, setting input values, etc.).
- Check Functions (src/support/check): Contains functions used to verify test outcomes (elements’ visibility, attributes, etc.).
- Custom Library Helpers (src/support/lib): For any reusable functionality related to element checks.
- Configuration & Setup:
- WebdriverIO Configurations (wdio.conf.ts and environment-specific configs): Configures browser sessions, test suite settings, and integration with external drivers/Selenium Grid.
- General project configuration files (.eslintrc, package.json, tsconfig.json, etc.).
- Continuous Integration:
- GitHub workflow files (under .github/workflows) for automated testing, dependency updates, and setup actions.
- Demo Application:
- The demo-app directory acts as an example web application – providing an HTML page, a JavaScript file, etc. – for testing demonstration purposes.
- Test Runner:
- The commands in the README use yarn run wdio, triggering the WDIO runner which processes the configuration and executes tests.

##### Relationships and Interactions
- The Gherkin Feature files “drive” the tests. When a test is executed, the WDIO test runner picks up the feature files.
- The feature steps are mapped to step definitions within the src/steps directory.
- Step definitions utilize support functions (actions and checks) from the src/support directory to interact with the browser via the WebdriverIO API.
- The configuration files (wdio.conf.ts and its variations) determine the test environment (like baseUrl, browser settings, parallel execution) and feed these into the test runner.
- CI/CD pipelines (via GitHub workflows) invoke the test runner and report on test outcomes.
- The demo-app, when used, provides UI elements that can be interacted with during automated test runs.

##### Architectural Patterns & Key Decisions
- Layered Architecture: Separation between test definitions (features), step definitions, and support utilities.
- Modularity: The support layer is modularized into action-based and check-based functions, making them reusable across tests.
- BDD Approach: Emphasizes readability and collaboration between technical and non-technical team members by using a human-readable test specification.

##### Relevant Technologies & Frameworks
- WebdriverIO (Automated browser testing framework)
- Cucumber (For BDD and writing tests in Gherkin)
- Node.js (Runtime environment)
- Yarn (Package manager, as recommended by the README)
- CI/CD support with GitHub Actions
- JavaScript/TypeScript (for step definitions and support libraries)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Test Specification Layer"
        A["Feature Files (Gherkin)"]
        B["Step Definitions (Given/When/Then)"]
    end
    A -->|"drives"| B

    subgraph "Support Layer"
        C["Support Actions"]
        D["Support Checks"]
        E["Custom Library Helpers"]
    end
    B -->|"calls"| C
    B -->|"calls"| D
    B -->|"calls"| E

    F["WDIO Configurations"]
    B -->|"executes"| G["Test Runner (WebdriverIO)"]
    C --> G
    D --> G
    E --> G
    F --> G

    H["CI/CD Pipeline"]
    H -->|"triggers"| G

    G -->|"executes on"| I["Browser / Selenium Grid"]
    G -->|"interacts with"| J["Demo App / Application Under Test"]

    classDef features fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef steps fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef support fill:#ffebcd,stroke:#000,stroke-width:2px;
    classDef config fill:#ffa07a,stroke:#000,stroke-width:2px;
    classDef runner fill:#ffcccb,stroke:#000,stroke-width:2px;
    classDef ci fill:#dda0dd,stroke:#000,stroke-width:2px;
    classDef external fill:#d3d3d3,stroke:#000,stroke-width:2px;
    classDef demo fill:#ffc0cb,stroke:#000,stroke-width:2px;

    class A features;
    class B steps;
    class C support;
    class D support;
    class E support;
    class F config;
    class G runner;
    class H ci;
    class I external;
    class J demo;

    click A "https://github.com/webdriverio/cucumber-boilerplate/tree/main/src/features"
    click B "https://github.com/webdriverio/cucumber-boilerplate/tree/main/src/steps"
    click C "https://github.com/webdriverio/cucumber-boilerplate/tree/main/src/support/action"
    click D "https://github.com/webdriverio/cucumber-boilerplate/tree/main/src/support/check"
    click E "https://github.com/webdriverio/cucumber-boilerplate/tree/main/src/support/lib"
    click F "https://github.com/webdriverio/cucumber-boilerplate/blob/main/wdio.conf.ts"
    click H "https://github.com/webdriverio/cucumber-boilerplate/tree/main/.github/workflows"
    click J "https://github.com/webdriverio/cucumber-boilerplate/tree/main/demo-app"
```
