From d7856d5b3b6b4f7e13e5dc1317cf5ac0500a9c5e Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 28 Jun 2022 12:50:34 +0200 Subject: [PATCH] fix test --- apps/remix-ide-e2e/src/tests/ballot.test.ts | 8 ++++---- apps/remix-ide-e2e/src/tests/ballot_0_4_11.test.ts | 6 +++--- apps/remix-ide-e2e/src/tests/debugger.test.ts | 8 ++++---- apps/remix-ide-e2e/src/tests/providers.test.ts | 3 --- apps/remix-ide-e2e/src/tests/terminal.test.ts | 4 ++-- apps/remix-ide-e2e/src/tests/workspace.test.ts | 12 ++++++------ apps/remix-ide/src/app/tabs/basic-http-provider.tsx | 2 +- apps/remix-ide/src/app/udapp/run-tab.js | 2 +- .../remix-app/components/modals/modal-wrapper.tsx | 13 +++++-------- .../app/src/lib/remix-app/context/provider.tsx | 2 +- 10 files changed, 27 insertions(+), 33 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index 5244241e89..2f316e09d4 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts @@ -83,10 +83,10 @@ module.exports = { browser .openFile('Untitled.sol') .clickLaunchIcon('udapp') - .click('*[data-id="settingsWeb3Mode"]') - .waitForElementPresent('[data-id="envNotification-modal-footer-ok-react"]') + .click('*[data-id="settingsSelectEnvOptions"] *[data-id="Basic Http Provider"]') + .waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]') .execute(function () { - const modal = document.querySelector('[data-id="envNotification-modal-footer-ok-react"]') as any + const modal = document.querySelector('[data-id="basic-http-provider-modal-footer-ok-react"]') as any modal.click() }) @@ -96,7 +96,7 @@ module.exports = { return env.value }, [], function (result) { - browser.assert.ok(result.value === 'web3', 'Web3 Provider not selected') + browser.assert.ok(result.value === 'Basic Http Provider', 'Web3 Provider not selected') }) .clickLaunchIcon('solidity') .clickLaunchIcon('udapp') diff --git a/apps/remix-ide-e2e/src/tests/ballot_0_4_11.test.ts b/apps/remix-ide-e2e/src/tests/ballot_0_4_11.test.ts index 28b03219fc..c82efff738 100644 --- a/apps/remix-ide-e2e/src/tests/ballot_0_4_11.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot_0_4_11.test.ts @@ -78,10 +78,10 @@ module.exports = { browser .openFile('Untitled.sol') .clickLaunchIcon('udapp') - .click('*[data-id="settingsWeb3Mode"]') - .waitForElementPresent('[data-id="envNotification-modal-footer-ok-react"]') + .click('*[data-id="settingsSelectEnvOptions"] *[data-id="Basic Http Provider"]') + .waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]') .execute(function () { - const modal = document.querySelector('[data-id="envNotification-modal-footer-ok-react"]') as any + const modal = document.querySelector('[data-id="basic-http-provider-modal-footer-ok-react"]') as any modal.click() }) diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts index d46c1020ce..fe424b5e61 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.test.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts @@ -214,10 +214,10 @@ module.exports = { .setSolidityCompilerVersion('soljson-v0.8.7+commit.e28d00a7.js') .addFile('useDebugNodes.sol', sources[5]['useDebugNodes.sol']) // compile contract .clickLaunchIcon('udapp') - .click('*[data-id="settingsWeb3Mode"]') // select web3 provider with debug nodes URL - .clearValue('*[data-id="modalDialogCustomPromptText"]') - .setValue('*[data-id="modalDialogCustomPromptText"]', 'https://remix-rinkeby.ethdevops.io') - .modalFooterOKClick() + .click('*[data-id="settingsSelectEnvOptions"] *[data-id="Basic Http Provider"]') // select web3 provider with debug nodes URL + .clearValue('*[data-id="modalDialogCustomPromp"]') + .setValue('*[data-id="modalDialogCustomPromp"]', 'https://remix-rinkeby.ethdevops.io') + .modalFooterOKClick('basic-http-provider') .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 65000) // wait for the compilation to succeed .clickLaunchIcon('debugger') .clearValue('*[data-id="debuggerTransactionInput"]') diff --git a/apps/remix-ide-e2e/src/tests/providers.test.ts b/apps/remix-ide-e2e/src/tests/providers.test.ts index b2c883fd53..fe6dcde8bf 100644 --- a/apps/remix-ide-e2e/src/tests/providers.test.ts +++ b/apps/remix-ide-e2e/src/tests/providers.test.ts @@ -44,9 +44,6 @@ module.exports = { .waitForElementContainsText('*[data-id="foundry-providerModalDialogModalBody-react"]', 'Error while connecting to the provider') .modalFooterOKClick('foundry-provider') .waitForElementNotVisible('*[data-id="foundry-providerModalDialogModalBody-react"]') - .waitForElementVisible('*[data-id="PermissionHandler-modal-footer-ok-react"]') - .click('*[data-id="PermissionHandler-modal-footer-ok-react"]') - .waitForElementNotVisible('*[data-id="PermissionHandler-modal-footer-ok-react"]') .pause(1000) }, diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index a4b9421b56..7abbbccf05 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -50,8 +50,8 @@ module.exports = { browser .click('*[data-id="terminalClearConsole"]') // clear the terminal .clickLaunchIcon('udapp') - .click('*[data-id="settingsWeb3Mode"]') - .modalFooterOKClick('envNotification') + .click('*[data-id="settingsSelectEnvOptions"] *[data-id="Basic Http Provider"]') + .modalFooterOKClick('basic-http-provider') .executeScript('web3.eth.getAccounts()') .waitForElementContainsText('*[data-id="terminalJournal"]', '["', 60000) // we check if an array is present, don't need to check for the content .waitForElementContainsText('*[data-id="terminalJournal"]', '"]', 60000) diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index 7e7cfbd55e..95819b7598 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -38,7 +38,7 @@ module.exports = { .clickLaunchIcon('filePanel') .click('*[data-id="workspaceCreate"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') // eslint-disable-next-line dot-notation .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_remix_default' }) .waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') @@ -94,7 +94,7 @@ module.exports = { browser .click('*[data-id="workspaceCreate"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') // eslint-disable-next-line dot-notation .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' }) .click('select[id="wstemplate"]') @@ -115,7 +115,7 @@ module.exports = { browser .click('*[data-id="workspaceCreate"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') // eslint-disable-next-line dot-notation .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc20' }) .click('select[id="wstemplate"]') @@ -163,7 +163,7 @@ module.exports = { browser .click('*[data-id="workspaceCreate"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') // eslint-disable-next-line dot-notation .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc721' }) .click('select[id="wstemplate"]') @@ -213,7 +213,7 @@ module.exports = { browser .click('*[data-id="workspaceCreate"]') // create workspace_name .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') .click('*[data-id="modalDialogCustomPromptTextCreate"]') .clearValue('*[data-id="modalDialogCustomPromptTextCreate"]') .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_name') @@ -225,7 +225,7 @@ module.exports = { .waitForElementVisible('*[data-id="treeViewLitreeViewItemtest.sol"]') .click('*[data-id="workspaceCreate"]') // create workspace_name_1 .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') - .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > span') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') .click('*[data-id="modalDialogCustomPromptTextCreate"]') .clearValue('*[data-id="modalDialogCustomPromptTextCreate"]') .setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_name_1') diff --git a/apps/remix-ide/src/app/tabs/basic-http-provider.tsx b/apps/remix-ide/src/app/tabs/basic-http-provider.tsx index 5acd2a5200..30a0f1f310 100644 --- a/apps/remix-ide/src/app/tabs/basic-http-provider.tsx +++ b/apps/remix-ide/src/app/tabs/basic-http-provider.tsx @@ -10,7 +10,7 @@ const profile = { name: 'basic-http-provider', displayName: 'Basic Http Provider', kind: 'provider', - description: 'Anvil', + description: '', methods: ['sendAsync'], version: packageJson.version } diff --git a/apps/remix-ide/src/app/udapp/run-tab.js b/apps/remix-ide/src/app/udapp/run-tab.js index b1d6d31290..af0ecf6563 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.js +++ b/apps/remix-ide/src/app/udapp/run-tab.js @@ -157,7 +157,7 @@ export class RunTab extends ViewPlugin { }) await this.call('blockchain', 'addProvider', { - name: 'Web3 Provider', + name: 'Basic Http Provider', provider: { async sendAsync (payload, callback) { try { diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx index 9ee12e871a..17c6f604d6 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx @@ -32,10 +32,8 @@ const ModalWrapper = (props: ModalWrapperProps) => { const onInputChanged = (event) => { if (props.validationFn) { const validation = props.validationFn(event.target.value) - setState({ - ...props, - message: createModalMessage(props.defaultValue, validation), - validation + setState(prevState => { + return { ...prevState, message: createModalMessage(props.defaultValue, validation), validation } }) } } @@ -66,7 +64,7 @@ const ModalWrapper = (props: ModalWrapperProps) => { default: setState({ ...props, - okFn: (onOkFn), + okFn: onOkFn, cancelFn: onCancelFn }) break @@ -82,9 +80,8 @@ const ModalWrapper = (props: ModalWrapperProps) => { // reset the message and input if any, so when the modal is shown again it doesn't show the previous value. const handleHide = () => { - setState({ - ...props, - message: '' + setState(prevState => { + return { ...prevState, message: '' } }) props.handleHide() } diff --git a/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx b/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx index 48f810bea2..701375265d 100644 --- a/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx @@ -32,7 +32,7 @@ export const ModalProvider = ({ children = [], reducer = modalReducer, initialSt const handleHideModal = () => { dispatch({ type: modalActionTypes.handleHideModal, - payload: null, + payload: null }) }