pull/5358/head
bunsenstraat 3 weeks ago
parent b5c5d467d4
commit c318d8982c
  1. 35
      apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts
  2. 37
      apps/remix-ide-e2e/src/commands/setupMetamask.ts

@ -4,25 +4,22 @@ import EventEmitter from 'events'
class HideMetaMaskPopup extends EventEmitter { class HideMetaMaskPopup extends EventEmitter {
command(this: NightwatchBrowser) { command(this: NightwatchBrowser) {
browser browser
.pause(5000) .perform((done) => {
.isPresent({ browser.execute(function () {
selector: 'button[data-testid="popover-close"]', function addStyle(styleString) {
locateStrategy: 'css selector', const style = document.createElement('style')
suppressNotFoundErrors: true, style.textContent = styleString
timeout: 2000 document.head.append(style)
}, (okVisible) => { }
console.log('okVisible', okVisible) addStyle(`
if (!okVisible.value) { #popover-content {
console.log('popover not found') display:none !important
} else { }
console.log('popover found... closing') .popover-container {
browser.click('button[data-testid="popover-close"]') display:none !important;
} }
}) `)
.waitForElementNotPresent({ }, [], done())
selector: 'button[data-testid="popover-close"]',
locateStrategy: 'css selector',
timeout: 2000
}) })
.perform((done) => { .perform((done) => {
done() done()

@ -50,26 +50,25 @@ function setupMetaMask(browser: NightwatchBrowser, passphrase: string, password:
.click('button[data-testid="pin-extension-next"]') .click('button[data-testid="pin-extension-next"]')
.waitForElementVisible('button[data-testid="pin-extension-done"]') .waitForElementVisible('button[data-testid="pin-extension-done"]')
.click('button[data-testid="pin-extension-done"]') .click('button[data-testid="pin-extension-done"]')
.pause(5000) .perform((done) => {
.isVisible({ browser.execute(function () {
selector: 'button[data-testid="popover-close"]', function addStyle(styleString) {
locateStrategy: 'css selector', const style = document.createElement('style')
suppressNotFoundErrors: true, style.textContent = styleString
timeout: 3000 document.head.append(style)
}, (okVisible) => { }
console.log('okVisible', okVisible) addStyle(`
if (!okVisible.value) { #popover-content {
console.log('popover not found') display:none !important
} else { }
console.log('popover found... closing') .popover-container {
browser.click('button[data-testid="popover-close"]') display:none !important;
} }
}) `)
.waitForElementNotPresent({ }, [], done())
selector: 'button[data-testid="popover-close"]',
locateStrategy: 'css selector',
timeout: 3000
}) })
.pause()
.saveScreenshot('./reports/screenshots/metamask.png') .saveScreenshot('./reports/screenshots/metamask.png')
.click('[data-testid="network-display"]') .click('[data-testid="network-display"]')
.click('.mm-modal-content label.toggle-button--off') // show test networks .click('.mm-modal-content label.toggle-button--off') // show test networks

Loading…
Cancel
Save