From 7c2629103b93be8233288bfc7490632060ac1032 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Thu, 14 Nov 2024 19:17:27 +0100 Subject: [PATCH 1/8] change dropdown to custom dropdown --- .../run-tab/src/lib/components/account.tsx | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/run-tab/src/lib/components/account.tsx b/libs/remix-ui/run-tab/src/lib/components/account.tsx index 27b3b7264df..76280db0560 100644 --- a/libs/remix-ui/run-tab/src/lib/components/account.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/account.tsx @@ -4,7 +4,8 @@ import { FormattedMessage, useIntl } from 'react-intl' import { CopyToClipboard } from '@remix-ui/clipboard' import { AccountProps } from '../types' import { PassphrasePrompt } from './passphrase' -import { CustomTooltip } from '@remix-ui/helper' +import { CustomMenu, CustomToggle, CustomTooltip } from '@remix-ui/helper' +import { Dropdown } from 'react-bootstrap' const _paq = window._paq = window._paq || [] export function AccountUI(props: AccountProps) { @@ -235,7 +236,27 @@ export function AccountUI(props: AccountProps) { {props.accounts.isRequesting && }
- ))} - + */}
) @@ -280,4 +301,4 @@ const EIP712_Example = { { name: 'createdAt', type: 'uint256' }, ], }, -} \ No newline at end of file +} From 79cfffe89f2bccab084a8c5fbea88798333bc45e Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Thu, 14 Nov 2024 21:45:40 +0100 Subject: [PATCH 2/8] fix e2e --- apps/remix-ide-e2e/src/commands/selectAccount.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/commands/selectAccount.ts b/apps/remix-ide-e2e/src/commands/selectAccount.ts index d7447d891c8..f27dab98f5c 100644 --- a/apps/remix-ide-e2e/src/commands/selectAccount.ts +++ b/apps/remix-ide-e2e/src/commands/selectAccount.ts @@ -5,7 +5,7 @@ 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"] *[id="txorigin"]`) .perform(() => { this.emit('complete') }) From 977b0734b6250b15b348a6e7f5885f6ef8dbd0f1 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Sun, 15 Dec 2024 18:26:17 +0100 Subject: [PATCH 3/8] update e2e command --- apps/remix-ide-e2e/src/commands/selectAccount.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/commands/selectAccount.ts b/apps/remix-ide-e2e/src/commands/selectAccount.ts index f27dab98f5c..6d529ba57ea 100644 --- a/apps/remix-ide-e2e/src/commands/selectAccount.ts +++ b/apps/remix-ide-e2e/src/commands/selectAccount.ts @@ -5,7 +5,7 @@ class SelectAccount extends EventEmitter { command (this: NightwatchBrowser, account?: string): NightwatchBrowser { if (account) { this.api - .click(`*[data-id="runTabSelectAccount"] *[id="txorigin"]`) + .click(`*[data-id="runTabSelectAccount"] a:contains("${account}")`) .perform(() => { this.emit('complete') }) From af6e953ad06603509753f47773593c12f9e803a7 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Tue, 17 Dec 2024 17:28:26 +0100 Subject: [PATCH 4/8] fix e2e --- .../src/commands/selectAccount.ts | 3 +- .../src/commands/switchEnvironment.ts | 58 +++++++++---------- .../src/lib/components/custom-dropdown.tsx | 2 +- .../run-tab/src/lib/components/account.tsx | 3 +- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/selectAccount.ts b/apps/remix-ide-e2e/src/commands/selectAccount.ts index 6d529ba57ea..1674bd0afe7 100644 --- a/apps/remix-ide-e2e/src/commands/selectAccount.ts +++ b/apps/remix-ide-e2e/src/commands/selectAccount.ts @@ -5,7 +5,8 @@ class SelectAccount extends EventEmitter { command (this: NightwatchBrowser, account?: string): NightwatchBrowser { if (account) { this.api - .click(`*[data-id="runTabSelectAccount"] a:contains("${account}")`) + .click(`*[data-id="runTabSelectAccount"]`) + .click(`*[data-id="runTabSelectAccount"]`) // close 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/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', '')} >
-
{children}
+
{children}
{icon && (
diff --git a/libs/remix-ui/run-tab/src/lib/components/account.tsx b/libs/remix-ui/run-tab/src/lib/components/account.tsx index 76280db0560..df90f4c0a75 100644 --- a/libs/remix-ui/run-tab/src/lib/components/account.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/account.tsx @@ -236,7 +236,7 @@ export function AccountUI(props: AccountProps) { {props.accounts.isRequesting && }
- + {selectedAccount ? loadedAccounts[selectedAccount] : ''} @@ -248,6 +248,7 @@ export function AccountUI(props: AccountProps) { onSelect={(e) => { props.setAccount(value) }} + data-id="txOriginSelectAccountItem" > {loadedAccounts[value]} From 0979e66576596e77f183ae5df237a4a632844774 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Tue, 17 Dec 2024 22:27:56 +0100 Subject: [PATCH 5/8] fix tests --- apps/remix-ide-e2e/src/commands/selectAccount.ts | 6 ++++-- apps/remix-ide-e2e/src/tests/terminal.test.ts | 12 ++++++------ .../src/tests/transactionExecution.test.ts | 2 +- libs/remix-ui/run-tab/src/lib/components/account.tsx | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/selectAccount.ts b/apps/remix-ide-e2e/src/commands/selectAccount.ts index 1674bd0afe7..9d05e7ae779 100644 --- a/apps/remix-ide-e2e/src/commands/selectAccount.ts +++ b/apps/remix-ide-e2e/src/commands/selectAccount.ts @@ -5,8 +5,10 @@ class SelectAccount extends EventEmitter { command (this: NightwatchBrowser, account?: string): NightwatchBrowser { if (account) { this.api - .click(`*[data-id="runTabSelectAccount"]`) - .click(`*[data-id="runTabSelectAccount"]`) // close dropdown + .click(`*[data-id="runTabSelectAccount"]`) //open the dropdown + .waitForElementVisible(`*[data-id="custom-dropdown-items"]`) + .waitForElementVisible(`*[data-id="${account}"]`) + .click(`*[data-id="${account}"]`) //close the dropdown .perform(() => { this.emit('complete') }) diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index b20eac082c5..65bae97180e 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -302,7 +302,7 @@ module.exports = { .switchEnvironment('vm-mainnet-fork') .waitForElementPresent({ locateStrategy: 'css selector', - selector: 'select[data-id="runTabSelectAccount"] option[value="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]', + selector: `*[data-id="runTabSelectAccount"] *[data-id="dropdown-content"]:contains('0xdD870fA1b7C4700F2BD7f44238821C26f7392148')`, timeout: 240000 }) .executeScriptInTerminal(`web3.eth.getCode('0x180587b00c8642e2c7ac3a758712d97e6f7bdcc7')`) // mainnet contract @@ -332,7 +332,7 @@ module.exports = { .modalFooterOKClick('vm-custom-fork') .waitForElementPresent({ locateStrategy: 'css selector', - selector: 'select[data-id="runTabSelectAccount"] option[value="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]', + selector: `*[data-id="runTabSelectAccount"] *[data-id="dropdown-content"]:contains('0xdD870fA1b7C4700F2BD7f44238821C26f7392148')`, timeout: 240000 }) .pause(5000) @@ -361,10 +361,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 +401,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..c5a57343696 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts @@ -247,7 +247,7 @@ module.exports = { .switchEnvironment('vm-mainnet-fork') .waitForElementPresent({ locateStrategy: 'css selector', - selector: 'select[data-id="runTabSelectAccount"] option[value="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]', + selector: `*[data-id="runTabSelectAccount"] *[data-id="dropdown-content"]:contains('0xdD870fA1b7C4700F2BD7f44238821C26f7392148')`, timeout: 250000 }) // wait for the udapp to load the list of accounts .selectContract('MyResolver') diff --git a/libs/remix-ui/run-tab/src/lib/components/account.tsx b/libs/remix-ui/run-tab/src/lib/components/account.tsx index df90f4c0a75..c7d990e3518 100644 --- a/libs/remix-ui/run-tab/src/lib/components/account.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/account.tsx @@ -248,9 +248,9 @@ export function AccountUI(props: AccountProps) { onSelect={(e) => { props.setAccount(value) }} - data-id="txOriginSelectAccountItem" + data-id={`txOriginSelectAccountItem-${value}`} > - + {loadedAccounts[value]} From b8bcf0f2cd00eb386263ba1621257bcd52e39b2a Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 18 Dec 2024 00:13:29 +0100 Subject: [PATCH 6/8] fix selector in tests --- apps/remix-ide-e2e/src/commands/selectAccount.ts | 2 +- apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts | 1 + apps/remix-ide-e2e/src/tests/terminal.test.ts | 5 +++-- apps/remix-ide-e2e/src/tests/transactionExecution.test.ts | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/selectAccount.ts b/apps/remix-ide-e2e/src/commands/selectAccount.ts index 9d05e7ae779..d82fdf35ed5 100644 --- a/apps/remix-ide-e2e/src/commands/selectAccount.ts +++ b/apps/remix-ide-e2e/src/commands/selectAccount.ts @@ -6,7 +6,7 @@ class SelectAccount extends EventEmitter { if (account) { this.api .click(`*[data-id="runTabSelectAccount"]`) //open the dropdown - .waitForElementVisible(`*[data-id="custom-dropdown-items"]`) + // .waitForElementVisible(`*[data-id="custom-dropdown-items"]`) .waitForElementVisible(`*[data-id="${account}"]`) .click(`*[data-id="${account}"]`) //close the dropdown .perform(() => { 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 65bae97180e..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: `*[data-id="runTabSelectAccount"] *[data-id="dropdown-content"]:contains('0xdD870fA1b7C4700F2BD7f44238821C26f7392148')`, + selector: '*[data-id="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]', timeout: 240000 }) .executeScriptInTerminal(`web3.eth.getCode('0x180587b00c8642e2c7ac3a758712d97e6f7bdcc7')`) // mainnet contract @@ -332,7 +333,7 @@ module.exports = { .modalFooterOKClick('vm-custom-fork') .waitForElementPresent({ locateStrategy: 'css selector', - selector: `*[data-id="runTabSelectAccount"] *[data-id="dropdown-content"]:contains('0xdD870fA1b7C4700F2BD7f44238821C26f7392148')`, + selector: 'select[data-id="runTabSelectAccount"] option[value="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]', timeout: 240000 }) .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 c5a57343696..3e47b2b1e8d 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts @@ -245,9 +245,10 @@ 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: `*[data-id="runTabSelectAccount"] *[data-id="dropdown-content"]:contains('0xdD870fA1b7C4700F2BD7f44238821C26f7392148')`, + selector: `*[data-id="0xdD870fA1b7C4700F2BD7f44238821C26f7392148"]`, timeout: 250000 }) // wait for the udapp to load the list of accounts .selectContract('MyResolver') From c41f5b271b7161adbc648ed515e7748fdda140a8 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 18 Dec 2024 10:44:16 +0100 Subject: [PATCH 7/8] fix more tests --- apps/remix-ide-e2e/src/tests/transactionExecution.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts index 3e47b2b1e8d..ff80fb580c4 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts @@ -251,6 +251,7 @@ module.exports = { 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) From 80083bf255ea54fca73eaa8a9d1191d7810a3497 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 18 Dec 2024 10:47:05 +0100 Subject: [PATCH 8/8] cleanup --- apps/remix-ide-e2e/src/commands/selectAccount.ts | 1 - .../run-tab/src/lib/components/account.tsx | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/selectAccount.ts b/apps/remix-ide-e2e/src/commands/selectAccount.ts index d82fdf35ed5..c4230a52533 100644 --- a/apps/remix-ide-e2e/src/commands/selectAccount.ts +++ b/apps/remix-ide-e2e/src/commands/selectAccount.ts @@ -6,7 +6,6 @@ class SelectAccount extends EventEmitter { if (account) { this.api .click(`*[data-id="runTabSelectAccount"]`) //open the dropdown - // .waitForElementVisible(`*[data-id="custom-dropdown-items"]`) .waitForElementVisible(`*[data-id="${account}"]`) .click(`*[data-id="${account}"]`) //close the dropdown .perform(() => { diff --git a/libs/remix-ui/run-tab/src/lib/components/account.tsx b/libs/remix-ui/run-tab/src/lib/components/account.tsx index c7d990e3518..7b55d51b19a 100644 --- a/libs/remix-ui/run-tab/src/lib/components/account.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/account.tsx @@ -257,22 +257,6 @@ export function AccountUI(props: AccountProps) { )) : } - {/* */}
)