Skip to main content
Get Automate insights in Microsoft Teams with our new integration! Get Started!.

Test on Internal Networks

BrowserStack enables you to run your WebdriverIO automated tests on your internal development environments, on localhost, and from behind a corporate firewall. This feature is called “Local Testing”. Some examples of local testing URLs are 127.0.0.1:3000, staging.website.com, my.custom.host

Local Testing establishes a secure connection between your machine and the BrowserStack cloud. Once you set up Local Testing, all URLs work out of the box, including HTTPS URLs and those behind a proxy or firewall.

Prerequisites

Before configuring your WebdriverIO tests for Local Testing, go through Integrate your test suites with BrowserStack.

Configure local testing

The @wdio/browserstack-service plugin provides support to manage the Browserstack Tunnel out of the box. You just need to set browserstackLocal: true to activate this feature.

Step 1: Set browserstackLocal: true in the webdriverio.conf.js file

  //webdriverio.conf.js

  export.config = {
    user: process.env.BROWSERSTACK_USERNAME || 'YOUR_USERNAME',
    key: process.env.BROWSERSTACK_ACCESS_KEY || 'YOUR_ACCESS_KEY',
    services: [
        ['browserstack', {
            browserstackLocal: true
        }]
    ],
    ...
  };

Step 2: Trigger your existing build command to run your WebdriverIO tests with BrowserStack Local.

Verify local connection

You can use the following sample test case to verify whether your Local test connection has been setup correctly:

describe('BrowserStack Local Testing', ()=> {
  it('can check tunnel working', async () => {
    await browser.url('http://bs-local.com:45691/check');
    (await browser.getPageSource()).should.match(/Up and running/i);
  });
});
Note: If you want to refer a sample local testing configuration, check the webdriverio-browserstack repo on GitHub

Next steps

Once you have successfully executed local testing with BrowserStack, you might want to check the following:

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
Talk to an Expert