mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-28 20:52:21 +01:00
Use sauce_browsers.json.
This commit is contained in:
parent
b001118c98
commit
54d4507281
@ -1,7 +1,8 @@
|
||||
[
|
||||
{
|
||||
"browserName": "safari",
|
||||
"platform": "OS X 10.11"
|
||||
"platform": "OS X 10.11",
|
||||
"version": "latest"
|
||||
},
|
||||
{
|
||||
"browserName": "chrome",
|
||||
|
@ -1,54 +1,86 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const JSUnitSaucelabs = require('jsunitsaucelabs')
|
||||
|
||||
// Docs: https://wiki.saucelabs.com/display/DOCS/Platform+Configurator
|
||||
// Mac Opera is not currently supported by Sauce Labs
|
||||
// Win Opera 15+ is not currently supported by Sauce Labs
|
||||
// iOS Chrome is not currently supported by Sauce Labs
|
||||
|
||||
const jsUnitSaucelabs = new JSUnitSaucelabs({
|
||||
username: process.env.SAUCE_USERNAME,
|
||||
password: process.env.SAUCE_ACCESS_KEY,
|
||||
build: process.env.TRAVIS_JOB_ID
|
||||
})
|
||||
|
||||
const testURL = 'http://localhost:3000/js/tests/index.html?hidepassed'
|
||||
const browsersFile = require(path.resolve(__dirname, './sauce_browsers.json'))
|
||||
let jobsDone = 0
|
||||
let jobsSuccess = 0
|
||||
|
||||
// TODO : get all the browsers in sauce_browsers.yml
|
||||
// Docs: https://wiki.saucelabs.com/display/DOCS/Platform+Configurator
|
||||
// Mac Opera is not currently supported by Sauce Labs
|
||||
// Win Opera 15+ is not currently supported by Sauce Labs
|
||||
// iOS Chrome is not currently supported by Sauce Labs
|
||||
|
||||
const testURL = 'http://localhost:3000/js/tests/index.html?hidepassed'
|
||||
|
||||
jsUnitSaucelabs.start([
|
||||
['Windows 8', 'internet explorer', '10']
|
||||
], testURL, 'qunit', (error, success) => {
|
||||
if (typeof success !== 'undefined') {
|
||||
const taskIds = success['js tests']
|
||||
if (!taskIds || !taskIds.length) {
|
||||
throw new Error('Error starting tests through SauceLabs API')
|
||||
}
|
||||
|
||||
const waitingCallback = (error, success) => {
|
||||
if (error) {
|
||||
console.error(error)
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof success !== 'undefined') {
|
||||
if (!success.completed) {
|
||||
jsUnitSaucelabs.getStatus(taskIds[0], waitingCallback)
|
||||
} else {
|
||||
const test = success['js tests'][0]
|
||||
let 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((id) => {
|
||||
jsUnitSaucelabs.getStatus(id, waitingCallback)
|
||||
})
|
||||
const waitingCallback = (error, body, id) => {
|
||||
if (error) {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof body !== 'undefined') {
|
||||
if (!body.completed) {
|
||||
setTimeout(() => {
|
||||
jsUnitSaucelabs.getStatus(id, (error, body) => {
|
||||
waitingCallback(error, body, id)
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
const test = body['js tests'][0]
|
||||
let 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} \n`)
|
||||
|
||||
if (passed) {
|
||||
jobsSuccess++
|
||||
}
|
||||
jobsDone++
|
||||
|
||||
// Exit
|
||||
if (jobsDone === browsersFile.length - 1) {
|
||||
jsUnitSaucelabs.stop()
|
||||
process.exit(jobsDone === jobsSuccess ? 0 : 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jsUnitSaucelabs.on('tunnelCreated', () => {
|
||||
browsersFile.forEach((tmpBrowser) => {
|
||||
const broPlatform = typeof tmpBrowser.platform === 'undefined' ? tmpBrowser.platformName : tmpBrowser.platform
|
||||
const arrayBro = [broPlatform, tmpBrowser.browserName, tmpBrowser.version]
|
||||
jsUnitSaucelabs.start([arrayBro], testURL, 'qunit', (error, success) => {
|
||||
if (typeof success !== 'undefined') {
|
||||
const taskIds = success['js tests']
|
||||
|
||||
if (!taskIds || !taskIds.length) {
|
||||
throw new Error('Error starting tests through SauceLabs API')
|
||||
}
|
||||
|
||||
taskIds.forEach((id) => {
|
||||
jsUnitSaucelabs.getStatus(id, (error, body) => {
|
||||
waitingCallback(error, body, id)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.error(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
jsUnitSaucelabs.initTunnel()
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -3345,7 +3345,9 @@
|
||||
}
|
||||
},
|
||||
"jsunitsaucelabs": {
|
||||
"version": "git+https://github.com/Johann-S/JSUnitSaucelabs.git#3847edd62151076e26b4d4af9815d6d5edc64e66",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/jsunitsaucelabs/-/jsunitsaucelabs-1.2.0.tgz",
|
||||
"integrity": "sha512-Jgqe0+XRvnkF4r6fmfwsEC8DC38EgsCU7XCGGJ8Y+G1ze38isLmzTlCSNwyG/NNJuYivbABauwCk53KAne1cLQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"sauce-tunnel": "2.5.0"
|
||||
|
@ -87,7 +87,7 @@
|
||||
"eslint": "^4.2.0",
|
||||
"eslint-plugin-compat": "^1.0.4",
|
||||
"htmllint-cli": "^0.0.6",
|
||||
"jsunitsaucelabs": "^1.1.0",
|
||||
"jsunitsaucelabs": "^1.2.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