Last active
August 29, 2015 14:15
-
-
Save niwaringo/d4c74124c56631d3ab76 to your computer and use it in GitHub Desktop.
Karmaを使ってSauceLabsの同時接続上限にかからないようにテストを実行する。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(config) { | |
var customLaunchers = require('./saucebrowsers.js'); | |
config.set({ | |
basePath: '', | |
frameworks: ['mocha', 'browserify'], | |
files: [./**/*.js], | |
exclude: [], | |
preprocessors: {}, | |
port: 9876, | |
colors: true, | |
logLevel: config.LOG_INFO, | |
autoWatch: true, | |
sauceLabs: { | |
username: '***', | |
accessKey: '***' | |
}, | |
customLaunchers: customLaunchers, | |
browsers: [process.env.sauce_browser_name], | |
reporters: ['dots', 'saucelabs'], | |
singleRun: true | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var version = require('./package.json').version; | |
var build = 'build:' + version; | |
var chrome_version = '39'; | |
var firefox_version = '35'; | |
module.exports = { | |
//Chrome | |
chrome_win7: { | |
testName: 'chrome_win7', | |
base: 'SauceLabs', | |
browserName: 'chrome', | |
platform: 'Windows 7', | |
version: chrome_version, | |
build: build, | |
passed: true, | |
public: 'public' | |
}, | |
chrome_mac: { | |
testName: 'chrome_mac', | |
base: 'SauceLabs', | |
browserName: 'chrome', | |
platform: 'OS X 10.10', | |
version: chrome_version, | |
build: build, | |
passed: true, | |
public: 'public' | |
}, | |
//Firefox | |
firefox_win7: { | |
testName: 'firefox_win7', | |
base: 'SauceLabs', | |
browserName: 'firefox', | |
platform: 'Windows 7', | |
version: firefox_version, | |
build: build, | |
passed: true, | |
public: 'public' | |
}, | |
firefox_mac: { | |
testName: 'firefox_mac', | |
base: 'SauceLabs', | |
browserName: 'firefox', | |
platform: 'OS X 10.10', | |
version: firefox_version, | |
build: build, | |
passed: true, | |
public: 'public' | |
}, | |
//safari mac | |
safari_mac: { | |
testName: 'safari_mac', | |
base: 'SauceLabs', | |
name: 'OS X 10.10 safari', | |
browserName: 'safari', | |
platform: 'OS X 10.10', | |
build: build, | |
passed: true, | |
public: 'public' | |
}, | |
//IE | |
ie_9_win7: { | |
testName: 'ie_9_win7', | |
base: 'SauceLabs', | |
browserName: 'internet explorer', | |
platform: 'Windows 7', | |
version: '9', | |
build: build, | |
passed: true, | |
public: 'public' | |
}, | |
ie_10_win7: { | |
testName: 'ie_10_win7', | |
base: 'SauceLabs', | |
browserName: 'internet explorer', | |
platform: 'Windows 7', | |
version: '10', | |
build: build, | |
passed: true, | |
public: 'public' | |
}, | |
ie_11_win81: { | |
testName: 'ie_11_win81', | |
base: 'SauceLabs', | |
browserName: 'internet explorer', | |
platform: 'Windows 8.1', | |
version: '11', | |
build: build, | |
passed: true, | |
public: 'public' | |
}, | |
//iphone | |
iphone: { | |
testName: 'iphone-8.1', | |
base: 'SauceLabs', | |
browserName: 'iphone', | |
platform: 'OS X 10.10', | |
version: '8.1', | |
build: build, | |
passed: true, | |
public: 'public' | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spawn = require('child_process').spawn; | |
var browsers = Object.keys(require('./saucebrowsers.js')); | |
var karmaStart = function(idx) { | |
if (idx >= browsers.length) return; | |
process.env.sauce_browser_name = browsers[idx]; | |
var runner = spawn('./node_modules/karma/bin/karma', ['start']); | |
console.log('Start: ' + process.env.sauce_browser_name); | |
runner.stdout.on('data', function(data) { | |
console.log(data.toString()); | |
}); | |
runner.stderr.on('data', function(data) { | |
console.log('stderr: ' + data); | |
}); | |
runner.on('close', function(code) { | |
console.log('Close: ' + process.env.sauce_browser_name); | |
karmaStart(++idx); | |
}); | |
}; | |
karmaStart(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment