Armin-Paisen/Browserstack-WebdriverIO-App-testing
Sample project for App testing using Browserstack and WebdriverIO
WebdriverIO App Testing in BrowserStack
A small-scale WebdriverIO E2E test automation framework for native apps. These tests run on real smartphone devices in the BrowserStack App Automate cloud. The architecture is designed to be robust, easy to maintain, scalable, and stable.
I used this architecture and methods in a previous project to reduce the flakiness rate from 30% to less than 4%, speed up test runs by 25% without adding more parallelization, and cut time spent on fixing by 30%.
๐ฆ Technologies and Methods
๐น WebdriverIO
๐น BrowserStack
๐น Appium
๐น TypeScript
๐น Node.js / npm
๐น Mocha
๐น GitHub Workflows (CI/CD)
๐น Page Object Model
๐น ESLint
๐น DRY
๐ฆ Features
๐ธ Pipeline runs on every push/merge request and must pass before being able to merge. This ensures updates donโt break any tests.
๐ธ ESLint runs on commit and in the pipeline, ensuring consistent formatting and code quality.
๐ธ Test scripts are encapsulated and idempotent. This allows tests to be run separately in dedicated test suites without relying on other tests.
๐ธ Environment-driven configuration via a .env file for BrowserStack credentials and test settings.
๐ธ Prepared for suite splitting (e.g., smoke/regression) and scalable execution patterns.
๐ธ Cross-device and parallel test-runs.
๐ธ Includes a lightweight CTRF report integrated into GitHub.
๐ญ How can it be improved?
For a larger-scale project:
๐น Add API and performance testing to complement E2E coverage and speed up feedback.
๐น Add Mocha test tags for targeted execution like @smoke, @regression, @critical, well as platform and feature tags.
๐น Tag unstable tests with @flaky and group them into a non-blocking (allowed-to-fail) suite, so theyโre tracked without blocking merges.
๐น Split and standardize configs by environment, platform, and suite to avoid a single oversized config file.
๐น Set up a scheduled nightly regression run.
๐น Expand test data management with fixtures and data builders/factories to keep tests clean and scalable.
๐น Introduce a clear folder structure to improve reuse and maintainability, for example:
test/
specs/
pageobjects/
fixtures/
helpers/
utils/
services/
๐ฆ Running the Project
You need a BrowserStack account to run this project (a free trial version is available).
Local
- Clone the repository to your local machine.
- Run
npm installin the project directory to install the required dependencies. - Rename
.env.exampleto.envand add your BrowserStack key and username (further explanation is included in the.env.examplecomments). - Download the Android
.apkfile from here: https://github.com/webdriverio/native-demo-app/releases (v1.0.8) - Upload the
.apkfile to BrowserStack, then copy the uploaded app URL. It will look like this:bs://ad373fa0173ef2b43b9e947d1df28cebf78c91ab - In
wdio.conf.ts, add that link to the capabilities under"appium:app". - Run
npm run wdioto start the tests.
Via GitHub
- In GitHub Secrets, add:
BROWSERSTACK_ACCESS_KEYandBROWSERSTACK_USERNAMEusing your BrowserStack key and username values. - In GitHub go to Actions โ Run tests โ Run workflow.
- Optionally provide an input like "smoke" to run only a subset of tests
๐ฟ Video
This video demonstrates the login tests and verifies:
๐ธ Errors for empty inputs
๐ธ Errors for incorrect credentials
๐ธ Only the email error when the email is invalid but the password is valid
๐ธ A success message for valid credentials, and that it can be closed
You can find the details of the test script in: /test/specs/login.ts
https://github.com/user-attachments/assets/6ff83c4f-4c8d-48f4-b291-79bb4a066e60
๐ Credits
This project uses the WebdriverIO Native Demo App (https://github.com/webdriverio/native-demo-app) for demonstration purposes.
The app and related assets are owned by their respective authors and are provided under the terms of their original license.
All other third-party tools and libraries are provided under their respective licenses.