Merge pull request #2366 from ethereum/add_browser_tests_for_unittests

add browser tests for testing basic use of solidity tests tab
pull/1/head
Aniket 5 years ago committed by GitHub
commit fd6ddd6c1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 1
      package.json
  3. 6
      src/app/tabs/test-tab.js
  4. 34
      test-browser/tests/solidityUnittests.js

@ -16,7 +16,7 @@ Remix consists of many modules and in this repository you will find the Remix ID
The `gh-pages` branch has always the latest stable build of Remix. It also contains a ZIP file with the entire build. Download it to use offline.
Note: it contains the latest release of Solidity available at the time of the packaging. No other compiler versions are supported.
Note: It contains the latest release of Solidity available at the time of the packaging. No other compiler versions are supported.
## INSTALLATION:

@ -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)')
.assert.containsText('#solidityUnittestsOutput', '✓ (Check winning proposal)')
.assert.containsText('#solidityUnittestsOutput', '✓ (Check winnin proposal with return value)')
.end()
}
Loading…
Cancel
Save