Skip to main content
No Result Found

Run accessibility checks on a sample repo

Try out App Accessibility Automation with our sample repository.

Prerequisites

  • Ensure you have a BrowserStack Username and Access Key. You can obtain your username and access key from the Account & Profile section on the dashboard.
    If you have not yet created an account, sign up for a Free Trial.
  • Supported test runners:
    • Mocha
    • Cucumber
  • Supported WebdriverIO (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.

Run sample build

Here’s how you can run a sample WebdriverIO (WDIO) test build on BrowserStack:

Download or clone the sample test repository

Get the sample project using one of the following options:

git clone -b sdk https://github.com/browserstack/webdriverio-appium-app-browserstack

Check and install WDIO dependencies

  1. Navigate to the Android or iOS directory based on the app you want to test.
  2. Ensure that all the WDIO dependencies in package.json are set to version 9.
  3. Install the dependencies.
    npm install
    

Set access credentials

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

# Set these values in your ~/.zprofile (zsh) or ~/.profile (bash)
export BROWSERSTACK_USERNAME="YOUR_USERNAME"
export BROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY"
setx BROWSERSTACK_USERNAME "YOUR_USERNAME" 
setx BROWSERSTACK_ACCESS_KEY "YOUR_ACCESS_KEY" 
set BROWSERSTACK_USERNAME=YOUR_USERNAME
set BROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY

Modify the WDIO configuration file

You must configure certain parameters in the WDIO configuration file located at /examples/run-parallel-test/parallel.conf.js to run the tests.

  1. Open the WDIO configuration file of your preferred project, Android or iOS.
  2. Set the accessibility flag to true.

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
Copy icon Copy
exports.config = {
  user: process.env.BROWSERSTACK_USERNAME || YOUR_USERNAME,
  key: process.env.BROWSERSTACK_ACCESS_KEY || YOUR_ACCESS_KEY,
  hostname: 'hub.browserstack.com',
  services: [
    [
      'browserstack',
      {
        accessibility: true,
        buildIdentifier: '${BUILD_NUMBER}',
        browserstackLocal: true,
        opts: { forcelocal: false, localIdentifier: "webdriverio-appium-app-browserstack-repo" },
        app: process.env.BROWSERSTACK_APP_PATH || './examples/WikipediaSample.apk',
      }
    ]
  ],
  capabilities: [{
    'bstack:options': {
      deviceName: 'Google Pixel 8',
      osVersion: "14.0"
    }
  }, {
    'bstack:options': {
      deviceName: 'Samsung Galaxy S21',
      osVersion: "11.0"
    }
  }],
  commonCapabilities: {
    'bstack:options': {
      projectName: "BrowserStack Samples",
      buildName: 'browserstack build',
      sessionName: 'BStack parallel webdriverio-appium',
      debug: true,
      networkLogs: true,
      source: 'webdriverio:appium-sample-sdk:v1.0'
    }
  },
  maxInstances: 10,
  updateJob: false,
  specs: [
    './specs/single_test.js'
  ],
  exclude: [],
  logLevel: 'info',
  coloredLogs: true,
  screenshotPath: './errorShots/',
  baseUrl: '',
  waitforTimeout: 10000,
  connectionRetryTimeout: 90000,
  connectionRetryCount: 3,
  framework: 'mocha',
  mochaOpts: {
    ui: 'bdd',
    timeout: 40000
  }
};
// Code to support common capabilities
exports.config.capabilities.forEach(function(caps){
  for(let key in exports.config.commonCapabilities)
    caps[key] = { ...caps[key], ...exports.config.commonCapabilities[key]};
});

Run the sample test

In the sample test repository, run the following command:

npm run test

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

Next steps

Integrate Accessibility testing into App Automate.

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