@wdio/browserstack-service

WebdriverIO service for better Browserstack integration

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@wdio/browserstack-service
7,7241497.25.12 days ago4 years agoMinified + gzip package size for @wdio/browserstack-service in KB

Readme

WebdriverIO Browserstack Service
A WebdriverIO service that manages local tunnel and job metadata for Browserstack users.

Installation

The easiest way is to keep @wdio/browserstack-service as a devDependency in your package.json, via:
npm install @wdio/browserstack-service --save-dev

Instructions on how to install WebdriverIO can be found here.

Configuration

WebdriverIO has Browserstack support out of the box. You should simply set user and key in your wdio.conf.js file. This service plugin provides supports for Browserstack Tunnel. Set browserstackLocal: true also to activate this feature. Reporting of session status on BrowserStack will respect strict setting of Cucumber options.
// wdio.conf.js
exports.config
    // ...
    user: process.env.BROWSERSTACK_USERNAME,
    key: process.env.BROWSERSTACK_ACCESS_KEY,
    services: [
        ['browserstack', {
            browserstackLocal: true
        }]
    ],
    // ...
};

Options

In order to authorize to the BrowserStack service your config needs to contain a user and key option.

browserstackLocal

Set this to true to enable routing connections from Browserstack cloud through your computer.
Type: Boolean
Default: false

preferScenarioName

Cucumber only. Set this to true to enable updating the session name to the Scenario name if only a single Scenario was ran. Useful when running in parallel with wdio-cucumber-parallel-execution.
Type: Boolean
Default: false

forcedStop

Set this to true to kill the browserstack process on complete, without waiting for the browserstack stop callback to be called. This is experimental and should not be used by all. Mostly necessary as a workaraound for this issue.
Type: Boolean
Default: false

app

Appium set this with app file path available locally on your machine to use the app as application under test for Appium sessions.
Type: String or JsonObject
Default: undefined
List of available app values:

path

Use local available app file path as application under test for appium.
services: [
  ['browserstack', {
    app: '/path/to/local/app.apk'
    // OR
    app: {
      path: '/path/to/local/app.apk'
    }
  }]
]

Pass customid while app upload.
services: [
  ['browserstack', {
    app: {
      path: '/path/to/local/app.apk',
      custom_id: 'custom_id'
    }
  }]
]

id

Use app url returned after uploading app to BrowserStack.
services: [
  ['browserstack', {
    app: 'bs://<app-id>'
    // OR
    app: {
      id: 'bs://<app-id>'
    }
  }]
]

customid

use custom
id of already uploaded apps
services: [
  ['browserstack', {
    app: 'custom_id'
    // OR
    app: {
      custom_id: 'custom_id'
    }
  }]
]

shareableid

use shareableid of already uploaded apps
services: [
  ['browserstack', {
    app: 'username/custom_id'
    // OR
    app: {
      shareable_id: 'username/custom_id'
    }
  }]
]

opts

Specified optional will be passed down to BrowserstackLocal.
Type: Object
Default: {}
List of available local testing modifiers to be passed as opts:

Local Identifier

If doing simultaneous multiple local testing connections, set this uniquely for different processes -
opts = { localIdentifier: "randomstring" };

Verbose Logging

To enable verbose logging -
opts = { verbose: "true" };

Note - Possible values for 'verbose' modifier are '1', '2', '3' and 'true'

Force Local

To route all traffic via local(your) machine -
opts = { forceLocal: "true" };

Folder Testing

To test local folder rather internal server, provide path to folder as value of this option -
opts = { f: "/my/awesome/folder" };

Force Start

To kill other running Browserstack Local instances -
opts = { force: "true" };

Only Automate

To disable local testing for Live and Screenshots, and enable only Automate -
opts = { onlyAutomate: "true" };

Proxy

To use a proxy for local testing -
  • proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
  • proxyPort: Port for the proxy, defaults to 3128 when -proxyHost is used
  • proxyUser: Username for connecting to proxy (Basic Auth Only)
  • proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified

opts = {
  proxyHost: "127.0.0.1",
  proxyPort: "8000",
  proxyUser: "user",
  proxyPass: "password",
};

Local Proxy

To use local proxy in local testing -
  • localProxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
  • localProxyPort: Port for the proxy, defaults to 8081 when -localProxyHost is used
  • localProxyUser: Username for connecting to proxy (Basic Auth Only)
  • localProxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified

opts = {
  localProxyHost: "127.0.0.1",
  localProxyPort: "8000",
  localProxyUser: "user",
  localProxyPass: "password",
};

PAC (Proxy Auto-Configuration)

To use PAC (Proxy Auto-Configuration) in local testing -
  • pac-file: PAC (Proxy Auto-Configuration) file’s absolute path

opts = { "pac-file": "<pac_file_abs_path>" };

Binary Path

By default, BrowserStack local wrappers try downloading and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument. Path to specify local Binary path -
opts = { binarypath: "/path/to/binary" };

Logfile

To save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory. To specify the path to file where the logs will be saved -
opts = { verbose: "true", logFile: "./local.log" };

For more information on WebdriverIO see the homepage
.