Test localhost and staging websites that are not publicly accessible
Test apps that connect to your local servers or internal networks using BrowserStack Local.
BrowserStack integrates with test suites that use a localhost URL, staging environment, or websites behind proxies or firewalls. To enable this, use BrowserStack Local, a tunneling feature that creates a secure connection between your machine and the BrowserStack Cloud.
Prerequisites
- You need to have BrowserStack Username and Access key, which you can find in your account settings. If you have not created an account yet, you can sign up for a Free Trial or purchase a plan.
Establish Local Testing
Install BrowserStack Local binary
Choose and download the binary for your operating system:
Unzip the binary to a folder/directory on your machine. Open your command-line interface and navigate to the folder containing the Local binary.
Update Detox config file
Update your Detox config file to include the following capabilities:
-
local
: Enables Local Testing. -
forcelocal
: Routes all traffic through your internal network, even if the resources are publicly accessible. This ensures all requests from remote browsers and devices go through your local machine. -
localIdentifier
: Allows you to test multiple forks and builds simultaneously by setting up separate Local Testing connections for each.
Here is a sample config file:
Configure tests to run with Local Testing connection
After establishing the Local Testing connection, set the local
parameter to true
.
Capability | Description | Value |
---|---|---|
local |
Test against internal/local servers |
true / false Default: false |
Use the following request to execute the test locally:
To run your tests on BrowserStack, use the following command:
- Make sure you establish the binary connection before executing the test suite, and disconnect it only after execution.
- The Local Testing setup varies based on your requirements, such as proxy settings or restricting connections to specific domains.
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
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!