From 153a821bdb6f5280f2fa1774381744d7065b944d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 31 Oct 2024 09:26:21 +0100 Subject: [PATCH] fix test --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index ab06924851..43dc6ae126 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -364,19 +364,21 @@ const tests = { .getEditorValue((content) => { browser.assert.ok(content.indexOf('"primaryType": "AuthRequest",') !== -1, 'EIP 712 data file must be opened') }) + .setEditorValue(JSON.stringify(EIP712_Example, null, '\t')) + .pause(5000) .clickLaunchIcon('filePanel') .rightClick('li[data-id="treeViewLitreeViewItemEIP-712-data.json"]') .click('*[data-id="contextMenuItemsignTypedData"]') - .pause() + .pause(1000) .perform((done) => { // call delegate browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser .maximizeWindow() .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 + .pause() + .waitForElementPresent('[data-testid="page-container-footer-next"]') + .scrollAndClick('button[data-testid="page-container-footer-next"]') // confirm .switchBrowserTab(0) // back to remix .perform(() => done()) }) @@ -398,6 +400,32 @@ if (!checkBrowserIsChrome(browser)) { } +const EIP712_Example = { + domain: { + chainId: 11155111, + name: "Example App", + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", + version: "1", + }, + message: { + prompt: "Welcome! In order to authenticate to this website, sign this request and your public address will be sent to the server in a verifiable way.", + createdAt: 1718570375196, + }, + primaryType: 'AuthRequest', + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + AuthRequest: [ + { name: 'prompt', type: 'string' }, + { name: 'createdAt', type: 'uint256' }, + ], + }, +} + const sources = [ {