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
andaccessKey
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
- WDIO
- 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
.
- For WDIO v8, the minimum supported version is
-
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.
- For WDIO v8, use Node.js
Integrate App Accessibility Automate to run accessibility checks
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
.
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.
- Add
browserstack
to theservices
section of your configuration file if it’s not already present. - 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. - Set the
accessibility
flag totrue
. The default value isfalse
. - Set the
accessibilityOptions
property to configure various accessibility testing options. For details, see Configuration options. - 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. - 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
. - Set the
projectName
andbuildName
. - Based on your test runner, set the
framework
tomocha
orcucumber
. - 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.
View the Accessibility test report
After the test completes, access the report in your project folder on the 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
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!