mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 09:52:29 +01:00
Use jsunitsaucelabs to run our unit tests on Saucelabs
This commit is contained in:
parent
502ac7ee4d
commit
210bb221a8
48
build/saucelabs-unit-test.js
Normal file
48
build/saucelabs-unit-test.js
Normal file
@ -0,0 +1,48 @@
|
||||
const JSUnitSaucelabs = require('jsunitsaucelabs')
|
||||
|
||||
var jsUnitSaucelabs = new JSUnitSaucelabs({
|
||||
username: process.env.SAUCE_USERNAME,
|
||||
password: process.env.SAUCE_ACCESS_KEY
|
||||
})
|
||||
|
||||
|
||||
// TODO : get all the browsers in sauce_browsers.yml
|
||||
|
||||
var testURL = 'http://localhost:3000/js/tests/index.html?hidepassed'
|
||||
jsUnitSaucelabs.start([
|
||||
['Windows 8', 'internet explorer', '10']
|
||||
], testURL, 'qunit', function (error, success) {
|
||||
if (typeof success !== 'undefined') {
|
||||
var taskIds = success['js tests']
|
||||
if (!taskIds || !taskIds.length) {
|
||||
throw new Error('Error starting tests through SauceLabs API')
|
||||
}
|
||||
|
||||
var waitingCallback = function (error, success) {
|
||||
if (error) {
|
||||
console.error(error)
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof success !== 'undefined') {
|
||||
if (!success.completed) {
|
||||
jsUnitSaucelabs.getStatus(taskIds[0], waitingCallback)
|
||||
} else {
|
||||
var test = success['js tests'][0]
|
||||
var passed = false
|
||||
if (test.result !== null) {
|
||||
passed = test.result.total === test.result.passed
|
||||
}
|
||||
console.log('Tested ' + testURL)
|
||||
console.log('Platform: ' + test.platform.join(','))
|
||||
console.log('Passed: ' + passed.toString())
|
||||
console.log('Url ' + test.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
taskIds.forEach(function (id) {
|
||||
jsUnitSaucelabs.getStatus(id, waitingCallback)
|
||||
})
|
||||
}
|
||||
})
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -3699,6 +3699,12 @@
|
||||
"verror": "1.10.0"
|
||||
}
|
||||
},
|
||||
"jsunitsaucelabs": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsunitsaucelabs/-/jsunitsaucelabs-1.0.0.tgz",
|
||||
"integrity": "sha512-5/PCsSwLGMLCiA4IOlbuxOcangxnEadEZTPwGvF4sHQ+NQoPbSIbCtK4Wce1IReJiyY6fQldA2uITycXZOhqrQ==",
|
||||
"dev": true
|
||||
},
|
||||
"kew": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz",
|
||||
|
@ -41,7 +41,7 @@
|
||||
"js-minify-bundle": "uglifyjs --compress typeofs=false --mangle --comments \"/^!/\" --output dist/js/bootstrap.bundle.min.js dist/js/bootstrap.bundle.js",
|
||||
"js-minify-docs": "uglifyjs --mangle --comments \"/^!/\" --output assets/js/docs.min.js assets/js/vendor/anchor.min.js assets/js/vendor/clipboard.min.js assets/js/vendor/holder.min.js assets/js/src/application.js assets/js/src/pwa.js",
|
||||
"js-test": "phantomjs ./node_modules/qunit-phantomjs-runner/runner.js js/tests/index.html 60",
|
||||
"js-test-cloud": "ruby -r webrick -e \"s = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd, :Logger => WEBrick::Log.new('/dev/null'), :AccessLog => []); trap('INT') { s.shutdown }; s.start\" & grunt saucelabs-qunit",
|
||||
"js-test-cloud": "ruby -r webrick -e \"s = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd, :Logger => WEBrick::Log.new('/dev/null'), :AccessLog => []); trap('INT') { s.shutdown }; s.start\" & node build/saucelabs-unit-test.js",
|
||||
"docs": "npm-run-all docs-compile docs-lint",
|
||||
"docs-lint": "htmllint --rc build/.htmllintrc _gh_pages/*.html _gh_pages/**/*.html js/tests/visual/*.html",
|
||||
"docs-compile": "bundle exec jekyll build",
|
||||
@ -90,6 +90,7 @@
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-saucelabs": "^9.0.0",
|
||||
"htmllint-cli": "^0.0.6",
|
||||
"jsunitsaucelabs": "^1.0.0",
|
||||
"node-sass": "^4.5.3",
|
||||
"nodemon": "^1.11.0",
|
||||
"npm-run-all": "^4.0.2",
|
||||
|
Loading…
x
Reference in New Issue
Block a user