> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# shawnlobo96/browserstack-local

Test web applications on internal development environments by utilizing the secure and encrypted
BrowserStack tunnel (Local binary). Our local binary uses secure WebSockets (WSS) to ensure
the security and privacy of your data.


## Commands

### download

Download the local testing binary


### start_local

Setup BrowserStackLocal parameters


| Parameter | Type | Default | Description |
|---|---|---|---|
| `access_key` | env_var_name | BROWSERSTACK_ACCESS_KEY |  |
| `docker` | string | cimg/node:lts |  |
| `force_local` | boolean | false |  |
| `force_proxy` | boolean | false |  |
| `local_identifier` | string |  |  |
| `local_proxy_host` | string |  |  |
| `local_proxy_pass` | string |  |  |
| `local_proxy_port` | string |  |  |
| `local_proxy_user` | string |  |  |
| `log_file` | string |  |  |
| `proxy_host` | string |  |  |
| `proxy_pass` | string |  |  |
| `proxy_port` | string |  |  |
| `proxy_user` | string |  |  |
| `verbose` | integer | 0 |  |

### stop_local

Teardown BrowserStackLocal tunnel connection


| Parameter | Type | Default | Description |
|---|---|---|---|
| `access_key` | env_var_name | BROWSERSTACK_ACCESS_KEY |  |

## Jobs

### BrowserStack Local Start

Setup BrowserStack local testing

| Parameter | Type | Default | Description |
|---|---|---|---|
| `access_key` | env_var_name | BROWSERSTACK_ACCESS_KEY | It is your private and unique Access Key assigned by Browserstack. The Access Key is required to set up a Local Testing connection.
You can obtain this key from the local testing section of the Settings page: https://www.browserstack.com/accounts/settings
 |
| `executor` | string | cimg/node:lts | Used to set up execution environment for running your script. Refer https://circleci.com/developer/images |
| `force_local` | boolean | false | This flag will ensure that, regardless of any other setting, no asset will be resolved via the public internet and any resolution of URLs that your BrowserStack device does will be routed through the Local tunnel.
This flag is typically used to ensure compliance with your network policies.
 |
| `force_proxy` | boolean | false | This options routes all traffic via the proxy specified - otherwise, binary tries to connect directly as well for better performance. |
| `local_identifier` | string |  | If you are running multiple copies of BrowserStackLocal binary (for better performance or other reasons), please specify unique strings for BrowserStack to uniquely identify them.
You will need to specify the same string in Automate tests as well.
 |
| `local_proxy_host` | string |  | If your local server is behind a proxy or you are using a proxy to log all communication to your local servers - please specify your proxy host using this option. |
| `local_proxy_pass` | string |  | If your local server is behind a proxy, and it requires authentication - please specify your proxy password using this option. |
| `local_proxy_port` | string |  | If your local server is behind a proxy or you are using a proxy to log all communication to your local servers - please specify your proxy port using this option. Default assumed is 8081. |
| `local_proxy_user` | string |  | If your local server is behind a proxy, and it requires authentication - please specify your proxy username using this option. |
| `log_file` | string |  | Logs all the output to the file specified
Note: Specify a file name. File can be downloaded from the Artifacts tab after the workflow has completed.
 |
| `proxy_host` | string |  | If you are behind the corporate proxy setup, please specify your proxy host using this option. Host URL/IP |
| `proxy_pass` | string |  | If you are behind a corporate proxy which requires authentication, please specify your proxy password using this option. As of now, only HTTP Basic authentication is supported. |
| `proxy_port` | string |  | If you are behind the corporate proxy setup, please specify your proxy port using this option. The default value is 3128. |
| `proxy_user` | string |  | If you are behind a corporate proxy which requires authentication, please specify your proxy username using this option. As of now, only HTTP Basic authentication is supported. |
| `steps` | steps |  | Commands to initiate the test |
| `verbose` | integer | 0 | This option sets the level of logging required. Set 1 to debug issues related to setting up connections. Set 2 for logs related to network information. Set 3 to dump all communication to local servers for each request and response. The default value for this option is 1 |

## Examples

### example

Sample usage

```yaml
version: '2.1'
orbs:
  bs_local: shawnlobo96/browserstack-local@volatile
workflows:
  initialize_test:
    jobs:
      - bs_local/BrowserStack Local Start:
          access_key: BROWSERSTACK_ACCESS_KEY
          force_local: false
          log_file: bs_local.log
          steps:
            - run:
                command: |
                  npm install
                  node test.js
          verbose: 3
```