Skip to main content
Experience faster, smarter testing with BrowserStack AI Agents. See what your workflow’s been missing. Explore now!
No Result Found
Connect and get help from 7,000+ developers on our Discord community. Ask the CommunityAsk the Community

Integrate your Puppeteer test suite with BrowserStack Automate

A guide to running your existing Puppeteer tests on BrowserStack using the BrowserStack Node SDK.

The BrowserStack Node SDK provides plug-and-play integration. Run your entire Puppeteer test suite in parallel across 100+ browsers with no changes to your test code.

Prerequisites

  • An existing Puppeteer test suite using Jest as the test runner.
  • Node.js 14 or later and npm installed.
  • A BrowserStack account with your username and access key. Find these in your account settings.

Integration steps

Your username and access key are available in your account settings. If you don’t have an account yet, sign up for a free trial.

Set your BrowserStack credentials as environment variables:

export BROWSERSTACK_USERNAME="YOUR_USERNAME"
export BROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY"

Install the BrowserStack Node SDK as a development dependency and run the setup command to generate the browserstack.yml config file:

npm install -D browserstack-node-sdk
npx setup --username "YOUR_USERNAME" --key "YOUR_ACCESS_KEY"

Update your BrowserStack config file

When you install the SDK, a browserstack.yml file is created at the root of your project. Update it with the following settings:

Specify platforms to test on

Set the browsers and OS you want to test on under the platforms key. Select from 100+ browser and OS combinations from the list of supported browsers and OS:

Parallel thread #1
Parallel thread #2
Parallel thread #3

Increase parallelsPerPlatform to run more tests per platform at the same time.

Icon indicating AI featureConfigure AI agents

Enable the following AI agents by adding the respective configurations to browserstack.yml:

Enable Self Heal Agent

Auto-fix locator failures with the AI-powered self-heal agent and get up to 40% fewer locator failures. Learn more

True
False
Test Failure Analysis Agent
Auto-enabled

AI-powered root cause analysis for test failures that can reduce debugging time. Learn more

Enable BrowserStack Local

Test localhost/internal servers in your network

true
false
Test localhost/staging websites that are not publicly accessible

BrowserStack’s Local Testing feature connects with test suites pointing to your localhost URL

Learn more

BrowserStack Reporting

Set a build name and project name to organize your test runs on the Automate dashboard:

Build Name

Set a name to your build (usually the same as the build ID that’s on your CI/CD platform). Accepted characters: A-Z, a-z, 0-9, ., :, -, [], /, @, &, ', _. All other characters are ignored.
Character limit: 255


Project Name

Set a project name for your project.

Keep projectName and buildName static across runs of the same build. Test Reporting and Analytics uses these values to group build runs automatically. Restrict characters to alphanumeric, underscores (_), colons (:), square brackets ([, ]), and hyphens (-). Any other character is replaced with an underscore.

Use additional debugging features

By default, BrowserStack provides prettified session logs and video recordings of failed tests. Enable the following features as needed:

Video

Enables video recording for every command run.

True
False
Network logs

Enables network traffic logs to be captured.

True
False

Update browserstack.yml file with selected capabilities

Copy the following configuration and replace the contents of browserstack.yml at the root of your project:

browserstack.yml
Copy icon Copy

Run your test suite using the BrowserStack Node SDK. Prefix your existing Jest command with npx browserstack-node-sdk:

npx browserstack-node-sdk jest

After the run completes, view your results on the BrowserStack Automate dashboard.

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