Skip to content

douglasduteil/gesalakacula

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gesalakacula Build Status NPM version

Generate SauceLabs Karma Custom Launchers --- aka --- Ge-Sa-La-Ka-Cu-La-aaaaa

It's intention is to be used with karma and karma-sauce-launcher, which runs unit tests on the Sauce Labs browsers.

Installation

gesalakacula can be installed using

$ npm i -D gesalakacula

Usage

// In your karma.conf.js
var geSaLaKaCuLa = require('gesalakacula');

module.exports = function(config) {
  var customLaunchers = geSaLaKaCuLa({
    'Windows 7': {
      'internet explorer': '8..11'
    }
  })

  // [...]

  config.browsers = Object.keys(customLaunchers);
  config.customLaunchers = customLaunchers;
});

Config Object

gesalakacula generate launchers from a config object. This one has 3 main areas:

{
  // The platforms      (1)
  'Linux': { 
    // The browsers     (2)
    'chrome': [
      // The versions   (3)
    ]
  }
}

You're suppose to use the Sauce Labs platform(1)/browser(2)/versions(3) combos.

For the versions(3) you can use an array or a range string like : \d+..\d+.

Sample

« All The Sauce Labs Browsers Are Mine To Test ! GeSaLaKaCuLa-aaaaa ! »

geSaLaKaCuLa({
  'Linux': {
    'android': '4.0,4.1,4.2,4.3,4.4',
    'chrome': '26..39,beta,dev',
    'firefox': '3.6,4..34,beta,dev',
    'opera': '12'
  },
  'OS X 10.6': {
    'ipad': '4.3, 5.0',
    'iphone': '4.3, 5.0',
    'chrome': '27..39,beta,dev',
    'firefox': '4..34,beta,dev',
    'safari': '5'
  },
  'OS X 10.8': {
    'ipad': '5.1,6.0,6.1',
    'iphone': '5.1,6.0,6.1',
    'chrome': '27..39,beta,dev',
    'safari': '6'
  },
  'OS X 10.9': {
    'ipad': '7.0,7.1,8.0,8.1',
    'iphone': '7.0,7.1,8.0,8.1',
    'chrome': '31..39',
    'firefox': '4..34,beta,dev',
    'safari': '7'
  },
  'OS X 10.10': {
    'chrome': '37..39',
    'firefox': '32..34',
    'safari': '8'
  },
  'Windows XP': {
    'chrome': '26..39,beta,dev',
    'firefox': '3.0,3.5,3.6,4..34,beta,dev',
    'internet explorer': '6..8',
    'opera': '11..12'
  },
  'Windows 7': {
    'chrome': '26..39,beta,dev',
    'firefox': '3.0,3.5,3.6,4..34,beta,dev',
    'internet explorer': '8..11',
    'opera': '11..12'
  },
  'Windows 8': {
    'chrome': '26..39,beta,dev',
    'firefox': '3.0,3.5,3.6,4..34,beta,dev',
    'internet explorer': '10'
  },
  'Windows 8.1': {
    'chrome': '26..39,beta,dev',
    'firefox': '3.0,3.5,3.6,4..34,beta,dev',
    'internet explorer': '11'
  }
});
// Run on every platforms-browsers-versions on Sauce Labs (known 2015/1/1)

Check my dummy fuzzy batman for more

Extra: Re-Ka-La-Re-Ka-La-Re-Ka-La

Sauce Labs provide free accounts for open source project with

  • Unlimited testing minutes
  • 5 parallel tests

giphy

Karma is a bit difficult to configure with Sauce Labs. Like there is no "queue" principal, Karma try to connect to all the browsers at the same time. There for when a browser in the Sauce Labs queue will often reach the browserDisconnectTimeout and cause the test to fail without actually running them.

So I came with a simple idea of recursively restarting a karma server with the 5 parallel browsers limit of Sauce Labs.

Thus, there is not potential browserDisconnectTimeout of browser in the Sauce Labs queue...

giphy 1

Usage

var reKaLa = geSaLaKaCuLa.recursiveKarmaLauncher;

reKaLa({
  karma: require('karma').server,
  customLaunchers: geSaLaKaCuLa({'Linux': {'chrome': '20..30'}})
}, function (code){
  console.log('reKaLa end with ', code);
  process.exit(code);
});

.recursiveKarmaLauncher(opts, doneCallback)

opts : The options for reKaLa (TODO can be using as extended karma options ?)

require :

{
  karma: require('karma').server
}

default :

{
  configFile: './karma.conf.js',
  customLaunchers: {},
  maxConcurrentRun : 5
}

doneCallback: will be call at the recursion end with the incremented exit code (of each karma run).

License

Copyright © 2014 Douglas Duteil <douglasduteil@gmail.com>
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See the LICENCE file for more details.

About

Generate SauceLabs Karma Custom Launchers --- aka --- Ge-Sa-La-Ka-Cu-La-aaaaa

Resources

License

Stars

Watchers

Forks

Packages

No packages published