add browser tests

pull/1/head
yann300 5 years ago
parent b4ba04d6fa
commit 74b07238eb
  1. 1
      package.json
  2. 6
      src/app/tabs/test-tab.js
  3. 34
      test-browser/tests/solidityUnittests.js

@ -166,6 +166,7 @@
"nightwatch_local_transactionExecution": "nightwatch ./test-browser/tests/transactionExecution.js --config nightwatch.js --env chrome ",
"nightwatch_local_staticAnalysis": "nightwatch ./test-browser/tests/staticAnalysis.js --config nightwatch.js --env chrome ",
"nightwatch_local_signingMessage": "nightwatch ./test-browser/tests/signingMessage.js --config nightwatch.js --env chrome ",
"nightwatch_local_solidityUnittests": "nightwatch ./test-browser/tests/solidityUnittests.js --config nightwatch.js --env chrome ",
"nightwatch_local_remixd": "nightwatch ./test-browser/tests/remix.js --config nightwatch.js --env chrome ",
"nightwatch_local_console": "nightwatch ./test-browser/tests/console.js --config nightwatch.js --env chrome ",
"onchange": "onchange build/app.js -- npm-run-all lint",

@ -207,7 +207,7 @@ module.exports = class TestTab extends ViewPlugin {
}
updateRunAction (currentFile) {
let el = yo`<button class="${css.runButton} btn btn-primary" onclick="${this.runTests.bind(this)}">Run Tests</button>`
let el = yo`<button id="runTestsTabRunAction" class="${css.runButton} btn btn-primary" onclick="${this.runTests.bind(this)}">Run Tests</button>`
const isSolidityActive = this.appManager.isActive('solidity')
if (!currentFile || !isSolidityActive) {
el.setAttribute('disabled', 'disabled')
@ -235,8 +235,8 @@ module.exports = class TestTab extends ViewPlugin {
}
render () {
this.onActivationInternal()
this.testsOutput = yo`<div class="${css.container} m-3 border border-primary border-right-0 border-left-0 border-bottom-0" hidden='true' id="tests"></div>`
this.testsSummary = yo`<div class="${css.container} border border-primary border-right-0 border-left-0 border-bottom-0" hidden='true' id="tests"></div>`
this.testsOutput = yo`<div class="${css.container} m-3 border border-primary border-right-0 border-left-0 border-bottom-0" hidden='true' id="solidityUnittestsOutput"></div>`
this.testsSummary = yo`<div class="${css.container} border border-primary border-right-0 border-left-0 border-bottom-0" hidden='true' id="solidityUnittestsSummary"></div>`
this.loading = yo`<span class='text-info ml-1'>Running tests...</span>`
this.loading.hidden = true
var el = yo`

@ -0,0 +1,34 @@
'use strict'
var init = require('../helpers/init')
var sauce = require('./sauce')
var sources = []
module.exports = {
before: function (browser, done) {
init(browser, done)
},
'@sources': function () {
return sources
},
'Solidity Unittests': function (browser) {
runTests(browser)
},
tearDown: sauce
}
function runTests (browser) {
browser
.waitForElementVisible('#icon-panel', 10000)
.click('#icon-panel div[plugin="pluginManager"]')
.scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_solidityUnitTesting"] button')
.clickLaunchIcon('fileExplorers')
.switchFile('browser/ballot.sol')
.clickLaunchIcon('solidityUnitTesting')
.scrollAndClick('#runTestsTabRunAction')
.waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]')
.assert.containsText('#solidityUnittestsOutput', `browser/ballot_test.sol (test3)
(Check winning proposal)
(Check winnin proposal with return value)`)
.end()
}
Loading…
Cancel
Save