Skip to main content
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

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

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.

Run the binary

Use the following command to run the binary from command line:

Command
Copy icon Copy

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:

Command
Copy icon Copy

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





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