Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: karma-runner/karma-sauce-launcher
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1af7432ab4b8ad1fe6e95612c1046e4d195134ff
Choose a base ref
...
head repository: karma-runner/karma-sauce-launcher
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 004d61df84ee4df18b39d82f217c23b3eb46d838
Choose a head ref
  • 13 commits
  • 7 files changed
  • 7 contributors

Commits on Aug 15, 2016

  1. Copy the full SHA
    3fe1c75 View commit details

Commits on Oct 24, 2016

  1. Copy the full SHA
    79b688c View commit details

Commits on Aug 22, 2017

  1. Copy the full SHA
    e792677 View commit details
  2. feat(config): add proxy option

    mattkubej authored and dignifiedquire committed Aug 22, 2017
    Copy the full SHA
    bae758a View commit details
  3. Copy the full SHA
    bae326f View commit details
  4. docs(readme): add hint to platform configurator

    Adds an Android example, also.
    axe312ger authored and dignifiedquire committed Aug 22, 2017
    Copy the full SHA
    0219065 View commit details
  5. feat(config): allow SE traffic to be sent via Sauce Connect's Relay

    Tests with Sauce Connect have two connections to Sauce Labs, a
    tunnel from Sauce Connect client to host, and Selenium commands themselves which are sent independently.
    
    Sauce Connect is able to relay Selenium commands through the established tunnel, which helps obviate proxy and other issues with Selenium traffic.
    
    This change adds config values `connectLocationForSERelay` and
    `connectPortForSERelay` which allow users to make Karma send Selenium
    commands through a Sauce Connect instance at that host and port.
    DylanLacey authored and dignifiedquire committed Aug 22, 2017
    Copy the full SHA
    0ac67d4 View commit details
  6. Copy the full SHA
    0362ad5 View commit details
  7. Copy the full SHA
    f607303 View commit details
  8. Copy the full SHA
    79c70c2 View commit details
  9. Copy the full SHA
    a21fbd9 View commit details
  10. Copy the full SHA
    f783f63 View commit details
  11. chore: release v1.2.0

    dignifiedquire committed Aug 22, 2017
    Copy the full SHA
    004d61d View commit details
Showing with 3,504 additions and 31 deletions.
  1. +12 −9 .travis.yml
  2. +14 −0 CHANGELOG.md
  3. +30 −2 README.md
  4. +21 −3 lib/sauce_launcher.js
  5. +6 −1 lib/sauce_reporter.js
  6. +23 −16 package.json
  7. +3,398 −0 yarn.lock
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
sudo: false
language: node_js
node_js:
- '4.0'
- '0.12'
- '0.10'
- 4
- stable

before_install:
- npm i -g npm
- npm config set loglevel warn
- npm i -g npm
- npm config set loglevel warn

before_script:
- npm install -g grunt-cli
- rm -rf node_modules/karma-sauce-launcher
- cd node_modules && ln -nsf ../ karma-sauce-launcher && cd ../
- npm install -g grunt-cli
- rm -rf node_modules/karma-sauce-launcher
- cd node_modules && ln -nsf ../ karma-sauce-launcher && cd ../

script:
- grunt
- grunt

notifications:
email: false
env:
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<a name="1.2.0"></a>
# [1.2.0](https://github.com/karma-runner/karma-sauce-launcher/compare/v1.1.0...v1.2.0) (2017-08-22)


### Features

* **config:** add proxy option ([bae758a](https://github.com/karma-runner/karma-sauce-launcher/commit/bae758a))
* **config:** allow SE traffic to be sent via Sauce Connect's Relay ([0ac67d4](https://github.com/karma-runner/karma-sauce-launcher/commit/0ac67d4))
* **config:** pass parentTunnel to selenium ([bae326f](https://github.com/karma-runner/karma-sauce-launcher/commit/bae326f))
* **deps:** upgrade sauce connect ([e792677](https://github.com/karma-runner/karma-sauce-launcher/commit/e792677))
* **launcher:** expose commandTimeout, idleTimeout, maxDuration options ([3fe1c75](https://github.com/karma-runner/karma-sauce-launcher/commit/3fe1c75)), closes [#62](https://github.com/karma-runner/karma-sauce-launcher/issues/62)



<a name="1.1.0"></a>
# [1.1.0](https://github.com/karma-runner/karma-sauce-launcher/compare/v1.0.0...v1.1.0) (2016-10-24)

32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -23,6 +23,8 @@ npm install karma-sauce-launcher --save-dev

This launcher is typically used in CI to run your unit tests across many browsers and platforms on Sauce Labs. However, you can also use it locally to debug tests in browsers not available on your machine. It is expected that you are already familiar with Karma when configuring this launcher, so if you are new to Karma, head over to the [Karma website](http://karma-runner.github.io/).

The [Sauce Labs platform configurator](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator/#/) can help to find the correct configuration for your desired test platform.

### Adding karma-sauce-launcher to an existing Karma config

To configure this launcher, you need to add two properties to your top-level Karma config, `sauceLabs` and `customLaunchers`, set the `browsers` array to use Sauce Labs browsers, and add the `sauceLabs` reporter.
@@ -56,6 +58,14 @@ module.exports = function(config) {
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11'
},
sl_android: {
base: 'SauceLabs',
browserName: 'Browser',
platform: 'Android',
version: '4.4',
deviceName: 'Samsung Galaxy S3 Emulator',
deviceOrientation: 'portrait'
}
}

@@ -94,6 +104,11 @@ Default: `process.env.SAUCE_ACCESS_KEY`

Your Sauce Labs access key which you will see on your [account page](https://saucelabs.com/account).

### proxy
Type: `String`

Proxy for connecting to Sauce REST API, which is used to communicate job updates of pass/fail.

### startConnect
Type: `Boolean`
Default: `true`
@@ -113,6 +128,19 @@ Default:

Options to send to Sauce Connect. Check [here](https://github.com/bermi/sauce-connect-launcher#advanced-usage) for all available options.

### connectLocationForSERelay
Type: `String`
default: `ondemand.saucelabs.com`

If set, will attempt to connect to the specified host as a Selenium relay. This is intended to send Selenium commands through a Sauce Connect tunnel.

### connectPortForSERelay
Type: `Integer`
Default: 80

If set, will change the host used to connect to the Selenium server. This is intended to send Selenium commands through a Sauce Connect tunnel.


### build
Type: `String`
Default: *One of the following environment variables*:
@@ -159,14 +187,14 @@ Type: `String`
Default: `null`

Control who can view job details. Available visibility levels are documented on
the [SauceLabs website](https://docs.saucelabs.com/reference/test-configuration/#job-visibility).
the [SauceLabs website](https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-JobVisibility).

### customData
Type: `Object`
Default: `{}`

Send arbitrary data alongside your tests. See
the [SauceLabs documentation](https://docs.saucelabs.com/reference/test-configuration/#recording-custom-data)
the [SauceLabs documentation](https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-CustomData)
for more details.


24 changes: 21 additions & 3 deletions lib/sauce_launcher.js
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ function processConfig (helper, config, args) {

var username = args.username || config.username || process.env.SAUCE_USERNAME
var accessKey = args.accessKey || config.accessKey || process.env.SAUCE_ACCESS_KEY
var proxy = args.proxy || config.proxy
var startConnect = config.startConnect !== false
var tunnelIdentifier = args.tunnelIdentifier || config.tunnelIdentifier

@@ -27,6 +28,9 @@ function processConfig (helper, config, args) {
tunnelIdentifier: tunnelIdentifier
})

var seleniumHostLocation = config.connectLocationForSERelay || 'ondemand.saucelabs.com'
var seleniumHostPort = config.connectPortForSERelay || connectOptions.port || 80

var build = process.env.BUILD_NUMBER ||
process.env.BUILD_TAG ||
process.env.CI_BUILD_NUMBER ||
@@ -47,6 +51,9 @@ function processConfig (helper, config, args) {
'disable-popup-handler': true,
build: build || null,
public: null,
commandTimeout: 300,
idleTimeout: 90,
maxDuration: 1800,
customData: {}
}

@@ -61,6 +68,10 @@ function processConfig (helper, config, args) {
'record-video': config.recordVideo,
'record-screenshots': config.recordScreenshots,
public: config.public,
parentTunnel: config.parentTunnel,
commandTimeout: config.commandTimeout,
idleTimeout: config.idleTimeout,
maxDuration: config.maxDuration,
customData: config.customData
}, {
// Need to rename some properties from args
@@ -76,7 +87,10 @@ function processConfig (helper, config, args) {
browserName: browserName,
username: username,
accessKey: accessKey,
startConnect: startConnect
startConnect: startConnect,
seleniumHost: seleniumHostLocation,
seleniumPort: seleniumHostPort,
proxy: proxy
}
}

@@ -99,7 +113,10 @@ var SauceLauncher = function (
var browserName = pConfig.browserName
var username = pConfig.username
var accessKey = pConfig.accessKey
var proxy = pConfig.proxy
var startConnect = pConfig.startConnect
var seleniumHost = pConfig.seleniumHost
var seleniumPort = pConfig.seleniumPort

var pendingCancellations = 0
var sessionIsReady = false
@@ -111,7 +128,7 @@ var SauceLauncher = function (
var log = logger.create('launcher.sauce')
var driverLog = logger.create('wd')

var driver = wd.promiseChainRemote('ondemand.saucelabs.com', 80, username, accessKey)
var driver = wd.promiseChainRemote(seleniumHost, seleniumPort, username, accessKey)

driver.on('status', function (info) {
driverLog.debug(info.cyan)
@@ -155,7 +172,8 @@ var SauceLauncher = function (
credentials: {
username: username,
password: accessKey
}
},
proxy: proxy
}

sessionIsReady = true
7 changes: 6 additions & 1 deletion lib/sauce_reporter.js
Original file line number Diff line number Diff line change
@@ -27,7 +27,12 @@ var SauceReporter = function (logger, /* sauce:jobMapping */ jobMapping) {
if (browserId in jobMapping) {
var jobDetails = jobMapping[browserId]

var sauceApi = new SauceLabs(jobDetails.credentials)
var sauceApiOptions = jobDetails.credentials
if (jobDetails.proxy) {
sauceApiOptions.proxy = jobDetails.proxy
}

var sauceApi = new SauceLabs(sauceApiOptions)

// We record pass/fail status, as well as the full results in "custom-data".
var payload = {
39 changes: 23 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "karma-sauce-launcher",
"version": "1.1.0",
"version": "1.2.0",
"description": "A Karma plugin. Launch any browser on SauceLabs!",
"main": "index.js",
"scripts": {
@@ -19,55 +19,62 @@
],
"author": "Vojta Jina <vojta.jina@gmail.com>",
"dependencies": {
"q": "^1.4.1",
"sauce-connect-launcher": "^0.17.0",
"saucelabs": "^1.3.0",
"wd": "^1.0.0"
"q": "^1.5.0",
"sauce-connect-launcher": "^1.2.2",
"saucelabs": "^1.4.0",
"wd": "^1.4.0"
},
"license": "MIT",
"devDependencies": {
"eslint-config-standard": "^6.0.1",
"eslint-plugin-promise": "3.3.0",
"eslint-plugin-standard": "^2.0.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-promise": "3.5.0",
"eslint-plugin-standard": "^3.0.1",
"grunt": "^1.0.1",
"grunt-auto-release": "^0.0.6",
"grunt-auto-release": "^0.0.7",
"grunt-bump": "^0.8.0",
"grunt-conventional-changelog": "^6.1.0",
"grunt-conventional-github-releaser": "^1.0.0",
"grunt-eslint": "^19.0.0",
"grunt-eslint": "^20.0.0",
"grunt-karma": "2.x",
"grunt-npm": "^0.0.2",
"jasmine": "^2.5.2",
"jasmine": "^2.7.0",
"karma": "1.x || ^0.13.11",
"karma-jasmine": "1.x || ^0.3.6",
"karma-sauce-launcher": "1.x || *",
"load-grunt-tasks": "^3.5.2"
},
"contributors": [
"Mark Ethan Trostler <mark@zzo.com>",
"Chris Wren <chris@saucelabs.com>",
"dignifiedquire <dignifiedquire@gmail.com>",
"Chris Wren <chris@saucelabs.com>",
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"Chris Wren <cthewren@gmail.com>",
"Chris Wren <chriswrendev@gmail.com>",
"Pawel Kozlowski <pkozlowski.opensource@gmail.com>",
"Ralf Kistner <ralf@embarkmobile.com>",
"Takashi Aoki <taak77@gmail.com>",
"Julian Motz <me@julianmotz.com>",
"Jason Marshall <jdmarshall@users.noreply.github.com>",
"Santiago Suarez Ordoñez <santiycr@gmail.com>",
"Sahat Yalkabov <sakhat@gmail.com>",
"Shahar Talmi <shahar.talmi@gmail.com>",
"jackspirou <jack.spirou@target.com>",
"sebv <seb.vincent@gmail.com>",
"Caitlin Potter <caitpotter88@gmail.com>",
"Benedikt Rötsch <axe312ger@users.noreply.github.com>",
"yhwh <ferrero.nicolas@gmail.com>",
"Caitlin Potter <caitpotter88@gmail.com>",
"Dylan Lacey <github@dylanlacey.com>",
"Eduardo Rabelo <oieduardorabelo@gmail.com>",
"Jamie Mason <siunmaru@gmail.com>",
"Johannes Würbach <johannes.wuerbach@googlemail.com>",
"Johannes Würbach <johannes.wuerbach@googlemail.com>",
"Julian Motz <me@julianmotz.com>",
"Maks3w <github.maks3w@virtualplanets.net>",
"Matt Kubej <mkubej@gmail.com>",
"OniOni <mathieu.c.sabourin@gmail.com>",
"Parashuram <code@nparashuram.com>",
"Parashuram N <code@r.nparashuram.com>",
"Peter Johason <peter@peterjohanson.com>",
"Sahat Yalkabov <sakhat@gmail.com>"
"Peter Johason <peter@peterjohanson.com>"
]
}
Loading