Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & Test Observability
No Result Found

Run cross-browser Puppeteer tests in parallel

A guide to cross browser parallel testing with your Puppeteer tests across 100+ desktop browsers on BrowserStack.

Run our sample cross-browser test in parallel

Follow the steps below to run a sample Puppeteer test on BrowserStack infra across multiple os/browser combinations and all at parallel so as to speed up your build:

Step 1: Clone our sample repository and install dependencies (if not already done)

All our sample tests are available on this GitHub repository. The first step is to download this repository on your system and install the dependencies as shown below:

terminal
Copy icon Copy

Step 2: Configure BrowserStack credentials (if not already done)

Note: Testing on BrowserStack requires username and access key that can be found in account settings.
If you have not created an account yet, you can sign up for a Free Trial or purchase a plan.

All our sample scripts need your BrowserStack credentials to run. Please set the environment variables BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY with your credentials as shown below:

terminal
Copy icon Copy

Alternatively, your can put your credentials in the browserstack.username and browserstack.accessKey capabilities in the parallel_test.js file in the sample repository.

Step 3: Run the sample parallel cross-browser test

After you have configured the credentials and installed the npm dependencies, you can invoke your first Puppeteer test on BrowserStack using the following:

terminal
Copy icon Copy

After the test has run, you can access the test results on the BrowserStack Automate dashboard.

Details of the cross-browser parallel test

In this section, we will walk you through the details of the test that you just ran and also explain the changes that you need to make in your existing Puppeteer scripts to make them run on BrowserStack.

The sample script that has run, is shown below (see in GitHub):

parallel_test.js
Copy icon Copy
Note: Puppeteer tests run on BrowserStack using a client-server architecture. So, test assertions run on the client side and hence BrowserStack won’t know whether your tests have passed or failed. Learn more how to mark tests as passed or failed on BrowserStack.

You can learn more about how to make your existing Puppeteer scripts run on BrowserStack and you can also learn about how to test against your privately hosted websites.

Next Steps

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