How webdriverio/cucumber-boilerplate works
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)