Test localhost and staging websites that are not publicly accessible
BrowserStack can integrate with test suites pointing to your localhost URL, staging environment, and even websites behind one or more proxies/firewalls. This is done using BrowserStack Local - a tunneling feature that establishes a secure connection between your machine and the BrowserStack Cloud.
Select your integration method
-
BrowserStack SDK (Recommended)Plug-n-play solution that takes care of all the integration steps for you
-
Legacy (Language bindings)Start and stop the BrowserStack Local tunnel within your test suite manually
BrowserStack SDK is the recommended method for running NodeJS tests on BrowserStack.
Learn the benefits of using BrowserStack SDK
Following are the benefits of using BrowserStack SDK against manual integration process:
Integration step | With BrowserStack SDK | With manual integration |
---|---|---|
Connect to CDP Endpoint to run tests on BrowserStack |
Via the browserstack.yml config file |
Requires code changes to change the CDP Endpoint |
Integrate with BrowserStack Local |
Via the browserstack.yml config file |
Requires code changes in test suite |
Send test context to BrowserStack for reporting |
Via the browserstack.yml config file |
Requires additional code to be added in the test suite hooks |
Use basic cross browser testing parallelization |
Via the browserstack.yml config file |
May require code changes depending on the test suite |
Use advanced parallelization strategies |
Via the browserstack.yml config file |
Requires code changes to support different parallelization strategies |
Prerequisites
- BrowserStack Username and Access key. You can find this in your account settings. If you have not created an account yet, you can sign up for a Free Trial or purchase a plan.
- Node v14+ is installed on your machine.
Check BrowserStack Local connectivity
Run this sample test to check if BrowserStack Local is working as expected and can connect to BrowserStack servers.
Clone sample git repository
Clone the sample NodeJS-playwright-browserstack repository using the following commands:
Set up the dependencies
Install the required dependencies by running the following command:
Set BrowserStack credentials
Set userName
and accessKey
in the browserstack.yml
config file. Skip this step if you have already set credentials as environment variables.
Configuring BrowserStack Local
Ensure that the browserstackLocal
parameter is set to true
in your browserstack.yml
config file.
Execute build on BrowserStack
From the sdk
directory of this project, run the following command:
View test results
View your tests on the BrowserStack Automate dashboard. To learn more about the dashboard, check the view test results document.
If the status check fails, refer to the sections below for additional configuration that may be needed.
Advanced use-cases and troubleshooting
For restricted networks and troubleshooting, refer the following articles:
- Run Playwright tests on your privately hosted websites
- Testing your local site that might be behind a proxy
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
- RESOURCES
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!