new test for current path and gitid input bg fix

pull/11/head
LianaHus 5 years ago committed by ioedeveloper
parent 41311f223f
commit e41d2377d2
  1. 2
      apps/remix-ide/src/app/tabs/settings-tab.js
  2. 10
      apps/remix-ide/src/app/tabs/test-tab.js
  3. 15
      apps/remix-ide/test-browser/tests/solidityUnittests.test.js

@ -69,7 +69,7 @@ module.exports = class SettingsTab extends ViewPlugin {
// Gist settings // Gist settings
const token = this.config.get('settings/gist-access-token') const token = this.config.get('settings/gist-access-token')
const gistAccessToken = yo`<input id="gistaccesstoken" data-id="settingsTabGistAccessToken" type="password" class="border form-control-sm mb-2 ${css.inline}" placeholder="Token">` const gistAccessToken = yo`<input id="gistaccesstoken" data-id="settingsTabGistAccessToken" type="password" class="form-control border form-control-sm mb-2 ${css.inline}" placeholder="Token">`
if (token) gistAccessToken.value = token if (token) gistAccessToken.value = token
const removeToken = () => { self.config.set('settings/gist-access-token', ''); gistAccessToken.value = ''; tooltip('Access token removed') } const removeToken = () => { self.config.set('settings/gist-access-token', ''); gistAccessToken.value = ''; tooltip('Access token removed') }
const saveToken = () => { this.config.set('settings/gist-access-token', gistAccessToken.value); tooltip('Access token saved') } const saveToken = () => { this.config.set('settings/gist-access-token', gistAccessToken.value); tooltip('Access token saved') }

@ -33,6 +33,7 @@ module.exports = class TestTab extends ViewPlugin {
this.runningTestsNumber = 0 this.runningTestsNumber = 0
this.readyTestsNumber = 0 this.readyTestsNumber = 0
this.areTestsRunning = false this.areTestsRunning = false
this.defaultPath = 'browser/tests'
appManager.event.on('activate', (name) => { appManager.event.on('activate', (name) => {
if (name === 'solidity') this.updateRunAction() if (name === 'solidity') this.updateRunAction()
@ -351,7 +352,8 @@ module.exports = class TestTab extends ViewPlugin {
} }
updateCurrentPath (e) { updateCurrentPath (e) {
this.testTabLogic.setCurrentPath(e.target.value) const newValue = e.target.value == '' ? this.defaultPath : e.target.value
this.testTabLogic.setCurrentPath(newValue)
this.updateRunAction() this.updateRunAction()
this.updateForNewCurrent() this.updateForNewCurrent()
} }
@ -494,14 +496,14 @@ module.exports = class TestTab extends ViewPlugin {
this.testsExecutionStopped = yo`<label class="text-warning h6" data-id="testTabTestsExecutionStopped">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.testsExecutionStoppedError = yo`<label class="text-danger h6" data-id="testTabTestsExecutionStoppedError">The test execution has been stopped because of error(s) in your test file</label>` this.testsExecutionStoppedError = yo`<label class="text-danger h6" data-id="testTabTestsExecutionStoppedError">The test execution has been stopped because of error(s) in your test file</label>`
this.uiPathList = yo`<datalist id="utPathList"></datalist>` this.uiPathList = yo`<datalist id="utPathList"></datalist>`
const placeHolderPath = 'browser/tests'
const availablePaths = yo` const availablePaths = yo`
<div> <div>
<input <input
placeholder=${placeHolderPath} placeholder=${this.defaultPath}
list="utPathList" list="utPathList"
class="custom-select" class="custom-select"
id="utPath" id="utPath"
data-id="uiPathInput"
name="utPath" name="utPath"
style="background-image: var(--primary);" style="background-image: var(--primary);"
onchange=${(e) => this.updateCurrentPath(e)}/> onchange=${(e) => this.updateCurrentPath(e)}/>
@ -545,7 +547,7 @@ module.exports = class TestTab extends ViewPlugin {
</div> </div>
` `
this._view.el = el this._view.el = el
this.testTabLogic.setCurrentPath(placeHolderPath) this.testTabLogic.setCurrentPath(this.defaultPath)
this.updateForNewCurrent(this.fileManager.currentFile()) this.updateForNewCurrent(this.fileManager.currentFile())
return el return el
} }

@ -94,7 +94,7 @@ module.exports = {
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol')
.notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/4_Ballot_test.sol') .notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/4_Ballot_test.sol')
.notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/simple_storage_test.sol') .notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/simple_storage_test.sol')
.pause(6000) .pause(7000)
.assert.containsText('*[data-id="testTabTestsExecutionStopped"]', 'The test execution has been stopped') .assert.containsText('*[data-id="testTabTestsExecutionStopped"]', 'The test execution has been stopped')
}, },
@ -141,6 +141,19 @@ module.exports = {
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', `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`)
}, },
'Changing current path': function (browser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('myTests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol'])
.clickLaunchIcon('solidityUnitTesting')
.setValue('*[data-id="uiPathInput"]', 'browser/myTests')
.clickElementAtPosition('.singleTestLabel', 0)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
.clearValue('*[data-id="uiPathInput"]')
.setValue('*[data-id="uiPathInput"]', 'browser/tests')
},
'Solidity Unittests': function (browser) { 'Solidity Unittests': function (browser) {
runTests(browser) runTests(browser)
}, },

Loading…
Cancel
Save