Merge pull request #2783 from ethereum/run-stop-e2e

E2E Tests - Run and Stop
pull/1/head
yann300 5 years ago committed by GitHub
commit 614f58fb2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/app/tabs/test-tab.js
  2. 18
      test-browser/commands/notContainsText.js
  3. 18
      test-browser/tests/solidityUnittests.js

@ -339,7 +339,7 @@ module.exports = class TestTab extends ViewPlugin {
updateStopAction () {
return yo`
<button id="runTestsTabStopAction" class="w-50 pl-2 ml-2 btn btn-secondary" disabled="disabled" title="Stop running tests" onclick=${() => this.stopTests()}">
<button id="runTestsTabStopAction" data-id="testTabRunTestsTabStopAction" class="w-50 pl-2 ml-2 btn btn-secondary" disabled="disabled" title="Stop running tests" onclick=${() => this.stopTests()}">
<span class="fas fa-stop ml-2"></span>
<label class="${css.labelOnBtn} btn btn-primary bg-transparent p-1 ml-2 m-0" id="runTestsTabStopActionLabel">Stop</label>
</button>
@ -389,7 +389,7 @@ module.exports = class TestTab extends ViewPlugin {
this.onActivationInternal()
this.testsOutput = yo`<div class="${css.container} mx-3 border-top border-primary" hidden='true' id="solidityUnittestsOutput" data-id="testTabSolidityUnitTestsOutput"></a>`
this.testsSummary = yo`<div class="${css.container} mx-3 pt-2 border-top border-primary" hidden='true' id="solidityUnittestsSummary" data-id="testTabSolidityUnitTestsSummary"></div>`
this.testsExecutionStopped = yo`<label class="text-warning h6">The test execution has been stopped</label>`
this.testsExecutionStopped = yo`<label class="text-warning h6" data-id="testTabTestsExecutionStopped">The test execution has been stopped</label>`
this.testsExecutionStopped.hidden = true
this.resultStatistics = this.createResultLabel()
this.resultStatistics.hidden = true

@ -0,0 +1,18 @@
const EventEmitter = require('events')
class NotContainsText extends EventEmitter {
command (cssSelector, text) {
const browser = this.api
browser.getText(cssSelector, (result) => {
if (result.value.includes(text)) return this.api.assert.fail(`${cssSelector} contains ${text}.`)
else this.api.assert.ok(`${cssSelector} does not contains ${text}.`)
})
.perform(() => {
this.emit('complete')
})
return this
}
}
module.exports = NotContainsText

@ -74,6 +74,22 @@ module.exports = {
.assert.containsText('*[data-id="testTabSolidityUnitTestsSummary"]', 'wrong value')
},
'Should stop unit tests during test execution` ': function (browser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.waitForElementPresent('*[data-id="testTabRunTestsTabRunAction"]')
.clickElementAtPosition('.singleTestLabel', 0)
.clickElementAtPosition('.singleTestLabel', 1)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(5000)
.click('*[data-id="testTabRunTestsTabStopAction"]')
.assert.containsText('*[data-id="testTabRunTestsTabStopAction"]', 'Stopping')
.pause(10000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/ks2b_test.sol (kickstarterTest)')
.notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/4_Ballot_test.sol (BallotTest)')
.notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/simple_storage_test.sol (MyTest)')
.assert.containsText('*[data-id="testTabTestsExecutionStopped"]', 'The test execution has been stopped')
},
'Should fail on compilation': function (browser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('compilationError_test.sol', sources[0]['browser/compilationError_test.sol'])
@ -131,7 +147,7 @@ function runTests (browser) {
.clickLaunchIcon('solidityUnitTesting')
.scrollAndClick('#runTestsTabRunAction')
.waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]')
.pause(10000)
.pause(15000)
.assert.containsText('#solidityUnittestsOutput', 'browser/4_Ballot_test.sol (BallotTest)')
.assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal')
.assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value')

Loading…
Cancel
Save