Skip to main content

Automated tests on Cypress

Quick start guide to integrate Automated tests on BrowserStack Accessibility Testing with Cypress.

Prerequisites

  • You have an account with BrowserStack (even a free trial works) and can get your Username and Access Key from Account & Profile.
  • You have a pre-existing Cypress test suite (version 10 or above) integrated with BrowserStack Automate.
  • Automated tests will not run on legacy headless mode. Switch to new headless mode or avoid using headless mode (add headless:false to browserstack.json).

Integrate with Automated tests on BrowserStack Accessibility Testing

Follow these steps to get started with adding Automated tests to your test suite:

The minimum version of browserstack-cypress-cli that supports Automated tests is 1.29.0.

Install the latest version of the browserstack-cypress-cli npm package

Update the browserstack-cypress-cli using the following commands.

Terminal
Copy icon Copy snippet

Make changes to the browserstack.json file

Verify that your browserstack.json config file has all the required key-value pairs as in the following snippet. Especially, ensure to set the accessibility flag as 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 Automate since Automated tests will automatically identify different build runs.

browserstack.json
Copy icon Copy snippet

Accessibility testing will only run on Desktops (Mac & Windows) with Chrome 95 & above on Automate.

In case of non-default directory structure or TypeScript, it is recommended to add the following require() or import statement in the Javascript/Typescript file(s) containing custom commands: require('browserstack-cypress-cli/bin/accessibility-automation/cypress'); or import 'browserstack-cypress-cli/bin/accessibility-automation/cypress';.

Make changes to the cypress.config.js file

You’ll need to make a minor modification to the cypress.config.js file to import and use the Automated tests plugin while your tests run. Ensure the lines mentioned in the following sample file are present in your config file. Especially, ensure to set browserstackAccessibility as on as in the following snippet.

cypress.config.js
Copy icon Copy snippet

Run your suite with Automated tests

Continue running your tests as you have been running previously. The command to run your tests using the BrowserStack SDK remains unchanged. For your reference, here’s a sample command:

Terminal
Copy icon Copy snippet


You can check the Accessibility report for your build through the Automated tests page.


Visit Automated tests page

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