Merge pull request #293 from ethereum/paralleltest

Saucelabs improvement
pull/1/head
chriseth 8 years ago committed by GitHub
commit e1f531d4e4
  1. 5
      ci/browser_tests.sh
  2. 1
      package.json
  3. 4
      test-browser/tests/ballot.js
  4. 4
      test-browser/tests/debugger.js
  5. 4
      test-browser/tests/new-file-test.js
  6. 62
      test-browser/tests/sauce.js
  7. 4
      test-browser/tests/simpleContract.js
  8. 4
      test-browser/tests/smoke-test.js

@ -20,10 +20,7 @@ while [ ! -f "$SAUCECONNECT_READYFILE" ]; do
sleep .5
done
npm run browser-test-remote-firefox || TEST_EXITCODE=1
npm run browser-test-remote-chrome || TEST_EXITCODE=1
npm run browser-test-remote-safari || TEST_EXITCODE=1
npm run browser-test-remote-ie || TEST_EXITCODE=1
npm run browser-test-remote-parallel || TEST_EXITCODE=1
node ci/sauceDisconnect.js "$SAUCECONNECT_USERNAME" "$SAUCECONNECT_ACCESSKEY" "$SAUCECONNECT_JOBIDENTIFIER"

@ -8,6 +8,7 @@
"browser-test-remote-firefox": "nightwatch --config nightwatch.js --env default",
"browser-test-remote-ie": "nightwatch --config nightwatch.js --env ie",
"browser-test-remote-safari": "nightwatch --config nightwatch.js --env safari",
"browser-test-remote-parallel": "nightwatch --config nightwatch.js --env safari,ie,default,chrome",
"build": "mkdir -p build; browserify src/index.js -g yo-yoify -o build/app.js; babel --plugins babel-plugin-transform-es2015-template-literals,babel-plugin-transform-es2015-block-scoping build/app.js --out-file build/app.js",
"csslint": "csslint --ignore=order-alphabetical --errors='errors,duplicate-properties,empty-rules' --exclude-list='assets/css/font-awesome.min.css' assets/css/",
"downloadsolc": "rm soljson.js; wget https://ethereum.github.io/solc-bin/soljson.js",

@ -2,6 +2,7 @@
var contractHelper = require('../helpers/contracts')
var examples = require('../../src/app/example-contracts')
var init = require('../helpers/init')
var sauce = require('./sauce')
var sources = {
'sources': {
@ -18,7 +19,8 @@ module.exports = {
},
'Ballot': function (browser) {
runTests(browser)
}
},
tearDown: sauce
}
function runTests (browser, testData) {

@ -1,5 +1,6 @@
'use strict'
var init = require('../helpers/init')
var sauce = require('./sauce')
module.exports = {
before: function (browser, done) {
@ -10,5 +11,6 @@ module.exports = {
.waitForElementPresent('#debugger', 10000)
.waitForElementPresent('#debugger #slider', 10000)
.end()
}
},
tearDown: sauce
}

@ -1,5 +1,6 @@
'use strict'
var init = require('../helpers/init')
var sauce = require('./sauce')
module.exports = {
before: function (browser, done) {
@ -12,5 +13,6 @@ module.exports = {
.pause('10000')
.assert.containsText('.active', 'Untitled')
.end()
}
},
tearDown: sauce
}

@ -0,0 +1,62 @@
const https = require('https')
module.exports = function sauce (callback) {
const currentTest = this.client.currentTest
const username = this.client.options.username
const sessionId = this.client.capabilities['webdriver.remote.sessionid']
const accessKey = this.client.options.accessKey
if (!this.client.launch_url.match(/saucelabs/)) {
console.log('Not saucelabs ...')
return callback()
}
if (!username || !accessKey || !sessionId) {
console.log(this.client)
console.log('No username, accessKey or sessionId')
return callback()
}
const passed = currentTest.results.passed === currentTest.results.tests
const data = JSON.stringify({passed})
const requestPath = `/rest/v1/${username}/jobs/${sessionId}`
function responseCallback (res) {
res.setEncoding('utf8')
console.log('Response: ', res.statusCode, JSON.stringify(res.headers))
res.on('data', function onData (chunk) {
console.log('BODY: ' + chunk)
})
res.on('end', function onEnd () {
console.info('Finished updating saucelabs')
callback()
})
}
try {
console.log('Updating saucelabs', requestPath)
const req = https.request({
hostname: 'saucelabs.com',
path: requestPath,
method: 'PUT',
auth: `${username}:${accessKey}`,
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
}, responseCallback)
req.on('error', function onError (e) {
console.log('problem with request: ' + e.message)
})
req.write(data)
req.end()
} catch (error) {
console.log('Error', error)
callback()
}
}

@ -1,6 +1,7 @@
'use strict'
var contractHelper = require('../helpers/contracts')
var init = require('../helpers/init')
var sauce = require('./sauce')
var sources = {
'sources': {
@ -17,7 +18,8 @@ module.exports = {
},
'Simple Contract': function (browser) {
runTests(browser)
}
},
tearDown: sauce
}
function runTests (browser) {

@ -1,5 +1,6 @@
'use strict'
var init = require('../helpers/init')
var sauce = require('./sauce')
module.exports = {
before: function (browser, done) {
@ -12,5 +13,6 @@ module.exports = {
.pause('10000')
.assert.containsText('#righthand-panel', 'Solidity version')
.end()
}
},
tearDown: sauce
}

Loading…
Cancel
Save