Package detail

karma-browserstack-launcher

karma-runner371.1kMIT1.6.0

A Karma plugin. Launch any browser on BrowserStack!

karma-plugin, karma-launcher, browserstack, browser-stack

readme

karma-browserstack-launcher

js-standard-style npm version npm downloads

Build Status Dependency Status devDependency Status

Use any browser on BrowserStack!

Installation

The easiest way is to keep karma-browserstack-launcher as a devDependency in your package.json. Just run,

$ npm install karma-browserstack-launcher --save-dev

and it will be added automatically.

Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    // global config of your BrowserStack account
    browserStack: {
      username: 'jamesbond',
      accessKey: '007'
    },

    // define browsers
    customLaunchers: {
      bs_firefox_mac: {
        base: 'BrowserStack',
        browser: 'firefox',
        browser_version: '21.0',
        os: 'OS X',
        os_version: 'Mountain Lion'
      },
      bs_iphone5: {
        base: 'BrowserStack',
        device: 'iPhone 5',
        os: 'ios',
        os_version: '6.0'
      }
    },

    browsers: ['bs_firefox_mac', 'bs_iphone5']
  })
}

Global options

  • username your BS username, you can also use BROWSERSTACK_USERNAME env variable.
  • accessKey your BS access key, you can also use BROWSERSTACK_ACCESS_KEY env variable.
  • startTunnel do you wanna establish the BrowserStack tunnel ? (defaults to true)
  • tunnelIdentifier/localIdentifier in case you want to start the BrowserStack tunnel outside karma by setting startTunnel to false, set the identifier passed to the -localIdentifier option here (optional)
  • retryLimit how many times do you want to retry to capture the browser ? (defaults to 3)
  • captureTimeout the browser capture timeout (defaults to 120)
  • timeout the BS worker timeout (defaults to 300
  • build the BS worker build name (optional)
  • name the BS worker name (optional)
  • project the BS worker project name (optional)
  • proxyHost the host of your proxy for communicating with BrowserStack REST API and BrowserStackLocal (optional)
  • proxyPort the port of your proxy (optional)
  • proxyUser the username used for authentication with your proxy (optional)
  • proxyPass the password used for authentication with your proxy (optional)
  • proxyProtocol the protocol of your proxy (optional. default: http. valid: http or https)
  • forcelocal force traffic through the local BrowserStack tunnel, passes flag through to BrowserStackTunnel
  • video enable video recording of session on BrowserStack (defaults to true)

Per browser options

  • device name of the device
  • real_mobile or realMobile allows the session to run on a real mobile device instead of an emulator / simulator (optional, defaults to false)
  • browser name of the browser
  • browser_version version of the browser
  • os which platform ?
  • os_version version of the platform
  • build the BS worker build name (optional, defaults to global)
  • name the BS worker name (optional, defaults to global)
  • project the BS worker project name (optional, defaults to global)

Note: you can also pass through any additional options supported by browserstack. (EG. url, resolution, etc.)
See https://www.browserstack.com/automate/capabilities for a full list of supported options.

BrowserStack reporter

To report session results back to BrowserStack for display on your BrowserStack dashboard, use the following additional configuration:

// karma.conf.js
module.exports = function(config) {
  config.set({
    // The rest of your karma config is here
    // ...
    reporters: ['dots', 'BrowserStack']
  })
}

Browserstack iOS simulators

By default, your Selenium and JS tests will run on real iOS devices on BrowserStack. Since we are in the implementation phase, we are still working on a few things, such as adding more devices, ability to test on local URLs, etc.

In case your tests are facing any issues on real iOS devices, we also provide iOS simulators where you can run your automated tests smoothly.

To access our iOS simulators, use the following capabilities:

customLaunchers: {
  iPad_3: {
    real_mobile: false,
    device: 'iPad 3rd (6.0)',
    os: 'ios',
    'os_version': '6.0',
    'browser_version': null,
    browser: 'Mobile Safari'
  }
}

List of iOS simulators you can test on:

  • device: 'iPad 3rd', 'os_version': '5.1'
  • device: 'iPad 3rd (6.0)', 'os_version': '6.0'
  • device: 'iPad Mini', 'os_version': '7.0'
  • device: 'iPad 4th', 'os_version': '7.0'
  • device: 'iPhone 4S', 'os_version': '5.1'
  • device: 'iPhone 4S (6.0)', 'os_version': '6.0'
  • device: 'iPhone 5', 'os_version': '6.0'
  • device: 'iPhone 5S', 'os_version': '7.0'

CI/CD Build Environment Variables

Many CI/CD systems will make the name or ID of the currently running build available via an environment variable. The follow environment variables below are supported by default:

  • process.env.BUILD_NUMBER
  • process.env.BUILD_TAG
  • process.env.CI_BUILD_NUMBER
  • process.env.CI_BUILD_TAG
  • process.env.TRAVIS_BUILD_NUMBER
  • process.env.CIRCLE_BUILD_NUM
  • process.env.DRONE_BUILD_NUMBER

BrowserStack's REST API documentation explains how to retrieve a list of desired capabilities for browsers.


For more information on Karma see the homepage.


Check out sample code working with karma-browserstack-launcher here.

changelog

1.5.1 (2019-04-03)

Features

  • Switched to official browserstack local package, as it is frequently updated and used across multiple products.
  • Code refactored.

1.4.0 (2018-10-27)

Features

  • add support for the enableLoggingForApi property (b6776f4)
  • allow additional browserstack capabitilies to be configured verbatim (62fc997)

1.3.0 (2017-06-28)

Features

  • add support for using BrowserStackReporter with a proxy (b0f8031)
  • allow the user to disable browserstack video recording (b3cce6c)
  • deps: update to the latest (6c719d2)
  • deps: update to tunnel 2.0.1 (9617438)

1.2.0 (2017-01-29)

Features

  • pass forcelocal to tunnel (693a4aa)
  • permit overriding name, build, and project on a per-browser basis (9c77a96)
  • Update browserstacktunnel wrapper (4519a37)

1.1.1 (2016-09-05)

Bug Fixes

  • update incorrect launcher require path (5cc2d9c), closes #73

1.1.0 (2016-09-05)

Features

1.0.1 (2016-05-31)

Bug Fixes

  • urlencode proxy username and password (ab42eee)
  • Use separate property to shutdown workers (221d49f), closes #62

Features

  • Pass proxy url to browserstack api (0c1ca47)

1.0.0 (2016-05-04)

0.1.11 (2016-04-09)

Bug Fixes

  • issue with url being 'undefined' after disconnect (e746ecd), closes #63

0.1.10 (2016-02-12)

Bug Fixes

  • Capture timeout occurs even after tests have run successfully (1bd45b6), closes #17
  • Ensure the browser gets terminated (ea3ed1e)

Features

  • add build number env vars for compatibility with drone and other CI systems (054b8d4)

0.1.9 (2016-01-10)

Bug Fixes

  • Capture timeout occurs even after tests have run successfully (1bd45b6), closes #17

0.1.8 (2015-12-16)

Bug Fixes

  • Avoid setting tunnelIdentifier if startTunnel is false (fe61baa)
  • Property access on undefined config (a05e6cf), closes #52

Features

  • proxy: Add proxy settings to BrowserstackLocal (7c3da2b)

0.1.6 (2015-10-22)

0.1.5 (2015-09-09)

Bug Fixes

  • Update browserstacktunnel-wrapper & others (23fdc9d)

0.1.4

0.1.3 (2015-07-28)

0.1.2 (2014-12-03)

Features

  • update browserstacktunnel-wrapper to ~1.3.0 (88255ab)

0.1.1 (2014-06-02)

Bug Fixes

  • do not ser return_url to allow auto-watch (5fed790), closes #9 #9

0.1.0 (2014-05-30)

Features

  • add option for specifying BrowserStackTunnel jar path (13978c5)
  • better error when tunnel fails (20ea6bd)
  • update browserstack tunnel (dc8c48e)

0.0.8 (2014-01-13)

Features

  • support tunnelIdentifier (a1bac53)

0.0.7 (2013-12-03)

Bug Fixes

  • do not timeout if the test finishes before the timeout (38035eb)
  • kill the browser even after restarting (5cff1fa)
  • set default timeout (7ae8470)

Features

0.0.6 (2013-12-02)

Bug Fixes

  • emit browser failure after reaching retryLimit (8495542)
  • set tunnel to true (460e9d6)

Features

  • redirect to about:blank after execution (4c94a5a)
  • update browserstacktunnel dependency (3c3790b)

0.0.5 (2013-11-26)

Bug Fixes

  • fix browserstack api tunnelling option (9453045)
  • wait for the browserstack worker to be in state 'running' before timing out. (f8a3cc0)

0.0.4 (2013-08-24)

Bug Fixes

  • correct log msg (browser name) (88920bf)

0.0.3 (2013-08-20)

Bug Fixes

  • do not require browserStack config (48deb3b)
  • use browser_version as per v3 API (a435a8f)

Features

0.0.2 (2013-08-07)

Features

  • establish the ssh tunnel automatically (75cf642)
  • initial version (20f10ec)