diff --git a/apps/remix-ide-e2e/src/commands/createContract.ts b/apps/remix-ide-e2e/src/commands/createContract.ts index 2503a839c9..5246050e4c 100644 --- a/apps/remix-ide-e2e/src/commands/createContract.ts +++ b/apps/remix-ide-e2e/src/commands/createContract.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() }) diff --git a/apps/remix-ide-e2e/src/commands/selectContract.ts b/apps/remix-ide-e2e/src/commands/selectContract.ts index b341f11bbd..b5dfee271d 100644 --- a/apps/remix-ide-e2e/src/commands/selectContract.ts +++ b/apps/remix-ide-e2e/src/commands/selectContract.ts @@ -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 diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts index a5616dfd7b..53095537f8 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.test.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts @@ -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: '[]'}) diff --git a/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts b/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts index 711f87be3c..39b6204e51 100644 --- a/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts +++ b/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts @@ -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) => { diff --git a/apps/remix-ide-e2e/src/tests/recorder.test.ts b/apps/remix-ide-e2e/src/tests/recorder.test.ts index 852951f2f4..e13130029d 100644 --- a/apps/remix-ide-e2e/src/tests/recorder.test.ts +++ b/apps/remix-ide-e2e/src/tests/recorder.test.ts @@ -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('')