From 21fa55974499afdd2c0978d1f2eb5a6db52b9b02 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 15 Oct 2024 15:15:55 +0200 Subject: [PATCH] fix and add metamask test --- .../src/tests/runAndDeploy_injected.test.ts | 32 +++++++++++++++++++ apps/remix-ide/src/app/udapp/run-tab.tsx | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 446d5e4d13..3ad9272aee 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -238,7 +238,39 @@ const tests = { browser .executeScriptInTerminal('web3.eth.getAccounts()') .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') + }, + + 'Test EIP 712 Signature with Injected Provider (Metamask) #group1': function (browser: NightwatchBrowser) { + browser.waitForElementPresent('i[id="remixRunSignMsg"]') + .click('i[id="remixRunSignMsg"]') + .waitForElementVisible('*[data-id="signMessageTextarea"]', 120000) + .click('*[data-id="sign-eip-712"]') + .waitForElementVisible('*[data-id="udappNotify-modal-footer-ok-react"]') + .modalFooterOKClick('udappNotify') + .pause(1000) + .getEditorValue((content) => { + browser.assert.ok(content.indexOf('"primaryType": "AuthRequest",') !== -1, 'EIP 712 data file must be opened') + }) + .clickLaunchIcon('filePanel') + .rightClick('li[data-id="treeViewLitreeViewItemEIP-712-data.json"]') + .click('*[data-id="contextMenuItemsignTypedData"]') + .perform((done) => { // call delegate + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + browser + .hideMetaMaskPopup() + .saveScreenshot('./reports/screenshots/metamask_6.png') + .waitForElementPresent('button[aria-label="Scroll down"]', 60000) + .click('button[aria-label="Scroll down"]') // scroll down + .click('button[data-testid="confirm-footer-button"]') // confirm + .switchBrowserTab(0) // back to remix + .perform(() => done()) + }) + }) + .pause(1000) + .journalChildIncludes('0x8be3a81e17b7e4a40006864a4ff6bfa3fb1e18b292b6f47edec95cd8feaa53275b90f56ca02669d461a297e6bf94ab0ee4b7c89aede3228ed5aedb59c7e007501c') } + + } const branch = process.env.CIRCLE_BRANCH; diff --git a/apps/remix-ide/src/app/udapp/run-tab.tsx b/apps/remix-ide/src/app/udapp/run-tab.tsx index 91099bebcb..84c50b5475 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.tsx +++ b/apps/remix-ide/src/app/udapp/run-tab.tsx @@ -206,7 +206,7 @@ export class RunTab extends ViewPlugin { } return requestResult.result } catch (err) { - throw new Error(err.error.message) + throw new Error(err.message) } } }