diff --git a/apps/remix-ide-e2e/src/commands/selectAccount.ts b/apps/remix-ide-e2e/src/commands/selectAccount.ts index d7447d891c8..c4230a52533 100644 --- a/apps/remix-ide-e2e/src/commands/selectAccount.ts +++ b/apps/remix-ide-e2e/src/commands/selectAccount.ts @@ -5,7 +5,9 @@ class SelectAccount extends EventEmitter { command (this: NightwatchBrowser, account?: string): NightwatchBrowser { if (account) { this.api - .click(`select[data-id="runTabSelectAccount"] [value="${account}"]`) + .click(`*[data-id="runTabSelectAccount"]`) //open the dropdown + .waitForElementVisible(`*[data-id="${account}"]`) + .click(`*[data-id="${account}"]`) //close the dropdown .perform(() => { this.emit('complete') }) diff --git a/apps/remix-ide-e2e/src/commands/switchEnvironment.ts b/apps/remix-ide-e2e/src/commands/switchEnvironment.ts index bd58e3121c0..3c748f24638 100644 --- a/apps/remix-ide-e2e/src/commands/switchEnvironment.ts +++ b/apps/remix-ide-e2e/src/commands/switchEnvironment.ts @@ -4,35 +4,35 @@ import EventEmitter from 'events' class switchEnvironment extends EventEmitter { command (this: NightwatchBrowser, provider: string): NightwatchBrowser { this.api.useCss().waitForElementVisible('[data-id="settingsSelectEnvOptions"]') - .perform((done) => { - this.api.isPresent({ selector: `[data-id="selected-provider-${provider}"]`, suppressNotFoundErrors: true, timeout: 5000}, (result) => { - if (result.value) { - done() - } else { - browser.perform(() => { - this.api - .click('[data-id="settingsSelectEnvOptions"] button') // open dropdown - .isPresent({ selector: `[data-id="dropdown-item-${provider}"]`, suppressNotFoundErrors: true, timeout: 5000}, (result) => { - console.log(result) - this.api.click('[data-id="settingsSelectEnvOptions"] button') // close dropdown - if (!result.value) { - this.api.pinGrid(provider, true) - .click('[data-id="settingsSelectEnvOptions"] button') - .waitForElementVisible(`[data-id="dropdown-item-${provider}"]`) - .click(`[data-id="dropdown-item-${provider}"]`) - .perform(() => done()) - } else { - browser.click('[data-id="settingsSelectEnvOptions"] button') - .waitForElementVisible(`[data-id="dropdown-item-${provider}"]`) - .click(`[data-id="dropdown-item-${provider}"]`) - .perform(() => done()) - } - }) - }) - } - }) - }).perform(() => this.emit('complete')) - + .perform((done) => { + this.api.isPresent({ selector: `[data-id="selected-provider-${provider}"]`, suppressNotFoundErrors: true, timeout: 5000 }, (result) => { + if (result.value) { + done() + } else { + browser.perform(() => { + this.api + .click('[data-id="settingsSelectEnvOptions"] button') // open dropdown + .isPresent({ selector: `[data-id="dropdown-item-${provider}"]`, suppressNotFoundErrors: true, timeout: 5000 }, (result) => { + console.log(result) + this.api.click('[data-id="settingsSelectEnvOptions"] button') // close dropdown + if (!result.value) { + this.api.pinGrid(provider, true) + .click('[data-id="settingsSelectEnvOptions"] button') + .waitForElementVisible(`[data-id="dropdown-item-${provider}"]`) + .click(`[data-id="dropdown-item-${provider}"]`) + .perform(() => done()) + } else { + browser.click('[data-id="settingsSelectEnvOptions"] button') + .waitForElementVisible(`[data-id="dropdown-item-${provider}"]`) + .click(`[data-id="dropdown-item-${provider}"]`) + .perform(() => done()) + } + }) + }) + } + }) + }).perform(() => this.emit('complete')) + return this } } diff --git a/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts b/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts index 61d08b5735f..4f03f48505b 100644 --- a/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts @@ -36,6 +36,7 @@ module.exports = { browser.pause(500) .clickLaunchIcon('udapp') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') + .pause() .setValue('input[placeholder="uint8 _numProposals"]', '2') .click('*[data-id="Deploy - transact (not payable)"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index b20eac082c5..c403d1aad93 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -300,9 +300,10 @@ module.exports = { browser .clickLaunchIcon('udapp') .switchEnvironment('vm-mainnet-fork') + .click('*[data-id="runTabSelectAccount"]') .waitForElementPresent({ locateStrategy: 'css selector', - selector: 'select[data-id="runTabSelectAccount"] option[value="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]', + selector: '*[data-id="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]', timeout: 240000 }) .executeScriptInTerminal(`web3.eth.getCode('0x180587b00c8642e2c7ac3a758712d97e6f7bdcc7')`) // mainnet contract @@ -361,10 +362,10 @@ module.exports = { Resolver resolver = ens.resolver(node); console.log(resolver.addr(node)); } - ` + ` if (runMasterTests) { const path = "//*[@class='view-line' and contains(.,'resolveENS') and contains(.,'view')]//span//span[contains(.,'(')]" - + browser // .clickLaunchIcon('udapp') .switchEnvironment('vm-mainnet-fork') @@ -401,8 +402,8 @@ module.exports = { .waitForElementVisible('#editorView') .pause(10000) // the parser need to parse the code .useXpath() - .scrollToLine(3) - .click(path) + .scrollToLine(3) + .click(path) .perform(function () { const actions = this.actions({ async: true }); return actions diff --git a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts index 019d3659aa6..ff80fb580c4 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts @@ -245,11 +245,13 @@ module.exports = { .setSolidityCompilerVersion('soljson-v0.8.17+commit.8df45f5f.js') .clickLaunchIcon('udapp') .switchEnvironment('vm-mainnet-fork') + .click('*[data-id="runTabSelectAccount"]') .waitForElementPresent({ locateStrategy: 'css selector', - selector: 'select[data-id="runTabSelectAccount"] option[value="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]', + selector: `*[data-id="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]`, timeout: 250000 }) // wait for the udapp to load the list of accounts + .click('*[data-id="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]') .selectContract('MyResolver') .createContract('') .clickInstance(0) diff --git a/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx b/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx index 14c7838a891..52793a2ad5c 100644 --- a/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx +++ b/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx @@ -29,7 +29,7 @@ export const CustomToggle = React.forwardRef( className={className.replace('dropdown-toggle', '')} >