Get your setup working faster. Join our Discord for optimisation tips from elite testers.Join our Discord
Automated tests on Playwright (Node.js)
Quick start guide to integrate Automated tests in BrowserStack Accessibility Testing with Playwright (Node.js).
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 Playwright test suite. You can use test suites integrated with BrowserStack Automate or test suites that are outside the BrowserStack infrastructure.
You use the Playwright test runner in your tests. The test variable used in writing the tests should be imported from @playwright/test.
The minimum version of browserstack-node-sdk that supports Automated tests is 1.31.22.
To get the instructions to integrate Automated tests in your test suites, select one of the following tabs depending on where your test suites run:
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 verify the installed version.
```bash
npm i -D browserstack-node-sdk
npm list browserstack-node-sdk
```
Automated tests mandatorily needs the following five configurations in the browserstack.yml file. In particular, set the accessibility flag as true at the end of the browserstack.yml file.
The projectName and buildName config must be static and not change across different runs of the same build. This deviates from the standard BrowserStack Automate approach, because Automated tests automatically identify different build runs.
Automated tests support the following browsers and operating systems:
Operating system
Chrome
Safari
Edge
Windows
Versions 100 and above
N/A
Versions 100 and above
macOS
Versions 100 and above
Not supported
Versions 100 and above
Android
Android 15 and 16
N/A
Not supported
iOS
Not supported
Not supported
Not supported
Use the exact configurations provided in the example for mobile browser testing. Using different combinations of configurations may cause testing errors.
Accessibility Testing does not work within contexts created in Playwright test suites. This is because contexts are isolated test environments, similar to incognito profiles, which prevent the Accessibility Testing extension from loading.
Run your suite with Automated tests
Prepend browserstack-node-sdk to the existing command that you use to trigger an automated build as follows.
```bash
npx browserstack-node-sdk "Your existing command for running your test suite. E.g. <playwright test sample --project=chromium>"
```
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 verify the installed version.
```bash
npm i -D browserstack-node-sdk
npm list browserstack-node-sdk
```
Automated tests mandatorily needs the following five configurations in the browserstack.yml file. In particular, set the accessibility flag as true and browserstackAutomation flag as false in the browserstack.yml file.
The projectName and buildName config must be static and not change across different runs of the same build. This deviates from the standard BrowserStack Automate approach, because Automated tests automatically identify different build runs.
Google Chrome policy changes in v142 and later prevent accessibility automation from functioning for customers using non-BrowserStack infrastructure.
To continue performing accessibility automation, you must either:
Automated tests support the following browsers and operating systems:
Operating system
Chrome
Safari
Edge
Windows
Versions 100 and above
N/A
Versions 100 and above
macOS
Versions 100 and above
Not supported
Versions 100 and above
Android
Android 15 and 16
N/A
Not supported
iOS
Not supported
Not supported
Not supported
Use the exact configurations provided in the example for mobile browser testing. Using different combinations of configurations may cause testing errors.
Accessibility Testing does not work within contexts created in Playwright test suites. This is because contexts are isolated test environments, similar to incognito profiles, which prevent the Accessibility Testing extension from loading.
Run your suite with Automated tests
Prepend browserstack-node-sdk to the existing command that you use to trigger an automated build as follows.
```bash
npx browserstack-node-sdk "Your existing command for running your test suite. E.g. <playwright test sample --project=chromium>"
```