Merge pull request #709 from ethereum/fixRecorderTest

fix Recorder e2e tests
pull/731/head^2
yann300 4 years ago committed by GitHub
commit 0f2637b3c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      apps/remix-ide-e2e/src/commands/createContract.ts
  2. 10
      apps/remix-ide-e2e/src/commands/selectContract.ts
  3. 6
      apps/remix-ide-e2e/src/tests/debugger.test.ts
  4. 4
      apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts
  5. 7
      apps/remix-ide-e2e/src/tests/recorder.test.ts

@ -15,14 +15,11 @@ class CreateContract extends EventEmitter {
function createContract (browser: NightwatchBrowser, inputParams: string, callback: VoidFunction) {
if (inputParams) {
browser.clickLaunchIcon('settings').clickLaunchIcon('udapp')
.setValue('div[class^="contractActionsContainerSingle"] input', inputParams, function () {
browser.setValue('div[class^="contractActionsContainerSingle"] input', inputParams, function () {
browser.click('#runTabView button[class^="instanceButton"]').pause(500).perform(function () { callback() })
})
} else {
browser
.clickLaunchIcon('settings')
.clickLaunchIcon('udapp')
.click('#runTabView button[class^="instanceButton"]')
.pause(500)
.perform(function () { callback() })

@ -1,9 +1,11 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events"
const selector = '#runTabView select[class^="contractNames"]'
class SelectContract extends EventEmitter {
command (this: NightwatchBrowser, contractName: string): NightwatchBrowser {
this.api.perform((done) => {
this.api.waitForElementVisible(selector).perform((done) => {
selectContract(this.api, contractName, () => {
done()
this.emit('complete')
@ -14,11 +16,7 @@ class SelectContract extends EventEmitter {
}
function selectContract (browser: NightwatchBrowser, contractName: string, callback: VoidFunction) {
browser.clickLaunchIcon('settings').clickLaunchIcon('udapp')
.pause(10000)
.setValue('#runTabView select[class^="contractNames"]', contractName).perform(() => {
callback()
})
browser.click(`${selector} option[value="${contractName}"]`).perform(() => callback())
}
module.exports = SelectContract

@ -83,7 +83,8 @@ module.exports = {
.pause(2000)
.clickLaunchIcon('udapp')
.testContracts('externalImport.sol', sources[1]['browser/externalImport.sol'], ['ERC20'])
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000)
.clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000)
.selectContract('ERC20')
.createContract('"tokenName", "symbol"')
.debugTransaction(2)
@ -110,6 +111,7 @@ module.exports = {
.setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js')
.clickLaunchIcon('udapp')
.testContracts('withABIEncoderV2.sol', sources[2]['browser/withABIEncoderV2.sol'], ['test'])
.clickLaunchIcon('udapp')
.selectContract('test')
.createContract('')
.clickInstance(2)
@ -163,9 +165,9 @@ module.exports = {
browser
.clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.7.2+commit.51b20bc0.js')
.clickLaunchIcon('udapp')
.pause(2000)
.testContracts('withGeneratedSources.sol', sources[4]['browser/withGeneratedSources.sol'], ['A'])
.clickLaunchIcon('udapp')
.createContract('')
.clickInstance(4)
.clickFunction('f - transact (not payable)', {types: 'uint256[] ', values: '[]'})

@ -21,6 +21,7 @@ module.exports = {
'Test Auto Deploy Lib': function (browser: NightwatchBrowser) {
let addressRef: string
browser.verifyContracts(['test'])
.clickLaunchIcon('udapp')
.selectContract('test')
.createContract('')
.getAddressAtPosition(0, (address) => {
@ -45,6 +46,7 @@ module.exports = {
.clickLaunchIcon('solidity')
.click('#compileTabView button[title="Compile"]') // that should generate the JSON artefact
.verifyContracts(['test'])
.clickLaunchIcon('udapp')
.selectContract('lib') // deploy lib
.createContract('')
.perform((done) => {
@ -74,6 +76,7 @@ function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFuncti
browser.setEditorValue(JSON.stringify(config))
})
.openFile('browser/Untitled5.sol')
.clickLaunchIcon('udapp')
.selectContract('test') // deploy lib
.createContract('')
.getText('div[class^="terminal"]', (value) => {
@ -96,6 +99,7 @@ function checkDeployShouldSucceed (browser: NightwatchBrowser, address: string,
browser.setEditorValue(JSON.stringify(config))
})
.openFile('browser/Untitled5.sol')
.clickLaunchIcon('udapp')
.selectContract('test') // deploy lib
.createContract('')
.getAddressAtPosition(1, (address) => {

@ -38,6 +38,7 @@ module.exports = {
})
.click('*[data-id="deployAndRunClearInstances"]')
.testContracts('testRecorder.sol', sources[0]['browser/testRecorder.sol'], ['testRecorder'])
.clickLaunchIcon('udapp')
.createContract('12')
.waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button')
@ -57,19 +58,19 @@ module.exports = {
browser.assert.equal(JSON.stringify(parsed.transactions[1].record.type), JSON.stringify(scenario.transactions[1].record.type))
browser.assert.equal(JSON.stringify(parsed.transactions[1].record.from), JSON.stringify(scenario.transactions[1].record.from))
})
.end()
},
'Record more than one contract': '' + function (browser: NightwatchBrowser) {
'Record more than one contract': function (browser: NightwatchBrowser) {
// deploy 2 contracts (2 different ABIs), save the record, reexecute and test one of the function.
let addressRef
browser
.click('*[data-id="deployAndRunClearInstances"]')
.testContracts('multipleContracts.sol', sources[1]['browser/multipleContracts.sol'], ['t1est', 't2est'])
.clickLaunchIcon('udapp')
.selectContract('t1est')
.pause(1000)
.createContract('')
.pause(1000)
.clickInstance(0)
.selectContract('t2est')
.pause(1000)
.createContract('')

Loading…
Cancel
Save