Skip to main content
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Integrate WebDriverIO test suite with App Accessibility testing

Learn how to add accessibility checks to your existing functional tests and generate comprehensive reports of accessibility issues.

BrowserStack supports out of the box integration with WebdriverIO (WDIO). You can integrate your existing functional test suites with App Accessibility testing to run accessibility checks on your mobile apps. You can access the generated accessibility violation reports on the App Accessibility dashboard.

For Android devices, automated App Accessibility testing is supported on version 11 and above.

Prerequisites

  • Ensure you have a BrowserStack Username and Access Key. You can obtain your userName and accessKey from the Account & Profile section on the dashboard.
    If you have not yet created an account, sign up for a free trial.
  • Ensure you have a functional WebDriverIO test suite. To set one up, see Run accessibility checks on a sample repo.
  • Supported test runners:
    • Mocha
    • Cucumber
  • Supported WDIO versions:
    • WDIO v8
    • WDIO v9
  • Supported WDIO Service versions:
    • For WDIO v8, the minimum supported version is v8.42.0.
    • For WDIO v9, the minimum supported version is v9.6.0.
  • Node.js recommendations:
    • For WDIO v8, use Node.js v16.19.0.
    • For WDIO v9, use Node.js v20.11.1.
    • To install, run nvm install <node.js version> in your terminal.

Integrate App Accessibility Automate to run accessibility checks

Set your BrowserStack credentials

Save your BrowserStack credentials as environment variables to make it easier to run your test suite from your local or CI environment.

Copy icon Copy
Copy icon Copy

Update WebDriverIO dependencies

Open the package.json file of your project (Android or iOS) and update the WDIO dependency to either version 8 or 9, depending on your current setup.
For example, see the following sample package.json file with WDIO dependencies set to version 9.

package.json
Copy icon Copy

Install dependencies

Run the following command to install all WebDriverIO dependencies.

npm install

Modify the WDIO configuration file

The WDIO configuration file, parallel.conf.js, defines the required capabilities to run tests on BrowserStack. It is platform-specific and located in the corresponding platform folder. In the BrowserStack sample repository, it is located in the android/examples/run-parallel-tests or ios/examples/run-parallel-tests folder. Make sure you modify the file that corresponds to your testing platform.

  1. Add browserstack to the services section of your configuration file if it’s not already present.
  2. Add the relative or absolute path of the app you want to test to the app property. For example, app: ./examples/BStackSampleApp.apk.
    You can upload an Android app (.apk or .aab file) or an iOS app (.ipa file) from your local filesystem.
  3. Set the accessibility flag to true. The default value is false.
  4. Set the accessibilityOptions property to configure various accessibility testing options. For details, see Configuration options.
  5. Increase the test timeout value, for example timeout: 100000. You must increase the test timeout value to give enough time for the accessibility checks to run.
  6. If you are upgrading WDIO version to v9, you must pass the relative path of test file to the specs property, for example, ./specs/single_test.js.
  7. Set the projectName and buildName.
  8. Based on your test runner, set the framework to mocha or cucumber.
  9. Save the file in the test directory.
    For example, if you are using the BrowserStack sample repository, save the configuration file in the /examples/run-parallel-test/ directory.

The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack App Automate since Automated tests will automatically identify different build runs.

Sample WDIO configuration file
Copy icon Copy

Run the automated test

From your platform folder (Android or iOS), run the following command:

Run automated test
Copy icon Copy

View the Accessibility test report

After the test completes, access the report in your project folder on the App Accessibility dashboard.


Visit App Accessibility dashboard

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle