pull/5358/head
bunsenstraat 3 weeks ago
parent b5c5d467d4
commit c318d8982c
  1. 33
      apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts
  2. 35
      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)
if (!okVisible.value) {
console.log('popover not found')
} else {
console.log('popover found... closing')
browser.click('button[data-testid="popover-close"]')
} }
}) addStyle(`
.waitForElementNotPresent({ #popover-content {
selector: 'button[data-testid="popover-close"]', display:none !important
locateStrategy: 'css selector', }
timeout: 2000 .popover-container {
display:none !important;
}
`)
}, [], done())
}) })
.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)
if (!okVisible.value) {
console.log('popover not found')
} else {
console.log('popover found... closing')
browser.click('button[data-testid="popover-close"]')
} }
addStyle(`
#popover-content {
display:none !important
}
.popover-container {
display:none !important;
}
`)
}, [], done())
}) })
.waitForElementNotPresent({ .pause()
selector: 'button[data-testid="popover-close"]',
locateStrategy: 'css selector',
timeout: 3000
})
.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