Skip to main content

Test mobile compatibility with Playwright emulation

Learn how to run Playwright tests using the responsive design mode in BrowserStack Automate browsers

Most browsers have the responsive design mode (the device mode) to quickly test how an application works on a mobile (Android or iOS) device. When using Playwright for test automation, use the device mode on Automate browsers to test your application.

Using the device mode for Playwright tests is supported only with the BrowserStack SDK for NodeJS.

To learn about simulating devices with Playwright, see the Playwright documentation.

Steps to run Playwright tests on device mode

The steps to run a Playwright test using the device mode on Automate are same as the ones you perform for integration. The only difference is that you have to specify Playwright emulation configurations under playwrightConfigOptions in the browserstack.yml file.

For example, you may only want to specify that the test runs on iPhone 6 and prefer a predefined configuration for the test. In that case, update the configuration in browserstack.yml as follows:

browserstack.yml
Copy icon Copy snippet

The configuration for iPhone 6 in deviceDescriptions.json are used for device simulation in the test.

However, if you want to use a custom configuration, update browserstack.yml as shown here:

browserstack.yml
Copy icon Copy snippet

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