??????????????
????????????????????????????????????????????????????????????黯???????????????????б??????????????????????????????????????????С??????????(??????????????????)???????????????????????????“???????”??????ж?????????
????????????????
?????????????е?????????????????????????????????κ????????????????????????????????????????????????????????????????????????????????????????????й???????????????????????????????????飬?????????????????????? log ???????????????!?????????????
??????????????????????????к????????????????????????????????????????????????????豸?????????????????????????? SauceLabs????????????????????????????????? 8 ?????????????? 90 ??С??????????????????????????????????????????????????? Vue ?????????????м?????????
???????????????????????????? SauceLabs ?????????????п????? JavaScript ??????????????????????????????а汾?? Windows IE?? Mac Safari ???????????豸???????????????????????????????????????????????

?????????? JavaScript ???????? SauceLabs ??????????????????????? Karma ???????????????????????????????????? Karma + SauceLabs ???п??????????????????????????????????????????Щ???????????????????? Karma???????? ???? ??????????????????÷?????
???????2??????????????д?????????????????????????α?д?????????????????ο? js-test-workflows ?????????????? JavaScript ????????
???????ò???
????1. ??? Karma
???????? SauceLabs ?????????? Karma ??????? karma.sauce.js ??????????? karma-sauce-launcher ?????????????????????????????????????????????????? Karma ????????????????衣
????????????? Karma
????npm install karma -g
??????????????? jasmine (???????????????? assert?? should ??)
????npm install karma-jasmine
????2. ??? karma-sauce-launcher
??????????????? Karma ?? SauceLabs ?????????????????????????????????????????????????????????? SauceLabs ?????????????汾?????????????????????????????????????????????????????????????????????????????????????????????????????
????npm install karma-sauce-launcher --save-dev
????3. ??? SauceLabs ????? accessKey
????SauceLabs ??????????https://saucelabs.com/signup/...
?????????????????????? Dashboard?? ?????????????????????????? User Setting ????????????
??????? USERNAME ?? Access Key??

??????????????????? sauce.json ????????????? userName ?? accessKey??????????ε??????????? SauceLabs ????????????????
????{
????"username": "xxxx"??
????"accesskey": "xxx"
????}
????4. ??д???????????
?????????????????????????? karma.sauce.js ??????????????????????????????? Karma ?????????????????????£?
var sauce = require('./sauce.json'); // ???? userName ?? key
// ??????? SauceLabs ????????????????????????е???????????汾
function createCustomLauncher (browser?? platform?? version) {
return {
base: 'SauceLabs'??
browserName: browser??
platform: platform??
version: version
};
}
// ?????????????????????????????
// ????????????????SauceLabs ?????????????????????????????
// ?????????????豸?б??https://saucelabs.com/platforms
var customLaunchers = {
// ?????????
sl_win_chrome: createCustomLauncher('chrome'?? 'Windows 7')??
sl_mac_chrome: createCustomLauncher('chrome'?? 'OS X 10.10')??
sl_win_firefox: createCustomLauncher('firefox'?? 'Windows 7')??
sl_mac_firefox: createCustomLauncher('firefox'?? 'OS X 10.10')??
sl_mac_safari: createCustomLauncher('safari'?? 'OS X 10.11')??
// ????豸?????
sl_ios_8_safari: createCustomLauncher('iphone'?? null?? '8.4')??
sl_ios_9_safari: createCustomLauncher('iphone'?? null?? '9.3')??
sl_android_4_2: createCustomLauncher('android'?? null?? '4.2')??
sl_android_5_1: createCustomLauncher('android'?? null?? '5.1')??
// Microsoft Edge
sl_edge: createCustomLauncher('MicrosoftEdge'?? 'Windows 10')??
// IE ?????
sl_ie_9: createCustomLauncher('internet explorer'?? 'Windows 7'?? '9')??
sl_ie_10: createCustomLauncher('internet explorer'?? 'Windows 8'?? '10')??
sl_ie_11: createCustomLauncher('internet explorer'?? 'Windows 10'?? '11')
};
// Karma ???ò???
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (KarmaConfig) {
// ?? SauceLabs ???? username ?? accesskey ?????????????
if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
process.env.SAUCE_USERNAME = sauce.username;
process.env.SAUCE_ACCESS_KEY = sauce.accesskey;
}
// ???ò?????????
var maxExecuteTime = 5*60*1000;
KarmaConfig.set({
// ???????????????
basePath: ''??
// ????????
frameworks: ['jasmine']??
// ???? Karma ?????Щ js ????????????????в???
files: [
'../src/**/*.js'??
'../test/**/*.js'
]??
// SauceLabs ??????????????????ü??????????μ????????????ο???ο???
// https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options
sauceLabs: {
// ??????????????????????????????????? public
public: 'public'??
// ???????????????????????????
recordVideo: false??
// ???????????????????????
recordScreenshots: false??
// ????????
testName: 'Cross browsers test'??
// ????????????????????????????????????????build ???????
build: 'build-' + Date.now()
}??
// ????????в???? SauceLabs ?????
customLaunchers: customLaunchers??
browsers: Object.keys(customLaunchers)??
// ??????????????
reporters: ['progress'?? 'saucelabs']??
// ??????
captureTimeout: maxExecuteTime??
browserNoActivityTimeout: maxExecuteTime
});
}