How igniteram/appium-webdriverio-typescript works
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.