From 35b9a4492fe7bd72a1841a5fdc719906220d0ec3 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 06:31:25 +0100 Subject: [PATCH 01/75] 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 edd4e8624604cfc920d59fb91ed466cc2b751444 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 06:55:43 +0100 Subject: [PATCH 02/75] 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 58fa391cd6069091bac9c46f96260a76d63c3636 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 07:04:16 +0100 Subject: [PATCH 03/75] 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 81b401d83f4feeed82b3ce9e50317ed323f01af6 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 07:17:50 +0100 Subject: [PATCH 04/75] 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 5e9d3c05cc660b299bbb04fc9414ad36c9783636 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 07:35:05 +0100 Subject: [PATCH 05/75] 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 0dcb7887258394fa362eb3885fff9cae4fcfec5f Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 07:40:31 +0100 Subject: [PATCH 06/75] 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 68386ae361bd6749db5c36efb4c59f7b132c1a31 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 08:08:38 +0100 Subject: [PATCH 07/75] 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 8cda3fc649ca8aa2c2cf61ee714b0b74419ded35 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 10:38:34 +0100 Subject: [PATCH 08/75] 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 e2d071ea1d238476a2e84f5e6b2dde740dff6cd7 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 10:49:16 +0100 Subject: [PATCH 09/75] 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 79bba2135513f8253e7bebc19254ea0403c1866f Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 11:05:30 +0100 Subject: [PATCH 10/75] 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 b0a330aafaaab07be4f7d3b9169f62481f820f60 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 11:05:58 +0100 Subject: [PATCH 11/75] 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 7be5656b2fead65603902bb165e24bdc81541aaa Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 11:19:30 +0100 Subject: [PATCH 12/75] 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 bf033c851b1b4835b969c323b3bb43b1ebd6d570 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 11:46:42 +0100 Subject: [PATCH 13/75] 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 8e77790e1e4b08c403ecfb646aeace5792d72953 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 14:55:15 +0100 Subject: [PATCH 14/75] 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 672df6f536126cd511f2eca9f0b7ada52750ab43 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:05:27 +0100 Subject: [PATCH 15/75] 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 4128688ece62407eb18daeea28261195d19a19f2 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:13:10 +0100 Subject: [PATCH 16/75] 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 82f5ed24b946bc6f6a27348fbed0c61a7825984d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:21:13 +0100 Subject: [PATCH 17/75] 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 497c361cb7620204a95f78ad5a21ff09af85642d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:37:52 +0100 Subject: [PATCH 18/75] 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 5d622e82ec0fea49ede9a528fe652267b2f03e30 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 15:52:58 +0100 Subject: [PATCH 19/75] 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 5a518adba5303b8c1372cb036ed9c86d59cddc35 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 16:02:59 +0100 Subject: [PATCH 20/75] 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 1eef7033d97258f82555e9dafc9e1770dd43c2e5 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 19:06:44 +0100 Subject: [PATCH 21/75] 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 4d0428c722a0479eca75437391b00de50b523928 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 31 Oct 2024 07:09:35 +0100 Subject: [PATCH 22/75] 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 53c039d1c3e0acc1f5c968ef937d69fd9d189576 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 31 Oct 2024 07:51:47 +0100 Subject: [PATCH 23/75] 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 153a821bdb6f5280f2fa1774381744d7065b944d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 31 Oct 2024 09:26:21 +0100 Subject: [PATCH 24/75] 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 = [ { From f14bbf068f7b29954bd988574994d06b2eba4cf0 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Oct 2024 06:31:25 +0100 Subject: [PATCH 25/75] 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 26/75] 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 27/75] 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 28/75] 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 29/75] 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 30/75] 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 31/75] 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 32/75] 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 33/75] 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 34/75] 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 35/75] 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 36/75] 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 37/75] 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 38/75] 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 39/75] 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 40/75] 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 41/75] 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 42/75] 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 43/75] 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 44/75] 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 45/75] 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 46/75] 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 47/75] 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 48/75] 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 = [ { From b586fd7e24d18d4b047abb6f14df881b4a9cb097 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 31 Oct 2024 10:03:09 +0100 Subject: [PATCH 49/75] fix singing --- apps/remix-ide/src/app/udapp/run-tab.tsx | 2 +- libs/remix-ui/workspace/src/lib/actions/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/udapp/run-tab.tsx b/apps/remix-ide/src/app/udapp/run-tab.tsx index 983629cb81..8b4467081e 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.tsx +++ b/apps/remix-ide/src/app/udapp/run-tab.tsx @@ -304,7 +304,7 @@ class Provider { if (response.error) { reject(response.error.message) } else { - resolve(response) + resolve(response.result) } }).catch((err) => { if (typeof err === 'string') { diff --git a/libs/remix-ui/workspace/src/lib/actions/index.tsx b/libs/remix-ui/workspace/src/lib/actions/index.tsx index cc66374596..7478ef3aaa 100644 --- a/libs/remix-ui/workspace/src/lib/actions/index.tsx +++ b/libs/remix-ui/workspace/src/lib/actions/index.tsx @@ -530,7 +530,7 @@ export const signTypedData = async (path: string) => { plugin.call('terminal', 'log', { type: 'log', value: `${path} signature using ${settings.selectedAccount} : ${result}` }) } catch (e) { console.error(e) - plugin.call('terminal', 'log', { type: 'error', value: `error while signing ${path}: ${e.message}` }) + plugin.call('terminal', 'log', { type: 'error', value: `error while signing ${path}: ${e.message || e}` }) dispatch(displayPopUp(e.message)) } } From 15ef0aed3fa3be05778e7fd29c14a87c6bbd1116 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 31 Oct 2024 10:18:43 +0100 Subject: [PATCH 50/75] fix tests --- 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 43dc6ae126..27fb314a17 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -69,7 +69,7 @@ const tests = { .switchBrowserTab(0) // back to remix }, - 'Should add a contract file #group1': function (browser: NightwatchBrowser) { + 'Should add a contract file #flaky #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .clickLaunchIcon('filePanel') .addFile('Greet.sol', sources[0]['Greet.sol']) @@ -210,7 +210,7 @@ const tests = { }, // main network tests - 'Should connect to Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { + 'Should connect to Ethereum Main Network using MetaMask #flaky #group2': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) .click('[data-testid="network-display"]') @@ -351,8 +351,8 @@ const tests = { .executeScriptInTerminal('web3.eth.getAccounts()') .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') }, - - 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': function (browser: NightwatchBrowser) { + // EIP 712 tests + 'Test EIP 712 Signature with Injected Provider (Metamask) #flaky #group4': function (browser: NightwatchBrowser) { browser .waitForElementPresent('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]') @@ -376,7 +376,7 @@ const tests = { .maximizeWindow() .hideMetaMaskPopup() .saveScreenshot('./reports/screenshots/metamask_6.png') - .pause() + .pause(1000) .waitForElementPresent('[data-testid="page-container-footer-next"]') .scrollAndClick('button[data-testid="page-container-footer-next"]') // confirm .switchBrowserTab(0) // back to remix @@ -384,7 +384,7 @@ const tests = { }) }) .pause(1000) - .journalChildIncludes('0x8be3a81e17b7e4a40006864a4ff6bfa3fb1e18b292b6f47edec95cd8feaa53275b90f56ca02669d461a297e6bf94ab0ee4b7c89aede3228ed5aedb59c7e007501c') + .journalChildIncludes('0xec72bbabeb47a3a766af449674a45a91a6e94e35ebf0ae3c644b66def7bd387f1c0b34d970c9f4a1e9398535e5860b35e82b2a8931b7c9046b7766a53e66db3d1b') } } From 717836f4d0182288741df8db2ec553e22046eb4d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 08:06:04 +0100 Subject: [PATCH 51/75] cleanup --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 27fb314a17..17bc0ca4c4 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -63,8 +63,6 @@ const tests = { .pause(2000) .waitForElementVisible('*[data-testid="page-container-footer-next"]', 60000) .click('*[data-testid="page-container-footer-next"]') - // .waitForElementVisible('*[data-testid="popover-close"]') - // .click('*[data-testid="popover-close"]') }) .switchBrowserTab(0) // back to remix }, @@ -112,13 +110,9 @@ const tests = { browser .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 .waitForElementVisible({ locateStrategy: 'xpath', @@ -126,7 +120,6 @@ const tests = { }) .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) - .saveScreenshot('./reports/screenshots/metamask_tr3.png') .perform(() => done()) }) }) @@ -136,23 +129,16 @@ const tests = { .clearConsole() .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 .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', @@ -160,7 +146,6 @@ const tests = { }) .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) - .saveScreenshot('./reports/screenshots/metamask_tr6.png') .perform(() => done()) }) }) @@ -175,10 +160,8 @@ const tests = { .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]') .pause(5000) - .saveScreenshot('./reports/screenshots/metamask_7.png') .waitForElementVisible('*[data-id="udappNotifyModalDialogModalBody-react"]', 60000) .click('[data-id="udappNotify-modal-footer-cancel-react"]') - .saveScreenshot('./reports/screenshots/metamask_8.png') .waitForElementVisible({ locateStrategy: 'xpath', selector: "//span[@class='text-log' and contains(., 'errored')]" @@ -264,13 +247,11 @@ const tests = { locateStrategy: 'xpath', selector: "//span[@class='text-log' and contains(., 'pending')]" }) - .saveScreenshot('./reports/screenshots/metamask_before.png') .perform((done) => { browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser .maximizeWindow() .hideMetaMaskPopup() - .saveScreenshot('./reports/screenshots/metamask_4.png') .pause(3000) .waitForElementPresent('[data-testid="page-container-footer-next"]') .scrollAndClick('[data-testid="page-container-footer-next"]') @@ -278,7 +259,6 @@ const tests = { .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()) }) }) @@ -289,7 +269,6 @@ 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) => { @@ -297,11 +276,9 @@ const tests = { .maximizeWindow() .hideMetaMaskPopup() .pause(5000) - .saveScreenshot('./reports/screenshots/metamask_7.png') .waitForElementPresent('[data-testid="page-container-footer-next"]') .scrollAndClick('[data-testid="page-container-footer-next"]') .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) @@ -318,8 +295,6 @@ const tests = { 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) => { @@ -335,10 +310,7 @@ const tests = { .waitForElementVisible('*[data-id="debuggerTransactionInput"]') .setValue('*[data-id="debuggerTransactionInput"]', txhash) // debug tx .pause(2000) - .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()) @@ -375,7 +347,6 @@ const tests = { browser .maximizeWindow() .hideMetaMaskPopup() - .saveScreenshot('./reports/screenshots/metamask_6.png') .pause(1000) .waitForElementPresent('[data-testid="page-container-footer-next"]') .scrollAndClick('button[data-testid="page-container-footer-next"]') // confirm From 03153bc9ed657c17fe3cc0ad9eeff727e6119d68 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 08:18:24 +0100 Subject: [PATCH 52/75] assert --- apps/remix-ide/src/app/udapp/run-tab.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/udapp/run-tab.tsx b/apps/remix-ide/src/app/udapp/run-tab.tsx index 8b4467081e..bc811f8aff 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.tsx +++ b/apps/remix-ide/src/app/udapp/run-tab.tsx @@ -304,7 +304,7 @@ class Provider { if (response.error) { reject(response.error.message) } else { - resolve(response.result) + resolve(response.result? response.result : response) } }).catch((err) => { if (typeof err === 'string') { From b2d8e6020c73178ea45ffeebcfee8f12d521b129 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 08:22:23 +0100 Subject: [PATCH 53/75] config --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cc2943426e..a6c1841a58 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: true + default: false orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 From d944068312dc26784613062bde9d924ecfef175f Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 08:49:15 +0100 Subject: [PATCH 54/75] paralel --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a6c1841a58..f79efe9275 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -640,7 +640,7 @@ jobs: type: string jobsize: type: string - parallelism: 1 + parallelism: 15 steps: - checkout - attach_workspace: From d71bf8b481158f2035cdcd82d62aef4b4dde58f2 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 09:50:13 +0100 Subject: [PATCH 55/75] metamask config --- .circleci/config.yml | 17 +++++++++++++++- apps/remix-ide/ci/browser_test.sh | 2 +- apps/remix-ide/ci/metamask.sh | 33 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100755 apps/remix-ide/ci/metamask.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index f79efe9275..b664f08ba7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -640,7 +640,7 @@ jobs: type: string jobsize: type: string - parallelism: 15 + parallelism: << parameters.parallelism >> steps: - checkout - attach_workspace: @@ -781,6 +781,20 @@ workflows: script: ["flaky.sh"] job: ["nogroup"] jobsize: ["1"] + parallelism: 10 + run_flaky_tests: + jobs: + - build + - remix-ide-browser: + requires: + - build + matrix: + parameters: + browser: ["chrome"] + script: ["metamask.sh"] + job: ["nogroup"] + jobsize: ["1"] + parallelism: 1 build_all: unless: << pipeline.parameters.run_flaky_tests >> jobs: @@ -867,6 +881,7 @@ workflows: script: ["browser_test.sh"] job: ["0","1","2","3","4","5","6","7","8","9"] jobsize: ["10"] + parallelism: 15 - tests-passed: requires: - lint diff --git a/apps/remix-ide/ci/browser_test.sh b/apps/remix-ide/ci/browser_test.sh index 8af369b567..ed1e968109 100755 --- a/apps/remix-ide/ci/browser_test.sh +++ b/apps/remix-ide/ci/browser_test.sh @@ -15,7 +15,7 @@ sleep 5 # grep -IRiL "@disabled" "dist/apps/remix-ide-e2e/src/tests" | grep "\.spec\|\.test" | xargs -I {} basename {} .test.js | grep -E "\b[${2}]" # TESTFILES=$(grep -IRiL "@disabled" "dist/apps/remix-ide-e2e/src/tests" | grep "\.spec\|\.test" | xargs -I {} basename {} .test.js | grep -E "\b[$2]" | circleci tests split --split-by=timings ) node apps/remix-ide/ci/splice_tests.js $2 $3 -TESTFILES=$(node apps/remix-ide/ci/splice_tests.js $2 $3 | circleci tests split --split-by=timings) +TESTFILES=$(node apps/remix-ide/ci/splice_tests.js $2 $3 | grep -v 'metamask' | circleci tests split --split-by=timings) for TESTFILE in $TESTFILES; do npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch-${1}.js dist/apps/remix-ide-e2e/src/tests/${TESTFILE}.js --env=$1 || npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch-${1}.js dist/apps/remix-ide-e2e/src/tests/${TESTFILE}.js --env=$1 || TEST_EXITCODE=1 done diff --git a/apps/remix-ide/ci/metamask.sh b/apps/remix-ide/ci/metamask.sh new file mode 100755 index 0000000000..8e29c876f1 --- /dev/null +++ b/apps/remix-ide/ci/metamask.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -e + +TESTFILES=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "metamask" | sort ) + +# count test files +fileCount=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "metamask" | wc -l ) +# if fileCount is 0 +if [ $fileCount -eq 0 ] +then + echo "No metamask tests found" + exit 0 +fi + +BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}} +echo "$BUILD_ID" +TEST_EXITCODE=0 + +npx ganache & +npx http-server -p 9090 --cors='*' ./node_modules & +yarn run serve:production & +sleep 5 + +for TESTFILE in $TESTFILES; do + npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch-${1}.js $TESTFILE --env=$1 || TEST_EXITCODE=1 +done + +echo "$TEST_EXITCODE" +if [ "$TEST_EXITCODE" -eq 1 ] +then + exit 1 +fi From b4a48606027f18a318e78c31a56d6b265ab03777 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 09:50:59 +0100 Subject: [PATCH 56/75] config --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b664f08ba7..307a2b63e7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -782,7 +782,7 @@ workflows: job: ["nogroup"] jobsize: ["1"] parallelism: 10 - run_flaky_tests: + run_metamask_tests: jobs: - build - remix-ide-browser: From da8e3c4d9af681e208703619f57d4318962ac706 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 09:51:49 +0100 Subject: [PATCH 57/75] config --- .circleci/config.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 307a2b63e7..0c667eeaca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -782,19 +782,6 @@ workflows: job: ["nogroup"] jobsize: ["1"] parallelism: 10 - run_metamask_tests: - jobs: - - build - - remix-ide-browser: - requires: - - build - matrix: - parameters: - browser: ["chrome"] - script: ["metamask.sh"] - job: ["nogroup"] - jobsize: ["1"] - parallelism: 1 build_all: unless: << pipeline.parameters.run_flaky_tests >> jobs: From 319f514b8959a2517c0f91c8d6af56f2c863ce64 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 09:52:59 +0100 Subject: [PATCH 58/75] config --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0c667eeaca..8ca0e6b136 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -640,6 +640,9 @@ jobs: type: string jobsize: type: string + parallelism: + type: integer + default: 1 parallelism: << parameters.parallelism >> steps: - checkout From feb59409d475661839f54a4a5010f9e908222983 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 09:56:13 +0100 Subject: [PATCH 59/75] config --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8ca0e6b136..2e49b2a778 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -784,7 +784,7 @@ workflows: script: ["flaky.sh"] job: ["nogroup"] jobsize: ["1"] - parallelism: 10 + parallelism: [10] build_all: unless: << pipeline.parameters.run_flaky_tests >> jobs: @@ -871,7 +871,7 @@ workflows: script: ["browser_test.sh"] job: ["0","1","2","3","4","5","6","7","8","9"] jobsize: ["10"] - parallelism: 15 + parallelism: [15] - tests-passed: requires: - lint From 146ff2ea7b4d6d960ede648bc108840599ef9aa5 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 10:10:37 +0100 Subject: [PATCH 60/75] config --- .circleci/config.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2e49b2a778..8810bfe7d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -785,6 +785,22 @@ workflows: job: ["nogroup"] jobsize: ["1"] parallelism: [10] + run_metamask_tests: + jobs: + - build + - remix-ide-browser: + requires: + - build + filters: + branches: + only: [/.metamask.*/] + matrix: + parameters: + browser: ["chrome"] + script: ["metamask.sh"] + job: ["nogroup"] + jobsize: ["1"] + parallelism: [1] build_all: unless: << pipeline.parameters.run_flaky_tests >> jobs: From cf4a972022240613cd5e60d23eacc5c6d03827b2 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 10:12:44 +0100 Subject: [PATCH 61/75] config --- .circleci/config.yml | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8810bfe7d2..fb0222fb0c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -785,22 +785,6 @@ workflows: job: ["nogroup"] jobsize: ["1"] parallelism: [10] - run_metamask_tests: - jobs: - - build - - remix-ide-browser: - requires: - - build - filters: - branches: - only: [/.metamask.*/] - matrix: - parameters: - browser: ["chrome"] - script: ["metamask.sh"] - job: ["nogroup"] - jobsize: ["1"] - parallelism: [1] build_all: unless: << pipeline.parameters.run_flaky_tests >> jobs: @@ -888,6 +872,16 @@ workflows: job: ["0","1","2","3","4","5","6","7","8","9"] jobsize: ["10"] parallelism: [15] + - remix-ide-browser: + requires: + - build + matrix: + parameters: + browser: ["chrome"] + script: ["metamask.sh"] + job: ["0","1","2","3","4","5","6","7","8","9"] + jobsize: ["10"] + parallelism: [1] - tests-passed: requires: - lint From f4680b7ea12b723a9daa4afa31d643a54c7e5bdd Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 10:15:07 +0100 Subject: [PATCH 62/75] name --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fb0222fb0c..21ffec0735 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -873,13 +873,14 @@ workflows: jobsize: ["10"] parallelism: [15] - remix-ide-browser: + name: remix-ide-browser-chrome-metamask requires: - build matrix: parameters: browser: ["chrome"] script: ["metamask.sh"] - job: ["0","1","2","3","4","5","6","7","8","9"] + job: ["0"] jobsize: ["10"] parallelism: [1] - tests-passed: From bcfc5b67ee661f969710567b9d32ce2b177c166d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 10:15:47 +0100 Subject: [PATCH 63/75] config --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 21ffec0735..050c1f9007 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -863,6 +863,7 @@ workflows: parallelism: 1 - remix-ide-browser: + name: remix-ide-browser-chrome-firefox requires: - build matrix: From e202f56376edd7b6a002c3146fc37cbf27b5c2ea Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 10:16:25 +0100 Subject: [PATCH 64/75] config --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 050c1f9007..02a4f45a7a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -863,7 +863,7 @@ workflows: parallelism: 1 - remix-ide-browser: - name: remix-ide-browser-chrome-firefox + alias: remix-ide-browser-tests requires: - build matrix: @@ -874,7 +874,7 @@ workflows: jobsize: ["10"] parallelism: [15] - remix-ide-browser: - name: remix-ide-browser-chrome-metamask + alias: metamask requires: - build matrix: From db14d92336adfb829da71ea71e88a056317e1f71 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 10:17:11 +0100 Subject: [PATCH 65/75] config --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 02a4f45a7a..a50cdb8751 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -863,10 +863,11 @@ workflows: parallelism: 1 - remix-ide-browser: - alias: remix-ide-browser-tests + requires: - build matrix: + alias: browser-tests parameters: browser: ["chrome", "firefox"] script: ["browser_test.sh"] @@ -874,10 +875,11 @@ workflows: jobsize: ["10"] parallelism: [15] - remix-ide-browser: - alias: metamask + requires: - build matrix: + alias: metamask parameters: browser: ["chrome"] script: ["metamask.sh"] From bb0fb3c496fcd602577573ed438bd40050f0159f Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 10:18:53 +0100 Subject: [PATCH 66/75] config --- .circleci/config.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a50cdb8751..620ba29fbf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -890,7 +890,9 @@ workflows: requires: - lint - remix-libs - - remix-ide-browser + - browser-tests + - metamask + - metamask - plugins - predeploy: @@ -903,7 +905,8 @@ workflows: requires: - lint - remix-libs - - remix-ide-browser + - browser-tests + - metamask - plugins - predeploy filters: @@ -915,7 +918,8 @@ workflows: requires: - lint - remix-libs - - remix-ide-browser + - browser-tests + - metamask - plugins - predeploy filters: @@ -927,7 +931,8 @@ workflows: requires: - lint - remix-libs - - remix-ide-browser + - browser-tests + - metamask - plugins - predeploy filters: From 4560f68aa9e5c57556cdf1459db2fba53a64ac0c Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 10:32:32 +0100 Subject: [PATCH 67/75] undo flaky --- 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 17bc0ca4c4..f65841dde3 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -67,7 +67,7 @@ const tests = { .switchBrowserTab(0) // back to remix }, - 'Should add a contract file #flaky #group1': function (browser: NightwatchBrowser) { + 'Should add a contract file #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .clickLaunchIcon('filePanel') .addFile('Greet.sol', sources[0]['Greet.sol']) @@ -193,7 +193,7 @@ const tests = { }, // main network tests - 'Should connect to Ethereum Main Network using MetaMask #flaky #group2': function (browser: NightwatchBrowser) { + 'Should connect to Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) .click('[data-testid="network-display"]') @@ -324,7 +324,7 @@ const tests = { .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') }, // EIP 712 tests - 'Test EIP 712 Signature with Injected Provider (Metamask) #flaky #group4': function (browser: NightwatchBrowser) { + 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': function (browser: NightwatchBrowser) { browser .waitForElementPresent('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]') From 73fd4ccb020754d6d0c330cc4192d4b4769a544e Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 10:48:48 +0100 Subject: [PATCH 68/75] filters --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 620ba29fbf..80390cfae9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -863,7 +863,6 @@ workflows: parallelism: 1 - remix-ide-browser: - requires: - build matrix: @@ -875,7 +874,6 @@ workflows: jobsize: ["10"] parallelism: [15] - remix-ide-browser: - requires: - build matrix: @@ -886,13 +884,15 @@ workflows: job: ["0"] jobsize: ["10"] parallelism: [1] + filters: + branches: + only: [/.*metamask.*/, 'master', 'remix_live', 'remix_beta'] - tests-passed: requires: - lint - remix-libs - browser-tests - metamask - - metamask - plugins - predeploy: From db6cd6677ee1c2e9772fade443d6a50a58e87f2a Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 11:06:26 +0100 Subject: [PATCH 69/75] tesst grouped --- .circleci/config.yml | 4 ++-- apps/remix-ide-e2e/src/tests/metamask.test.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 80390cfae9..6a1c47cb6c 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 @@ -784,7 +784,7 @@ workflows: script: ["flaky.sh"] job: ["nogroup"] jobsize: ["1"] - parallelism: [10] + parallelism: [1] build_all: unless: << pipeline.parameters.run_flaky_tests >> jobs: diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index f65841dde3..117256ee6a 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -67,7 +67,7 @@ const tests = { .switchBrowserTab(0) // back to remix }, - 'Should add a contract file #group1': function (browser: NightwatchBrowser) { + 'Should add a contract file #flaky #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .clickLaunchIcon('filePanel') .addFile('Greet.sol', sources[0]['Greet.sol']) @@ -193,7 +193,7 @@ const tests = { }, // main network tests - 'Should connect to Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { + 'Should connect to Ethereum Main Network using MetaMask #group1': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) .click('[data-testid="network-display"]') @@ -208,7 +208,7 @@ const tests = { .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network') }, - 'Should deploy contract on Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { + 'Should deploy contract on Ethereum Main Network using MetaMask #group1': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') .clickLaunchIcon('filePanel') .addFile('Greet.sol', sources[0]['Greet.sol']) From 15eec751eec605ee9e050d90909d4cad32e1f9f2 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 11:10:13 +0100 Subject: [PATCH 70/75] one group --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 117256ee6a..da2f33da7c 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -222,7 +222,7 @@ const tests = { .modalFooterCancelClick('udappNotify') }, // debug transaction - 'Should deploy Ballot to Sepolia using metamask #group3 #flaky': function (browser: NightwatchBrowser) { + 'Should deploy Ballot to Sepolia using metamask #group1 #flaky': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) .click('[data-testid="network-display"]') @@ -264,7 +264,7 @@ const tests = { }) }, - 'do transaction #group3': function (browser: NightwatchBrowser) { + 'do transaction #group1': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .clearConsole() .clickInstance(0) @@ -291,7 +291,7 @@ const tests = { '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 #group1': function (browser: NightwatchBrowser) { let txhash browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('pluginManager') // load debugger and source verification @@ -317,14 +317,14 @@ const tests = { }) }, - 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group3': function (browser: NightwatchBrowser) { + 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser .executeScriptInTerminal('web3.eth.getAccounts()') .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') }, // EIP 712 tests - 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': function (browser: NightwatchBrowser) { + 'Test EIP 712 Signature with Injected Provider (Metamask) #group1': function (browser: NightwatchBrowser) { browser .waitForElementPresent('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]') From 82384864fbdbd76ce56678949c6a52dbc5126433 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 11:32:53 +0100 Subject: [PATCH 71/75] eip712 --- 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 da2f33da7c..e9810ba81c 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -326,6 +326,7 @@ const tests = { // EIP 712 tests 'Test EIP 712 Signature with Injected Provider (Metamask) #group1': function (browser: NightwatchBrowser) { browser + .clickLaunchIcon('udapp') .waitForElementPresent('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]') .waitForElementVisible('*[data-id="signMessageTextarea"]', 120000) From b5c5d467d4241822866c92acdb7b69b15d5dab3d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 12:18:39 +0100 Subject: [PATCH 72/75] one group --- .circleci/config.yml | 2 +- apps/remix-ide-e2e/src/tests/matomo.test.ts | 2 +- apps/remix-ide-e2e/src/tests/metamask.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a1c47cb6c..ccac4dab7b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: true + default: false orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 diff --git a/apps/remix-ide-e2e/src/tests/matomo.test.ts b/apps/remix-ide-e2e/src/tests/matomo.test.ts index 85369366bc..74db9e8253 100644 --- a/apps/remix-ide-e2e/src/tests/matomo.test.ts +++ b/apps/remix-ide-e2e/src/tests/matomo.test.ts @@ -433,7 +433,7 @@ module.exports = { .click('[data-id="matomoModal-modal-footer-cancel-react"]') // cancel .waitForElementNotVisible('*[data-id="matomoModalModalDialogModalBody-react"]') }, - 'verify Matomo events are tracked on app start #group4 #lfaky': function (browser: NightwatchBrowser) { + 'verify Matomo events are tracked on app start #group4': function (browser: NightwatchBrowser) { browser .execute(function () { return (window as any)._paq diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index e9810ba81c..c6911a017a 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -67,7 +67,7 @@ const tests = { .switchBrowserTab(0) // back to remix }, - 'Should add a contract file #flaky #group1': function (browser: NightwatchBrowser) { + 'Should add a contract file #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .clickLaunchIcon('filePanel') .addFile('Greet.sol', sources[0]['Greet.sol']) From c318d8982cb8fd369078166ea111847bd15ea687 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 12:39:30 +0100 Subject: [PATCH 73/75] hide popup --- .../src/commands/hideMetaMaskPopup.ts | 35 ++++++++---------- .../src/commands/setupMetamask.ts | 37 +++++++++---------- 2 files changed, 34 insertions(+), 38 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts b/apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts index 16aaa69962..101ce2b324 100644 --- a/apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts +++ b/apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts @@ -4,25 +4,22 @@ import EventEmitter from 'events' class HideMetaMaskPopup extends EventEmitter { command(this: NightwatchBrowser) { browser - .pause(5000) - .isPresent({ - selector: 'button[data-testid="popover-close"]', - locateStrategy: 'css selector', - suppressNotFoundErrors: true, - timeout: 2000 - }, (okVisible) => { - console.log('okVisible', okVisible) - if (!okVisible.value) { - console.log('popover not found') - } else { - console.log('popover found... closing') - browser.click('button[data-testid="popover-close"]') - } - }) - .waitForElementNotPresent({ - selector: 'button[data-testid="popover-close"]', - locateStrategy: 'css selector', - timeout: 2000 + .perform((done) => { + browser.execute(function () { + function addStyle(styleString) { + const style = document.createElement('style') + style.textContent = styleString + document.head.append(style) + } + addStyle(` + #popover-content { + display:none !important + } + .popover-container { + display:none !important; + } + `) + }, [], done()) }) .perform((done) => { done() diff --git a/apps/remix-ide-e2e/src/commands/setupMetamask.ts b/apps/remix-ide-e2e/src/commands/setupMetamask.ts index 585473827c..113f49516c 100644 --- a/apps/remix-ide-e2e/src/commands/setupMetamask.ts +++ b/apps/remix-ide-e2e/src/commands/setupMetamask.ts @@ -50,26 +50,25 @@ function setupMetaMask(browser: NightwatchBrowser, passphrase: string, password: .click('button[data-testid="pin-extension-next"]') .waitForElementVisible('button[data-testid="pin-extension-done"]') .click('button[data-testid="pin-extension-done"]') - .pause(5000) - .isVisible({ - selector: 'button[data-testid="popover-close"]', - locateStrategy: 'css selector', - suppressNotFoundErrors: true, - timeout: 3000 - }, (okVisible) => { - console.log('okVisible', okVisible) - if (!okVisible.value) { - console.log('popover not found') - } else { - console.log('popover found... closing') - browser.click('button[data-testid="popover-close"]') - } - }) - .waitForElementNotPresent({ - selector: 'button[data-testid="popover-close"]', - locateStrategy: 'css selector', - timeout: 3000 + .perform((done) => { + browser.execute(function () { + function addStyle(styleString) { + const style = document.createElement('style') + style.textContent = styleString + document.head.append(style) + } + addStyle(` + #popover-content { + display:none !important + } + .popover-container { + display:none !important; + } + `) + }, [], done()) }) + .pause() + .saveScreenshot('./reports/screenshots/metamask.png') .click('[data-testid="network-display"]') .click('.mm-modal-content label.toggle-button--off') // show test networks From 6887ae040a1824b486074e15890f71376f5fc772 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 12:41:06 +0100 Subject: [PATCH 74/75] rm pause --- apps/remix-ide-e2e/src/commands/setupMetamask.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/commands/setupMetamask.ts b/apps/remix-ide-e2e/src/commands/setupMetamask.ts index 113f49516c..6aef24dab1 100644 --- a/apps/remix-ide-e2e/src/commands/setupMetamask.ts +++ b/apps/remix-ide-e2e/src/commands/setupMetamask.ts @@ -67,7 +67,6 @@ function setupMetaMask(browser: NightwatchBrowser, passphrase: string, password: `) }, [], done()) }) - .pause() .saveScreenshot('./reports/screenshots/metamask.png') .click('[data-testid="network-display"]') From 28c58bfef138eb5fd4cfb977f45027feae581acf Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 12:58:43 +0100 Subject: [PATCH 75/75] just one group --- 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 c6911a017a..0da38cadaa 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 #group4 #group3 #group2 #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) .useCss().switchBrowserTab(0)