From c318d8982cb8fd369078166ea111847bd15ea687 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 1 Nov 2024 12:39:30 +0100 Subject: [PATCH] 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