diff --git a/apps/remix-ide-e2e/src/commands/setupMetamask.ts b/apps/remix-ide-e2e/src/commands/setupMetamask.ts index 59a01751dd..afabe2ad95 100644 --- a/apps/remix-ide-e2e/src/commands/setupMetamask.ts +++ b/apps/remix-ide-e2e/src/commands/setupMetamask.ts @@ -17,15 +17,14 @@ class MetaMask extends EventEmitter { function setupMetaMask (browser: NightwatchBrowser, passphrase: string, password: string, done: VoidFunction) { const words = passphrase.split(' ') browser - .perform((done) => { - browser.switchBrowserWindow('chrome-extension://mmejnnbljapjihcidiglpfkpnojpiamk/home.html', 'MetaMask', (browser) => { - browser.perform(() => done()) - }) - }) + .switchBrowserTab(1) .waitForElementVisible('input[data-testid="onboarding-terms-checkbox"]') .click('input[data-testid="onboarding-terms-checkbox"]') - .click('button[data-testid="onboarding-import-wallet"]') + .waitForElementVisible('button[data-testid="onboarding-import-wallet"]') + .click('button[data-testid="onboarding-import-wallet"]') + .waitForElementVisible('button[data-testid="metametrics-i-agree"]') .click('button[data-testid="metametrics-i-agree"]') + .waitForElementVisible('input[data-testid="import-srp__srp-word-0"]') .setValue('input[data-testid="import-srp__srp-word-0"]', words[0]) // import account .setValue('input[data-testid="import-srp__srp-word-1"]', words[1]) // import account .setValue('input[data-testid="import-srp__srp-word-2"]', words[2]) // import account @@ -39,13 +38,18 @@ function setupMetaMask (browser: NightwatchBrowser, passphrase: string, password .setValue('input[data-testid="import-srp__srp-word-10"]', words[10]) // import account .setValue('input[data-testid="import-srp__srp-word-11"]', words[11]) // import account .click('button[data-testid="import-srp-confirm"]') + .waitForElementVisible('input[data-testid="create-password-new"]') .setValue('input[data-testid="create-password-new"]', password) .setValue('input[data-testid="create-password-confirm"]', password) .click('input[data-testid="create-password-terms"]') .click('button[data-testid="create-password-import"]') + .waitForElementVisible('button[data-testid="onboarding-complete-done"]') .click('button[data-testid="onboarding-complete-done"]') + .waitForElementVisible('button[data-testid="pin-extension-next"]') .click('button[data-testid="pin-extension-next"]') + .waitForElementVisible('button[data-testid="pin-extension-done"]') .click('button[data-testid="pin-extension-done"]') + .waitForElementVisible('button[data-testid="popover-close"]') .click('button[data-testid="popover-close"]') .pause(1000) .click('[data-testid="network-display"]') diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index d5e1ad8642..a1e6f96bb5 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -5,6 +5,10 @@ import init from '../helpers/init' const passphrase = 'explain uniform adapt basic blue onion rebel pull rice erase volcano couple' const password = 'remix_is_cool' +const checkBrowserIsChrome = function (browser: NightwatchBrowser) { + return browser.browserName.indexOf('chrome') > -1 +} + module.exports = { '@disabled': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -16,6 +20,7 @@ module.exports = { }, 'Should connect to Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) .useCss().switchBrowserTab(0) @@ -29,14 +34,19 @@ module.exports = { .pause(5000) .switchBrowserWindow('chrome-extension://mmejnnbljapjihcidiglpfkpnojpiamk/home.html', 'MetaMask', (browser) => { browser + .waitForElementVisible('*[data-testid="page-container-footer-next"]') .click('*[data-testid="page-container-footer-next"]') // this connects the metamask account to remix + .pause(2000) + .waitForElementVisible('*[data-testid="page-container-footer-next"]') .click('*[data-testid="page-container-footer-next"]') - .click('*[data-testid="popover-close"]') + // .waitForElementVisible('*[data-testid="popover-close"]') + // .click('*[data-testid="popover-close"]') }) .switchBrowserTab(0) // back to remix }, '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']) @@ -45,7 +55,8 @@ module.exports = { }, 'Should deploy contract on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { - browser.clearConsole().waitForElementPresent('*[data-id="runTabSelectAccount"] option') + if (!checkBrowserIsChrome(browser)) return + browser.clearConsole().waitForElementPresent('*[data-id="runTabSelectAccount"] option', 45000) .clickLaunchIcon('filePanel') .openFile('Greet.sol') .clickLaunchIcon('udapp') @@ -66,6 +77,7 @@ module.exports = { }, '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"]') @@ -84,6 +96,7 @@ module.exports = { }, 'Should connect to Ethereum Main Network using MetaMask #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) .click('[data-testid="network-display"]') @@ -99,16 +112,17 @@ module.exports = { }, 'Should deploy contract on Ethereum Main Network using MetaMask #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') .clickLaunchIcon('filePanel') .openFile('Greet.sol') .clickLaunchIcon('udapp') .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]') - .waitForElementPresent('*[data-id="modalDialogContainer"]', 15000) + .waitForElementVisible('*[data-id="udappNotifyModalDialogModalBody-react"]', 65000) .modalFooterOKClick('udappNotify') .pause(10000) - .assert.containsText('*[data-id="modalDialogModalBody"]', 'You are about to create a transaction on Main Network. Confirm the details to send the info to your provider.') + .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') }, @@ -120,7 +134,12 @@ module.exports = { * */ 'Should debug Sepolia transaction with source highlighting using the source verifier service and MetaMask #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') + .switchBrowserTab(1) + .click('[data-testid="network-display"]') + .click('div[data-testid="Sepolia"]') // switch to sepolia + .useCss().switchBrowserTab(0) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('pluginManager') // load debugger and source verification // .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_sourcify"] button') @@ -138,6 +157,7 @@ module.exports = { }, 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return browser .executeScriptInTerminal('web3.eth.getAccounts()') .journalLastChildIncludes('[ "0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f" ]')