From bc4514f59c0bd203612617c526ddd0612ae73a88 Mon Sep 17 00:00:00 2001 From: David Disu Date: Fri, 8 Jul 2022 14:38:30 +0100 Subject: [PATCH] Revert previous e2e changes because of old UI --- .../remix-ide-e2e/src/commands/createContract.ts | 16 ++++------------ apps/remix-ide-e2e/src/tests/debugger.test.ts | 10 +++++----- .../src/tests/libraryDeployment.test.ts | 8 ++++---- apps/remix-ide-e2e/src/tests/recorder.test.ts | 6 +++--- .../src/tests/signingMessage.test.ts | 2 +- .../src/tests/specialFunctions.test.ts | 12 ++++++------ apps/remix-ide-e2e/src/tests/terminal.test.ts | 2 +- .../src/tests/transactionExecution.test.ts | 4 ++-- apps/remix-ide-e2e/src/types/index.d.ts | 2 +- 9 files changed, 27 insertions(+), 35 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/createContract.ts b/apps/remix-ide-e2e/src/commands/createContract.ts index 44ff4780c7..015a4f2012 100644 --- a/apps/remix-ide-e2e/src/commands/createContract.ts +++ b/apps/remix-ide-e2e/src/commands/createContract.ts @@ -2,7 +2,7 @@ import { NightwatchBrowser } from 'nightwatch' import EventEmitter from 'events' class CreateContract extends EventEmitter { - command (this: NightwatchBrowser, inputParams: string[]): NightwatchBrowser { + command (this: NightwatchBrowser, inputParams: string): NightwatchBrowser { this.api.perform((done) => { createContract(this.api, inputParams, () => { done() @@ -13,19 +13,11 @@ class CreateContract extends EventEmitter { } } -function createContract (browser: NightwatchBrowser, inputParams: string[], callback: VoidFunction) { - if (inputParams.length === 1) { - browser.setValue('.udapp_contractActionsContainerSingle > input', inputParams[0], function () { +function createContract (browser: NightwatchBrowser, inputParams: string, callback: VoidFunction) { + if (inputParams) { + browser.setValue('.udapp_contractActionsContainerSingle > input', inputParams, function () { browser.click('.udapp_contractActionsContainerSingle > button').pause(500).perform(function () { callback() }) }) - } else if (inputParams.length > 1) { - browser.perform((done) => { - for (let i = 0; i < inputParams.length; i++) { - browser.setValue(`div.udapp_multiArg:nth-child(${i + 1}) > input`, inputParams[i]) - } - done() - }) - .click('div.udapp_multiArg > button').pause(500).perform(function () { callback() }) } else { browser .click('.udapp_contractActionsContainerSingle > button') diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts index 19aa196b60..c3541d2163 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.test.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts @@ -86,7 +86,7 @@ module.exports = { .clickLaunchIcon('udapp') .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000) .selectContract('ERC20') - .createContract(["tokenName", "symbol"]) + .createContract('"tokenName", "symbol"') .debugTransaction(0) .pause(2000) .waitForElementVisible('#stepdetail') @@ -115,7 +115,7 @@ module.exports = { .testContracts('withABIEncoderV2.sol', sources[2]['withABIEncoderV2.sol'], ['test']) .clickLaunchIcon('udapp') .selectContract('test') - .createContract([]) + .createContract('') .clearConsole() .clickInstance(0) .clickFunction('test1 - transact (not payable)', { types: 'bytes userData', values: '0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000015b38da6a701c568545dcfcb03fcb875f56beddc4' }) @@ -148,7 +148,7 @@ module.exports = { .testContracts('locals.sol', sources[3]['locals.sol'], ['testLocals']) .clickLaunchIcon('udapp') .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 40000) - .createContract([]) + .createContract('') .pause(2000) .clearConsole() .clickInstance(0) @@ -173,7 +173,7 @@ module.exports = { .pause(2000) .testContracts('withGeneratedSources.sol', sources[4]['withGeneratedSources.sol'], ['A']) .clickLaunchIcon('udapp') - .createContract([]) + .createContract('') .clearConsole() .clickInstance(0) .clickFunction('f - transact (not payable)', { types: 'uint256[] ', values: '[]' }) @@ -235,7 +235,7 @@ module.exports = { .testContracts('reverted.sol', sources[6]['reverted.sol'], ['A', 'B', 'C']) .clickLaunchIcon('udapp') .selectContract('A') - .createContract([]) + .createContract('') .pause(500) .clickInstance(0) .clickFunction('callA - transact (not payable)') diff --git a/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts b/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts index 276e9136d5..4b3c4528c4 100644 --- a/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts +++ b/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts @@ -22,7 +22,7 @@ module.exports = { browser.verifyContracts(['test']) .clickLaunchIcon('udapp') .selectContract('test') - .createContract([]) + .createContract('') .getAddressAtPosition(0, (address) => { console.log('testAutoDeployLib ' + address) addressRef = address @@ -46,7 +46,7 @@ module.exports = { .verifyContracts(['test']) .clickLaunchIcon('udapp') .selectContract('lib') // deploy lib - .createContract([]) + .createContract('') .perform((done) => { browser.getAddressAtPosition(0, (address) => { console.log(address) @@ -74,7 +74,7 @@ function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFuncti .openFile('Untitled5.sol') .clickLaunchIcon('udapp') .selectContract('test') // deploy lib - .createContract([]) + .createContract('') .pause(2000) .getText('div[class^="terminal"]', (value) => { console.log('value: ', value) @@ -98,7 +98,7 @@ function checkDeployShouldSucceed (browser: NightwatchBrowser, address: string, .openFile('Untitled5.sol') .clickLaunchIcon('udapp') .selectContract('test') // deploy lib - .createContract([]) + .createContract('') .getAddressAtPosition(1, (address) => { addressRef = address }) diff --git a/apps/remix-ide-e2e/src/tests/recorder.test.ts b/apps/remix-ide-e2e/src/tests/recorder.test.ts index 7f69cd5dff..0f896a179e 100644 --- a/apps/remix-ide-e2e/src/tests/recorder.test.ts +++ b/apps/remix-ide-e2e/src/tests/recorder.test.ts @@ -40,7 +40,7 @@ module.exports = { 'Save scenario #group1': function (browser: NightwatchBrowser) { browser.testContracts('testRecorder.sol', sources[0]['testRecorder.sol'], ['testRecorder']) .clickLaunchIcon('udapp') - .createContract(['12']) + .createContract('12') .clickInstance(0) .clickFunction('set - transact (not payable)', { types: 'uint256 _p', values: '34' }) .click('.savetransaction') @@ -73,11 +73,11 @@ module.exports = { .clickLaunchIcon('udapp') .selectContract('t1est') .pause(1000) - .createContract([]) + .createContract('') .clickInstance(0) .selectContract('t2est') .pause(1000) - .createContract([]) + .createContract('') .click('.savetransaction') .waitForElementVisible('[data-id="udappNotify-modal-footer-ok-react"]') .execute(function () { diff --git a/apps/remix-ide-e2e/src/tests/signingMessage.test.ts b/apps/remix-ide-e2e/src/tests/signingMessage.test.ts index 177dac88a0..913851fa38 100644 --- a/apps/remix-ide-e2e/src/tests/signingMessage.test.ts +++ b/apps/remix-ide-e2e/src/tests/signingMessage.test.ts @@ -33,7 +33,7 @@ module.exports = { .clickLaunchIcon('udapp') .pause(5000) .selectContract('ECVerify') - .createContract([]) + .createContract('') .clickInstance(0) .perform((done) => { browser.getAddressAtPosition(0, (address) => { diff --git a/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts b/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts index 48137e3b8b..bcdc3c4977 100644 --- a/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts +++ b/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts @@ -24,7 +24,7 @@ module.exports = { .clickLaunchIcon('udapp') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectContract('CheckSpecials') - .createContract([]) // deploy + .createContract('') // deploy .clickInstance(0) .perform((done) => { browser.getAddressAtPosition(0, (address) => { @@ -92,7 +92,7 @@ module.exports = { .testContracts('receiveOnly.sol', sources[1]['receiveOnly.sol'], ['CheckSpecials']) .clickLaunchIcon('udapp') .selectContract('CheckSpecials') - .createContract([]) + .createContract('') .clickInstance(0) .perform((done) => { browser.getAddressAtPosition(0, (address) => { @@ -122,7 +122,7 @@ module.exports = { .testContracts('fallbackOnlyPayable.sol', sources[2]['fallbackOnlyPayable.sol'], ['CheckSpecials']) .clickLaunchIcon('udapp') .selectContract('CheckSpecials') - .createContract([]) + .createContract('') .clickInstance(0) .perform((done) => { browser.getAddressAtPosition(0, (address) => { @@ -153,7 +153,7 @@ module.exports = { .testContracts('fallbackOnlyNotPayable.sol', sources[3]['fallbackOnlyNotPayable.sol'], ['CheckSpecials']) .clickLaunchIcon('udapp') .selectContract('CheckSpecials') - .createContract([]) + .createContract('') .clickInstance(0) .perform((done) => { browser.getAddressAtPosition(0, (address) => { @@ -174,7 +174,7 @@ module.exports = { .clearValue('#value') .setValue('#value', '0') .pause(2000) - .createContract([]) + .createContract('') .pause(1000) .clickInstance(0).pause(1000) .perform((done) => { @@ -208,7 +208,7 @@ module.exports = { .waitForElementVisible('#value') .clearValue('#value') .setValue('#value', '0').pause(2000) - .createContract([]) + .createContract('') .clickInstance(0) .pause(1000) .perform((done) => { diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index b958b7d42d..7cc5268933 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -172,7 +172,7 @@ module.exports = { .clickLaunchIcon('udapp') .click('*[data-id="deployAndRunClearInstances"]') .selectContract('OwnerTest') - .createContract([]) + .createContract('') .pause(1000) .journalChildIncludes('constructor', { shouldHaveOnlyOneOccurence: true }) .pause(5000) diff --git a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts index 842da3b3c7..635218881f 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts @@ -202,10 +202,10 @@ module.exports = { .addFile('Storage.sol', sources[6]['Storage.sol']) .addFile('Owner.sol', sources[6]['Owner.sol']) .clickLaunchIcon('udapp') - .createContract(['42', '24']) + .createContract('42, 24') .openFile('Storage.sol') .clickLaunchIcon('udapp') - .createContract(['102']) // this creation will fail if the component hasn't been properly reset. + .createContract('102') // this creation will fail if the component hasn't been properly reset. .clickInstance(1) .clickFunction('store - transact (not payable)', { types: 'uint256 num', values: '24' }) .testFunction('last', // we check if the contract is actually reachable. diff --git a/apps/remix-ide-e2e/src/types/index.d.ts b/apps/remix-ide-e2e/src/types/index.d.ts index 9ba94f470b..c45c1d4d3d 100644 --- a/apps/remix-ide-e2e/src/types/index.d.ts +++ b/apps/remix-ide-e2e/src/types/index.d.ts @@ -34,7 +34,7 @@ declare module 'nightwatch' { getModalBody(callback: (value: string, cb: VoidFunction) => void): NightwatchBrowser, modalFooterCancelClick(id?: string): NightwatchBrowser, selectContract(contractName: string): NightwatchBrowser, - createContract(inputParams: string[]): NightwatchBrowser, + createContract(inputParams: string): NightwatchBrowser, getAddressAtPosition(index: number, cb: (pos: string) => void): NightwatchBrowser, testConstantFunction(address: string, fnFullName: string, expectedInput: NightwatchTestConstantFunctionExpectedInput | null, expectedOutput: string): NightwatchBrowser, getEditorValue(callback: (content: string) => void): NightwatchBrowser,