From 87b2425879ba99f9f4b591f5a44d01d5e5adb255 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:50:25 +0100 Subject: [PATCH 01/28] rm AI key binding for explaining function --- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index ab8de7ec34..9a3957eb8c 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -825,10 +825,6 @@ export const EditorUI = (props: EditorUIProps) => { label: intl.formatMessage({ id: 'editor.explainFunction' }), contextMenuOrder: 1, // choose the order contextMenuGroupId: 'gtp', // create a new grouping - keybindings: [ - // Keybinding for Ctrl + Shift + E - monacoRef.current.KeyMod.CtrlCmd | monacoRef.current.KeyMod.Shift | monacoRef.current.KeyCode.KeyE - ], run: async () => { const file = await props.plugin.call('fileManager', 'getCurrentFile') const context = await props.plugin.call('fileManager', 'readFile', file) From 000124946a3a72332d69ae351d780fd38d6303b7 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 23 Oct 2024 13:29:43 +0200 Subject: [PATCH 02/28] new icon for remixguide, border for navtab etc --- apps/remix-ide/src/app/plugins/remixGuide.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide/src/app/plugins/remixGuide.tsx b/apps/remix-ide/src/app/plugins/remixGuide.tsx index adee5e5a1a..f19163f7bc 100644 --- a/apps/remix-ide/src/app/plugins/remixGuide.tsx +++ b/apps/remix-ide/src/app/plugins/remixGuide.tsx @@ -8,6 +8,7 @@ import { RemixUIGridSection } from '@remix-ui/remix-ui-grid-section' import { RemixUIGridCell } from '@remix-ui/remix-ui-grid-cell' import * as Data from './remixGuideData.json' import './remixGuide.css' +import Icon from 'libs/remix-ui/vertical-icons-panel/src/lib/components/Icon' //@ts-ignore const _paq = (window._paq = window._paq || []) From fb77f3dfaf3a4d6c46fbba1e478ac60e25cac9d4 Mon Sep 17 00:00:00 2001 From: lianahus Date: Thu, 24 Oct 2024 16:11:27 +0200 Subject: [PATCH 03/28] fixed matomo --- apps/contract-verification/src/app/views/VerifyView.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/contract-verification/src/app/views/VerifyView.tsx b/apps/contract-verification/src/app/views/VerifyView.tsx index 20a0022d47..a924a2a89a 100644 --- a/apps/contract-verification/src/app/views/VerifyView.tsx +++ b/apps/contract-verification/src/app/views/VerifyView.tsx @@ -68,9 +68,9 @@ export const VerifyView = () => { name: verifierId as VerifierIdentifier, } receipts.push({ verifierInfo, status: 'pending', contractId, isProxyReceipt: false, failedChecks: 0 }) - if (enabledVerifiers.Blockscout) await sendToMatomo('verify', "verifyWith: Blockscout On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress)) - if (enabledVerifiers.Etherscan) await sendToMatomo('verify', "verifyWithEtherscan On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress)) - if (enabledVerifiers.Sourcify) await sendToMatomo('verify', "verifyWithSourcify On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress)) + if (enabledVerifiers.Blockscout) await sendToMatomo('verify', "verifyWith: Blockscout On: " + selectedChain?.chainId + " IsProxy: " + (hasProxy && !proxyAddress)) + if (enabledVerifiers.Etherscan) await sendToMatomo('verify', "verifyWithEtherscan On: " + selectedChain?.chainId + " IsProxy: " + (hasProxy && !proxyAddress)) + if (enabledVerifiers.Sourcify) await sendToMatomo('verify', "verifyWithSourcify On: " + selectedChain?.chainId + " IsProxy: " + (hasProxy && !proxyAddress)) } const newSubmittedContract: SubmittedContract = { From 9d6ef464d1f4fc944eac151548cea991097d33af Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 28 Oct 2024 18:44:50 +0100 Subject: [PATCH 04/28] Update remixGuide.tsx --- apps/remix-ide/src/app/plugins/remixGuide.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/app/plugins/remixGuide.tsx b/apps/remix-ide/src/app/plugins/remixGuide.tsx index f19163f7bc..adee5e5a1a 100644 --- a/apps/remix-ide/src/app/plugins/remixGuide.tsx +++ b/apps/remix-ide/src/app/plugins/remixGuide.tsx @@ -8,7 +8,6 @@ import { RemixUIGridSection } from '@remix-ui/remix-ui-grid-section' import { RemixUIGridCell } from '@remix-ui/remix-ui-grid-cell' import * as Data from './remixGuideData.json' import './remixGuide.css' -import Icon from 'libs/remix-ui/vertical-icons-panel/src/lib/components/Icon' //@ts-ignore const _paq = (window._paq = window._paq || []) From f14bbf068f7b29954bd988574994d06b2eba4cf0 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 06:31:25 +0100 Subject: [PATCH 05/28] test transaction --- .circleci/config.yml | 4 +-- apps/remix-ide-e2e/src/tests/metamask.test.ts | 26 +++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a02ab093d2..cc2943426e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: false + default: true orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 @@ -640,7 +640,7 @@ jobs: type: string jobsize: type: string - parallelism: 10 + parallelism: 1 steps: - checkout - attach_workspace: diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 0051c57d9c..f042face31 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -35,7 +35,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #flaky #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) @@ -96,6 +96,28 @@ const tests = { }) }) }, + 'Should run low level interaction (fallback function) on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return + browser.clearConsole().waitForElementPresent('*[data-id="remixIdeSidePanel"]') + .clickInstance(0) + .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') + .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') + .perform((done) => { + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + browser + .maximizeWindow() + .hideMetaMaskPopup() + .saveScreenshot('./reports/screenshots/metamask_tr1.png') + .waitForElementPresent('[data-testid="page-container-footer-next"]') + .saveScreenshot('./reports/screenshots/metamask_tr2.png') + .click('[data-testid="page-container-footer-next"]') // approve the tx + .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .perform(() => done()) + }) + }) + }, 'Should deploy faulty contract on Sepolia Test Network using MetaMask and show error in terminal #group1': function (browser: NightwatchBrowser) { browser .clearConsole() @@ -148,7 +170,7 @@ if (!checkBrowserIsChrome(browser)) { module.exports = {} } else { module.exports = { - ...(branch ? (isMasterBranch ? tests : {}) : tests), + ...tests//(branch ? (isMasterBranch ? tests : {}) : tests), }; } From c842bcd455ab84986053848b50d788565a59f885 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 06:55:43 +0100 Subject: [PATCH 06/28] transact --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index f042face31..fe3ffdac03 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -100,6 +100,7 @@ const tests = { if (!checkBrowserIsChrome(browser)) return browser.clearConsole().waitForElementPresent('*[data-id="remixIdeSidePanel"]') .clickInstance(0) + .clearConsole() .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') .perform((done) => { @@ -108,9 +109,10 @@ const tests = { .maximizeWindow() .hideMetaMaskPopup() .saveScreenshot('./reports/screenshots/metamask_tr1.png') - .waitForElementPresent('[data-testid="page-container-footer-next"]') + .scrollAndClick('[data-testid="page-container-footer-next"]') + //.waitForElementPresent('[data-testid="page-container-footer-next"]') .saveScreenshot('./reports/screenshots/metamask_tr2.png') - .click('[data-testid="page-container-footer-next"]') // approve the tx + //.click('[data-testid="page-container-footer-next"]') // approve the tx .switchBrowserTab(0) // back to remix .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) From 5d23b442626c0dfed031d41621b1a09832ad5980 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 07:04:16 +0100 Subject: [PATCH 07/28] more screens --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index fe3ffdac03..17944c1734 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -109,13 +109,16 @@ const tests = { .maximizeWindow() .hideMetaMaskPopup() .saveScreenshot('./reports/screenshots/metamask_tr1.png') + .pause(3000) .scrollAndClick('[data-testid="page-container-footer-next"]') //.waitForElementPresent('[data-testid="page-container-footer-next"]') .saveScreenshot('./reports/screenshots/metamask_tr2.png') + .pause(2000) //.click('[data-testid="page-container-footer-next"]') // approve the tx .switchBrowserTab(0) // back to remix .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .saveScreenshot('./reports/screenshots/metamask_tr3.png') .perform(() => done()) }) }) From 0296a538408bacdaa7a221caf8bbda08f7bc62e6 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 07:17:50 +0100 Subject: [PATCH 08/28] more checks --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 17944c1734..aba2f51b0c 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -116,6 +116,8 @@ const tests = { .pause(2000) //.click('[data-testid="page-container-footer-next"]') // approve the tx .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'transact to Helloworld', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'fallback', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) .saveScreenshot('./reports/screenshots/metamask_tr3.png') @@ -168,14 +170,14 @@ const tests = { } } -const branch = process.env.CIRCLE_BRANCH; -const isMasterBranch = (branch === 'master' || branch === 'remix_beta'); +const branch = process.env.CIRCLE_BRANCH +const runTestsConditions = (branch === 'master' || branch === 'remix_live' || branch.includes('remix_beta') || branch.includes('metamask')) if (!checkBrowserIsChrome(browser)) { module.exports = {} } else { module.exports = { - ...tests//(branch ? (isMasterBranch ? tests : {}) : tests), + ...(branch ? (runTestsConditions ? tests : {}) : tests) }; } From 57755aab0ccfd331ba70dd0056ae0d028c0b8399 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 07:35:05 +0100 Subject: [PATCH 09/28] fix assertions --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index aba2f51b0c..796e1afb77 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -116,8 +116,10 @@ const tests = { .pause(2000) //.click('[data-testid="page-container-footer-next"]') // approve the tx .switchBrowserTab(0) // back to remix - .waitForElementContainsText('*[data-id="terminalJournal"]', 'transact to Helloworld', 60000) - .waitForElementContainsText('*[data-id="terminalJournal"]', 'fallback', 60000) + .waitForElementVisible({ + locateStrategy: 'xpath', + selector: "//span[@class='text-log' and contains(., 'transact to HelloWorld.(fallback) pending')]" + }) .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) .saveScreenshot('./reports/screenshots/metamask_tr3.png') @@ -125,6 +127,37 @@ const tests = { }) }) }, + 'Should run transaction (greet function) on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return + browser.clearConsole().waitForElementPresent('*[data-id="remixIdeSidePanel"]') + .clickInstance(0) + .clearConsole() + .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') + .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') + .perform((done) => { + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + browser + .maximizeWindow() + .hideMetaMaskPopup() + .saveScreenshot('./reports/screenshots/metamask_tr4.png') + .pause(3000) + .scrollAndClick('[data-testid="page-container-footer-next"]') + //.waitForElementPresent('[data-testid="page-container-footer-next"]') + .saveScreenshot('./reports/screenshots/metamask_tr5.png') + .pause(2000) + //.click('[data-testid="page-container-footer-next"]') // approve the tx + .switchBrowserTab(0) // back to remix + .waitForElementVisible({ + locateStrategy: 'xpath', + selector: "//span[@class='text-log' and contains(., 'transact to HelloWorld.greet pending')]" + }) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .saveScreenshot('./reports/screenshots/metamask_tr6.png') + .perform(() => done()) + }) + }) + }, 'Should deploy faulty contract on Sepolia Test Network using MetaMask and show error in terminal #group1': function (browser: NightwatchBrowser) { browser .clearConsole() From db7e812a7083cc7c1c880ebc20e88f41f092f1d3 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 07:40:31 +0100 Subject: [PATCH 10/28] transact greet --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 796e1afb77..1603dfa67b 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -130,10 +130,14 @@ const tests = { 'Should run transaction (greet function) on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.clearConsole().waitForElementPresent('*[data-id="remixIdeSidePanel"]') - .clickInstance(0) .clearConsole() - .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') - .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') + .waitForElementPresent('*[data-title="string _message"]') + .setValue('*[data-title="string _message"]', 'test') + .saveScreenshot('./reports/screenshots/metamask_tr7.png') + .waitForElementVisible('*[data-id="greet - transact (not payable)"]') + .saveScreenshot('./reports/screenshots/metamask_tr9.png') + .click('*[data-id="greet - transact (not payable)"]') + .saveScreenshot('./reports/screenshots/metamask_tr8.png') .perform((done) => { browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser From f3bf9f01095794ebb6f9e6e1693161c3b64a723f Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 08:08:38 +0100 Subject: [PATCH 11/28] debugger --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 77 ++++++++++++++++--- 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 1603dfa67b..19ca145123 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -25,6 +25,13 @@ const checkAlerts = function (browser: NightwatchBrowser) { }) } +const localsCheck = { + _message: { + value: 'test', + type: 'string' + } +} + const tests = { '@disabled': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -35,8 +42,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #flaky #group1': function (browser: NightwatchBrowser) { - if (!checkBrowserIsChrome(browser)) return + 'Should connect to Sepolia Test Network using MetaMask #flaky #group2 #group1': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) .useCss().switchBrowserTab(0) @@ -63,7 +69,6 @@ const tests = { }, 'Should add a contract file #group1': function (browser: NightwatchBrowser) { - if (!checkBrowserIsChrome(browser)) return browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .clickLaunchIcon('filePanel') .addFile('Greet.sol', sources[0]['Greet.sol']) @@ -72,7 +77,6 @@ const tests = { }, 'Should deploy contract on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { - if (!checkBrowserIsChrome(browser)) return browser.clearConsole().waitForElementPresent('*[data-id="runTabSelectAccount"] option', 45000) .clickLaunchIcon('filePanel') .openFile('Greet.sol') @@ -97,7 +101,6 @@ const tests = { }) }, 'Should run low level interaction (fallback function) on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { - if (!checkBrowserIsChrome(browser)) return browser.clearConsole().waitForElementPresent('*[data-id="remixIdeSidePanel"]') .clickInstance(0) .clearConsole() @@ -128,7 +131,6 @@ const tests = { }) }, 'Should run transaction (greet function) on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { - if (!checkBrowserIsChrome(browser)) return browser.clearConsole().waitForElementPresent('*[data-id="remixIdeSidePanel"]') .clearConsole() .waitForElementPresent('*[data-title="string _message"]') @@ -162,6 +164,34 @@ const tests = { }) }) }, + 'Should debug Sepolia transaction with source highlighting MetaMask #group1': function (browser: NightwatchBrowser) { + let txhash + browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) + .clickLaunchIcon('pluginManager') // load debugger and source verification + // .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_sourcify"] button') + // debugger already activated .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_debugger"] button') + .clickLaunchIcon('udapp') + .perform((done) => { + browser.getLastTransactionHash((hash) => { + txhash = hash + done() + }) + }) + .perform((done) => { + browser + .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) + .clickLaunchIcon('debugger') + .setValue('*[data-id="debuggerTransactionInput"]', txhash) // debug tx + .saveScreenshot('./reports/screenshots/metamask_debug.png') + .saveScreenshot('./reports/screenshots/metamask_2.png') + .click('*[data-id="debuggerTransactionStartButton"]') + .saveScreenshot('./reports/screenshots/metamask_3.png') + .waitForElementVisible('*[data-id="treeViewDivto"]', 30000) + .checkVariableDebug('soliditylocals', localsCheck) + .perform(() => done()) + }) + + }, 'Should deploy faulty contract on Sepolia Test Network using MetaMask and show error in terminal #group1': function (browser: NightwatchBrowser) { browser .clearConsole() @@ -181,7 +211,6 @@ const tests = { }) }, 'Should deploy contract on Sepolia Test Network using MetaMask again #group1': function (browser: NightwatchBrowser) { - if (!checkBrowserIsChrome(browser)) return browser.clearConsole().waitForElementPresent('*[data-id="runTabSelectAccount"] option', 45000) .clickLaunchIcon('filePanel') .openFile('Greet.sol') @@ -204,11 +233,41 @@ const tests = { .perform(() => done()) }) }) - } + }, + + // main network tests + 'Should connect to Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { + browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') + .switchBrowserTab(1) + .click('[data-testid="network-display"]') + .click('div[data-testid="Ethereum Mainnet"]') // switch to mainnet + .useCss().switchBrowserTab(0) + .refreshPage() + .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) + .click('*[data-id="landingPageStartSolidity"]') + .clickLaunchIcon('udapp') + .switchEnvironment('injected-MetaMask') + .waitForElementPresent('*[data-id="settingsNetworkEnv"]') + .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network') + }, + + 'Should deploy contract on Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { + browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') + .clickLaunchIcon('filePanel') + .addFile('Greet.sol', sources[0]['Greet.sol']) + .clickLaunchIcon('udapp') + .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') + .click('*[data-id="Deploy - transact (not payable)"]') + .waitForElementVisible('*[data-id="udappNotifyModalDialogModalBody-react"]', 65000) + .modalFooterOKClick('udappNotify') + .pause(10000) + .assert.containsText('*[data-id="udappNotifyModalDialogModalBody-react"]', 'You are about to create a transaction on Main Network. Confirm the details to send the info to your provider.') + .modalFooterCancelClick('udappNotify') + }, } const branch = process.env.CIRCLE_BRANCH -const runTestsConditions = (branch === 'master' || branch === 'remix_live' || branch.includes('remix_beta') || branch.includes('metamask')) +const runTestsConditions = branch && (branch === 'master' || branch === 'remix_live' || branch.includes('remix_beta') || branch.includes('metamask')) if (!checkBrowserIsChrome(browser)) { module.exports = {} From 565d79cab7e9f23d68c4066ff217d247a61f9357 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 10:38:34 +0100 Subject: [PATCH 12/28] ballot --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 120 +++++++++++++----- 1 file changed, 89 insertions(+), 31 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 19ca145123..9ab97b97a1 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -26,9 +26,9 @@ const checkAlerts = function (browser: NightwatchBrowser) { } const localsCheck = { - _message: { - value: 'test', - type: 'string' + to: { + value: '0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB', + type: 'address' } } @@ -42,7 +42,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #flaky #group2 #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #group3 #group2 #group1': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) .useCss().switchBrowserTab(0) @@ -164,34 +164,7 @@ const tests = { }) }) }, - 'Should debug Sepolia transaction with source highlighting MetaMask #group1': function (browser: NightwatchBrowser) { - let txhash - browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .clickLaunchIcon('pluginManager') // load debugger and source verification - // .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_sourcify"] button') - // debugger already activated .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_debugger"] button') - .clickLaunchIcon('udapp') - .perform((done) => { - browser.getLastTransactionHash((hash) => { - txhash = hash - done() - }) - }) - .perform((done) => { - browser - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .clickLaunchIcon('debugger') - .setValue('*[data-id="debuggerTransactionInput"]', txhash) // debug tx - .saveScreenshot('./reports/screenshots/metamask_debug.png') - .saveScreenshot('./reports/screenshots/metamask_2.png') - .click('*[data-id="debuggerTransactionStartButton"]') - .saveScreenshot('./reports/screenshots/metamask_3.png') - .waitForElementVisible('*[data-id="treeViewDivto"]', 30000) - .checkVariableDebug('soliditylocals', localsCheck) - .perform(() => done()) - }) - }, 'Should deploy faulty contract on Sepolia Test Network using MetaMask and show error in terminal #group1': function (browser: NightwatchBrowser) { browser .clearConsole() @@ -264,6 +237,91 @@ const tests = { .assert.containsText('*[data-id="udappNotifyModalDialogModalBody-react"]', 'You are about to create a transaction on Main Network. Confirm the details to send the info to your provider.') .modalFooterCancelClick('udappNotify') }, + // debug transaction + 'Should deploy Ballot to Sepolia using metamask #group3 #flaky': function (browser: NightwatchBrowser) { + browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') + .switchBrowserTab(1) + .click('[data-testid="network-display"]') + .click('div[data-testid="Sepolia"]') // switch to sepolia + .useCss().switchBrowserTab(0) + .openFile('contracts') + .openFile('contracts/3_Ballot.sol') + .clickLaunchIcon('udapp') + .clearConsole() + .clearTransactions() + .clickLaunchIcon('udapp') + .waitForElementVisible('input[placeholder="bytes32[] proposalNames"]') + .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') + .click('*[data-id="Deploy - transact (not payable)"]') // deploy ballot + .pause(5000) + .perform((done) => { + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + browser + .maximizeWindow() + .hideMetaMaskPopup() + .saveScreenshot('./reports/screenshots/metamask_4.png') + .scrollAndClick('[data-testid="page-container-footer-next"]') + .click('[data-testid="page-container-footer-next"]') // approve the tx + .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .perform(() => done()) + }) + }) + .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) + .clearConsole() + .clickInstance(0) + .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) + .pause(5000) + .perform((done) => { // call delegate + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + browser + .maximizeWindow() + .hideMetaMaskPopup() + .saveScreenshot('./reports/screenshots/metamask_5.png') + .scrollAndClick('[data-testid="page-container-footer-next"]') + .click('[data-testid="page-container-footer-next"]') // approve the tx + .pause(2000) + .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .perform(() => done()) + }) + }) + .testFunction('last', + { + status: '0x1 Transaction mined and execution succeed', + 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + }) + }, + 'Should debug Sepolia transaction with source highlighting MetaMask #group3': !function (browser: NightwatchBrowser) { + let txhash + browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) + .clickLaunchIcon('pluginManager') // load debugger and source verification + // .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_sourcify"] button') + // debugger already activated .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_debugger"] button') + .clickLaunchIcon('udapp') + .perform((done) => { + browser.getLastTransactionHash((hash) => { + txhash = hash + done() + }) + }) + .perform((done) => { + browser + .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) + .clickLaunchIcon('debugger') + .setValue('*[data-id="debuggerTransactionInput"]', txhash) // debug tx + .saveScreenshot('./reports/screenshots/metamask_debug.png') + .saveScreenshot('./reports/screenshots/metamask_2.png') + .click('*[data-id="debuggerTransactionStartButton"]') + .saveScreenshot('./reports/screenshots/metamask_3.png') + .waitForElementVisible('*[data-id="treeViewDivto"]', 30000) + .checkVariableDebug('soliditylocals', localsCheck) + .perform(() => done()) + }) + + }, } const branch = process.env.CIRCLE_BRANCH From 1a85bc5fd5f6a37c9a3994fe9dc7a05308d929de Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 10:49:16 +0100 Subject: [PATCH 13/28] trans --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 9ab97b97a1..0978cf9901 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -260,11 +260,14 @@ const tests = { .maximizeWindow() .hideMetaMaskPopup() .saveScreenshot('./reports/screenshots/metamask_4.png') + .pause(3000) .scrollAndClick('[data-testid="page-container-footer-next"]') .click('[data-testid="page-container-footer-next"]') // approve the tx + .pause(2000) .switchBrowserTab(0) // back to remix .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .saveScreenshot('./reports/screenshots/metamask_5.png') .perform(() => done()) }) }) @@ -272,27 +275,30 @@ const tests = { .clearConsole() .clickInstance(0) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) + .saveScreenshot('./reports/screenshots/metamask_6.png') .pause(5000) .perform((done) => { // call delegate browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser .maximizeWindow() .hideMetaMaskPopup() - .saveScreenshot('./reports/screenshots/metamask_5.png') - .scrollAndClick('[data-testid="page-container-footer-next"]') - .click('[data-testid="page-container-footer-next"]') // approve the tx - .pause(2000) - .switchBrowserTab(0) // back to remix - .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) - .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + + .pause(3000) + .saveScreenshot('./reports/screenshots/metamask_7.png') + // .scrollAndClick('[data-testid="page-container-footer-next"]') + // .click('[data-testid="page-container-footer-next"]') // approve the tx + // .pause(2000) + // .switchBrowserTab(0) // back to remix + // .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + // .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) .perform(() => done()) }) }) - .testFunction('last', - { - status: '0x1 Transaction mined and execution succeed', - 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } - }) + //.testFunction('last', + // { + // status: '0x1 Transaction mined and execution succeed', + // 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + // }) }, 'Should debug Sepolia transaction with source highlighting MetaMask #group3': !function (browser: NightwatchBrowser) { let txhash From d0095e39429d2d4ffdae983d6feed8b62ff8b087 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 11:05:30 +0100 Subject: [PATCH 14/28] trans test --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 0978cf9901..0e810ba46e 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -274,16 +274,16 @@ const tests = { .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .clearConsole() .clickInstance(0) - .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) + .clickFunction('giveRightToVote - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .saveScreenshot('./reports/screenshots/metamask_6.png') - .pause(5000) + .pause() .perform((done) => { // call delegate browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser .maximizeWindow() .hideMetaMaskPopup() - .pause(3000) + .pause() .saveScreenshot('./reports/screenshots/metamask_7.png') // .scrollAndClick('[data-testid="page-container-footer-next"]') // .click('[data-testid="page-container-footer-next"]') // approve the tx From 8deac943f7b22453ed36a8e81c2fa6b9b6e8cc86 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 11:05:58 +0100 Subject: [PATCH 15/28] pause --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 0e810ba46e..6ec563aace 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -276,14 +276,14 @@ const tests = { .clickInstance(0) .clickFunction('giveRightToVote - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .saveScreenshot('./reports/screenshots/metamask_6.png') - .pause() + .pause(5000) .perform((done) => { // call delegate browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser .maximizeWindow() .hideMetaMaskPopup() - .pause() + .pause(5000) .saveScreenshot('./reports/screenshots/metamask_7.png') // .scrollAndClick('[data-testid="page-container-footer-next"]') // .click('[data-testid="page-container-footer-next"]') // approve the tx From d0815c692a424cc6d39b1cf808a2a3bfdc44b77e Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 11:19:30 +0100 Subject: [PATCH 16/28] send voter --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 6ec563aace..41a01eb72c 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -274,7 +274,7 @@ const tests = { .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .clearConsole() .clickInstance(0) - .clickFunction('giveRightToVote - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) + .clickFunction('giveRightToVote - transact (not payable)', { types: 'address voter', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .saveScreenshot('./reports/screenshots/metamask_6.png') .pause(5000) .perform((done) => { // call delegate From f170fd8cfd44e46ba6ad70594d8cbf4cf6c8ed3f Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 11:46:42 +0100 Subject: [PATCH 17/28] debug test --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 41a01eb72c..1647c69d43 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -1,6 +1,7 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' +import examples from '../examples/example-contracts' const passphrase = process.env.account_passphrase const password = process.env.account_password @@ -244,8 +245,7 @@ const tests = { .click('[data-testid="network-display"]') .click('div[data-testid="Sepolia"]') // switch to sepolia .useCss().switchBrowserTab(0) - .openFile('contracts') - .openFile('contracts/3_Ballot.sol') + .addFile('BallotTest.sol', examples.ballot) .clickLaunchIcon('udapp') .clearConsole() .clearTransactions() @@ -274,7 +274,7 @@ const tests = { .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .clearConsole() .clickInstance(0) - .clickFunction('giveRightToVote - transact (not payable)', { types: 'address voter', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) + .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .saveScreenshot('./reports/screenshots/metamask_6.png') .pause(5000) .perform((done) => { // call delegate @@ -285,22 +285,22 @@ const tests = { .pause(5000) .saveScreenshot('./reports/screenshots/metamask_7.png') - // .scrollAndClick('[data-testid="page-container-footer-next"]') + .scrollAndClick('[data-testid="page-container-footer-next"]') // .click('[data-testid="page-container-footer-next"]') // approve the tx - // .pause(2000) - // .switchBrowserTab(0) // back to remix - // .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) - // .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .pause(2000) + .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) .perform(() => done()) }) }) - //.testFunction('last', - // { - // status: '0x1 Transaction mined and execution succeed', - // 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } - // }) + .testFunction('last', + { + status: '0x1 Transaction mined and execution succeed', + 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + }) }, - 'Should debug Sepolia transaction with source highlighting MetaMask #group3': !function (browser: NightwatchBrowser) { + 'Should debug Sepolia transaction with source highlighting MetaMask #group3': function (browser: NightwatchBrowser) { let txhash browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('pluginManager') // load debugger and source verification From be30367e9b02c452dd50c30a1a95bdcbcecd4cf4 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 14:55:15 +0100 Subject: [PATCH 18/28] delegate --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 53 ++++++++++++++++--- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 1647c69d43..f0372dd1ae 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -43,7 +43,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #group3 #group2 #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #group4 #group3 #group2 #group1': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) .useCss().switchBrowserTab(0) @@ -288,19 +288,20 @@ const tests = { .scrollAndClick('[data-testid="page-container-footer-next"]') // .click('[data-testid="page-container-footer-next"]') // approve the tx .pause(2000) + .saveScreenshot('./reports/screenshots/metamask_8.png') .switchBrowserTab(0) // back to remix .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) .perform(() => done()) }) }) - .testFunction('last', - { - status: '0x1 Transaction mined and execution succeed', - 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } - }) + //.testFunction('last', + // { + // status: '0x1 Transaction mined and execution succeed', + // 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + // }) }, - 'Should debug Sepolia transaction with source highlighting MetaMask #group3': function (browser: NightwatchBrowser) { + 'Should debug Sepolia transaction with source highlighting MetaMask #group3': !function (browser: NightwatchBrowser) { let txhash browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('pluginManager') // load debugger and source verification @@ -328,6 +329,44 @@ const tests = { }) }, + 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group4': !function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return + browser + .executeScriptInTerminal('web3.eth.getAccounts()') + .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') + }, + + 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': !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"]') + .pause() + .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 + .switchBrowserTab(0) // back to remix + .perform(() => done()) + }) + }) + .pause(1000) + .journalChildIncludes('0x8be3a81e17b7e4a40006864a4ff6bfa3fb1e18b292b6f47edec95cd8feaa53275b90f56ca02669d461a297e6bf94ab0ee4b7c89aede3228ed5aedb59c7e007501c') + } } const branch = process.env.CIRCLE_BRANCH From dff9e015df743778c28b66f35b7431a36ba9df8f Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:05:27 +0100 Subject: [PATCH 19/28] split more --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 10 ++++++---- 1 file changed, 6 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 f0372dd1ae..31a45b10c5 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -261,8 +261,8 @@ const tests = { .hideMetaMaskPopup() .saveScreenshot('./reports/screenshots/metamask_4.png') .pause(3000) + .waitForElementPresent('[data-testid="page-container-footer-next"]') .scrollAndClick('[data-testid="page-container-footer-next"]') - .click('[data-testid="page-container-footer-next"]') // approve the tx .pause(2000) .switchBrowserTab(0) // back to remix .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) @@ -271,7 +271,10 @@ const tests = { .perform(() => done()) }) }) - .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) + }, + + 'do transaction #group3': function (browser: NightwatchBrowser) { + browser.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .clearConsole() .clickInstance(0) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) @@ -282,11 +285,10 @@ const tests = { browser .maximizeWindow() .hideMetaMaskPopup() - .pause(5000) .saveScreenshot('./reports/screenshots/metamask_7.png') + .waitForElementPresent('[data-testid="page-container-footer-next"]') .scrollAndClick('[data-testid="page-container-footer-next"]') - // .click('[data-testid="page-container-footer-next"]') // approve the tx .pause(2000) .saveScreenshot('./reports/screenshots/metamask_8.png') .switchBrowserTab(0) // back to remix From ed293f8592fdb505705db98bbd8feec6e722beb6 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:13:10 +0100 Subject: [PATCH 20/28] timeouts --- apps/remix-ide-e2e/nightwatch-chrome.ts | 2 +- apps/remixdesktop/test/nighwatch.app.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/nightwatch-chrome.ts b/apps/remix-ide-e2e/nightwatch-chrome.ts index f1b95992eb..d099623d55 100644 --- a/apps/remix-ide-e2e/nightwatch-chrome.ts +++ b/apps/remix-ide-e2e/nightwatch-chrome.ts @@ -21,7 +21,7 @@ module.exports = { 'default': { globals: { waitForConditionTimeout: 10000, - asyncHookTimeout: 10000000 + asyncHookTimeout: 30000 }, screenshots: { enabled: true, diff --git a/apps/remixdesktop/test/nighwatch.app.ts b/apps/remixdesktop/test/nighwatch.app.ts index ee439cccf7..4498db0f52 100644 --- a/apps/remixdesktop/test/nighwatch.app.ts +++ b/apps/remixdesktop/test/nighwatch.app.ts @@ -42,7 +42,7 @@ module.exports = { selenium_host: 'localhost', globals: { waitForConditionTimeout: 10000, - asyncHookTimeout: 100000 + asyncHookTimeout: 30000 }, screenshots: { enabled: true, From cf7de33003970b83bbf2d60c58a72b3b6558538a Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:21:13 +0100 Subject: [PATCH 21/28] snap before --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 31a45b10c5..f674682d46 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -254,6 +254,7 @@ const tests = { .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .click('*[data-id="Deploy - transact (not payable)"]') // deploy ballot .pause(5000) + .saveScreenshot('./reports/screenshots/metamask_before.png') .perform((done) => { browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser From ba7afff408d5ccdf6f1a65daff7be46b498f1b89 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:37:52 +0100 Subject: [PATCH 22/28] assertions --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index f674682d46..ab966d75de 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -251,9 +251,19 @@ const tests = { .clearTransactions() .clickLaunchIcon('udapp') .waitForElementVisible('input[placeholder="bytes32[] proposalNames"]') + .pause(2000) .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') + .pause(1000) .click('*[data-id="Deploy - transact (not payable)"]') // deploy ballot - .pause(5000) + .pause(1000) + .waitForElementVisible({ + locateStrategy: 'xpath', + selector: "//span[@class='text-log' and contains(., 'creation of')]" + }) + .waitForElementVisible({ + locateStrategy: 'xpath', + selector: "//span[@class='text-log' and contains(., 'pending')]" + }) .saveScreenshot('./reports/screenshots/metamask_before.png') .perform((done) => { browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { From ffeb7a9ef62c152b5ad5c8093d571ccd187f6ee9 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:52:58 +0100 Subject: [PATCH 23/28] timeout --- apps/remix-ide-e2e/nightwatch-chrome.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/nightwatch-chrome.ts b/apps/remix-ide-e2e/nightwatch-chrome.ts index d099623d55..235fe625bb 100644 --- a/apps/remix-ide-e2e/nightwatch-chrome.ts +++ b/apps/remix-ide-e2e/nightwatch-chrome.ts @@ -21,7 +21,7 @@ module.exports = { 'default': { globals: { waitForConditionTimeout: 10000, - asyncHookTimeout: 30000 + asyncHookTimeout: 120000 }, screenshots: { enabled: true, From 67b4961bb886dcd95740ec908142d4d82b2f8021 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 16:02:59 +0100 Subject: [PATCH 24/28] test fn --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index ab966d75de..275a8f5a67 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -308,13 +308,13 @@ const tests = { .perform(() => done()) }) }) - //.testFunction('last', - // { - // status: '0x1 Transaction mined and execution succeed', - // 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } - // }) + .testFunction('last', + { + status: '0x1 Transaction mined and execution succeed', + 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + }) }, - 'Should debug Sepolia transaction with source highlighting MetaMask #group3': !function (browser: NightwatchBrowser) { + 'Should debug Sepolia transaction with source highlighting MetaMask #group3': function (browser: NightwatchBrowser) { let txhash browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('pluginManager') // load debugger and source verification From 938a0751d7b12329569675f10db74509dd41c543 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 19:06:44 +0100 Subject: [PATCH 25/28] add pause --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 275a8f5a67..6bbe11f42e 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -327,11 +327,13 @@ const tests = { done() }) }) + .pause(5000) .perform((done) => { browser .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('debugger') .setValue('*[data-id="debuggerTransactionInput"]', txhash) // debug tx + .pause() .saveScreenshot('./reports/screenshots/metamask_debug.png') .saveScreenshot('./reports/screenshots/metamask_2.png') .click('*[data-id="debuggerTransactionStartButton"]') From ac2a3f8b14304f43d34fbe0e6f085ba342c3fdc1 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 31 Oct 2024 07:09:35 +0100 Subject: [PATCH 26/28] add test --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 6bbe11f42e..c33fbfc322 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -332,8 +332,9 @@ const tests = { browser .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('debugger') + .waitForElementVisible('*[data-id="debuggerTransactionInput"]') .setValue('*[data-id="debuggerTransactionInput"]', txhash) // debug tx - .pause() + .pause(2000) .saveScreenshot('./reports/screenshots/metamask_debug.png') .saveScreenshot('./reports/screenshots/metamask_2.png') .click('*[data-id="debuggerTransactionStartButton"]') @@ -344,7 +345,7 @@ const tests = { }) }, - 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group4': !function (browser: NightwatchBrowser) { + 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group3': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser .executeScriptInTerminal('web3.eth.getAccounts()') From 60a85a6729e8b454673b531eda65fec9f2ff2e35 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 31 Oct 2024 07:51:47 +0100 Subject: [PATCH 27/28] group4 --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index c33fbfc322..ab06924851 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -352,8 +352,9 @@ const tests = { .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') }, - 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': !function (browser: NightwatchBrowser) { - browser.waitForElementPresent('i[id="remixRunSignMsg"]') + 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': function (browser: NightwatchBrowser) { + browser + .waitForElementPresent('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]') .waitForElementVisible('*[data-id="signMessageTextarea"]', 120000) .click('*[data-id="sign-eip-712"]') From 0bfaa111f82f3b28413117100d906509047630b0 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 31 Oct 2024 09:26:21 +0100 Subject: [PATCH 28/28] 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 = [ {