Skip to main content

Accessibility Automation on Playwright (Node.js)

Quick start guide to integrate Accessibility Automation with Playwright (Node.js)

Pre-requisites

  • 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 Playwright test suite which runs on BrowserStack Automate.
  • You use the Playwright test runner in your tests. The test variable used in writing the tests should be imported from @playwright/test.

Integrate with Accessibility Automation

Follow the steps below to get started with adding Accessibility Automation to your test suite:

Install or update to the latest version of BrowserStack Node SDK

Go to your Playwright project’s root directory and run the following commands to update or install the BrowserStack Node SDK and later check the installed version as shown below:

Terminal
npm i -D browserstack-node-sdk
npm list browserstack-node-sdk

Please ensure that you now have at least browserstack-node-sdk v1.27.1 before proceeding.

Create the browserstack.yml file

If you don’t already have a browserstack.yml file, run the following command to create one:

Terminal
npx setup --username 'YOUR_USERNAME' --key 'YOUR_ACCESS_KEY'

Set up the browserstack.yml file

Set up the browserstack.yml file as follows:

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 Accessibility Automation will automatically identify different build runs.

browserstack.yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
projectName: "Your static project name goes here"
buildName: "Your static build/job name goes here"
...
accessibility: true

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

Run your suite with BrowserStack Accessibility Automation

Prepend browserstack-node-sdk to the existing command that you use to trigger an automated build as shown below.

Terminal
npx browserstack-node-sdk "Your existing command for running your test suite. E.g. <playwright test sample --project=chromium>"


Once the build has completed and the Accessibility report is ready, it will automatically get sent to the Accessibility Automation dashboard.

Visit Accessibility Automation 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