Fixed failing tests

pull/5370/head
ioedeveloper 5 years ago committed by Liana Husikyan
parent 20af968e6f
commit b2bb290a7d
  1. 5
      src/app/tabs/test-tab.js
  2. 2
      test-browser/helpers/init.js
  3. 27
      test-browser/tests/solidityUnittests.js

@ -193,12 +193,15 @@ module.exports = class TestTab extends ViewPlugin {
this.testsOutput.appendChild(yo`<div class="text-danger">${result.totalFailing} failing</div>`) this.testsOutput.appendChild(yo`<div class="text-danger">${result.totalFailing} failing</div>`)
if (this.rawFileName === filename) this.setHeader(false) if (this.rawFileName === filename) this.setHeader(false)
} }
const displayError = yo`<div class="sol error alert alert-danger"></div>`
result.errors.forEach((error, index) => { result.errors.forEach((error, index) => {
this.testsOutput.appendChild(yo`<div class="sol error alert alert-danger"> displayError.appendChild(yo`<div>
<ul type="disc" class="ml-3 mb-0"><li>${error.value} </li></ul> <ul type="disc" class="ml-3 mb-0"><li>${error.value} </li></ul>
<span class="text-danger ml-3">${error.message}</span> <span class="text-danger ml-3">${error.message}</span>
</div>`) </div>`)
}) })
this.testsOutput.appendChild(displayError)
} }
if (this.hasBeenStopped && (this.readyTestsNumber !== this.runningTestsNumber)) { if (this.hasBeenStopped && (this.readyTestsNumber !== this.runningTestsNumber)) {
// if all tests has been through before stopping no need to print this. // if all tests has been through before stopping no need to print this.

@ -24,7 +24,7 @@ module.exports = function (browser, callback, url, preloadPlugins = true) {
} }
function initModules (browser, callback) { function initModules (browser, callback) {
browser.pause(5000) browser.pause(20000)
.click('#icon-panel div[plugin="pluginManager"]') .click('#icon-panel div[plugin="pluginManager"]')
.scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_solidity"] button') .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_solidity"] button')
.pause(5000) .pause(5000)

@ -45,12 +45,11 @@ module.exports = {
.clickElementAtPosition('.singleTestLabel', 1) .clickElementAtPosition('.singleTestLabel', 1)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(15000) .pause(15000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/simple_storage_test.sol (MyTest)') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/simple_storage_test.sol')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Initial value should be100') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Initial value should be100')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Value is set200') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Value is set200')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Should fail for wrong value200') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Should fail for wrong value200')
.assert.containsText('*[data-id="testTabSolidityUnitTestsSummary"]', '1 failing') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '2 passing, 1 failing')
.assert.containsText('*[data-id="testTabSolidityUnitTestsSummary"]', '2 passing')
}, },
'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` ': function (browser) { 'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` ': function (browser) {
@ -63,15 +62,15 @@ module.exports = {
.clickElementAtPosition('.singleTestLabel', 2) .clickElementAtPosition('.singleTestLabel', 2)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(20000) .pause(20000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/ks2b_test.sol (kickstarterTest)') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/ks2b_test.sol')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project exists') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project exists')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong project owner') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong project owner')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong sender') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong sender')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong value') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong value')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project is fundable') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project is fundable')
.assert.containsText('*[data-id="testTabSolidityUnitTestsSummary"]', 'owner is incorrect') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'owner is incorrect')
.assert.containsText('*[data-id="testTabSolidityUnitTestsSummary"]', 'wrong sender') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong sender')
.assert.containsText('*[data-id="testTabSolidityUnitTestsSummary"]', 'wrong value') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong value')
}, },
'Should stop unit tests during test execution` ': function (browser) { 'Should stop unit tests during test execution` ': function (browser) {
@ -100,8 +99,8 @@ module.exports = {
.clickElementAtPosition('.singleTestLabel', 3) .clickElementAtPosition('.singleTestLabel', 3)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(10000) .pause(10000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsSummary"]') .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
.assert.containsText('*[data-id="testTabSolidityUnitTestsSummary"]', 'SyntaxError: No visibility specified') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'SyntaxError: No visibility specified')
}, },
'Should fail on deploy': function (browser) { 'Should fail on deploy': function (browser) {
@ -114,8 +113,8 @@ module.exports = {
.clickElementAtPosition('.singleTestLabel', 4) .clickElementAtPosition('.singleTestLabel', 4)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(10000) .pause(10000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsSummary"]') .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
.assert.containsText('*[data-id="testTabSolidityUnitTestsSummary"]', 'contract deployment failed after trying twice') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'contract deployment failed after trying twice')
}, },
'Should fail when parameters are to method in test contract': function (browser) { 'Should fail when parameters are to method in test contract': function (browser) {
@ -128,8 +127,8 @@ module.exports = {
.clickElementAtPosition('.singleTestLabel', 5) .clickElementAtPosition('.singleTestLabel', 5)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(15000) .pause(15000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsSummary"]') .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
.assert.containsText('*[data-id="testTabSolidityUnitTestsSummary"]', `Method 'add' can not have parameters inside a test contract`) .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', `Method 'add' can not have parameters inside a test contract`)
}, },
'Solidity Unittests': function (browser) { 'Solidity Unittests': function (browser) {
@ -148,7 +147,7 @@ function runTests (browser) {
.scrollAndClick('#runTestsTabRunAction') .scrollAndClick('#runTestsTabRunAction')
.waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]') .waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]')
.pause(15000) .pause(15000)
.assert.containsText('#solidityUnittestsOutput', 'browser/4_Ballot_test.sol (BallotTest)') .assert.containsText('#solidityUnittestsOutput', 'browser/4_Ballot_test.sol')
.assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal') .assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal')
.assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value') .assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value')
.end() .end()

Loading…
Cancel
Save