Synthetixio / synpress

Synpress is e2e testing framework based on Cypress.io and playwright with support for metamask.

Home Page:https://synpress.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After adding new network and switching to it metamask shows additional message which prevents further interactions

domalaq opened this issue · comments

So I call a method cy.allowMetamaskToAddAndSwitchNetwork(); which does its job well and network is added and switched. But Metamask shows a modal message with title "You have switched to BNB (for example). Things to keep in mind ..." and button "Got it". And this message is not dismissed. And further operation like cy.disconnectMetamaskWalletFromDapp(); can not be successfully executed.

Expected behavior
Modal message should be closed.

Screenshots
image

Desktop (please complete the following information):

  • OS: Pop_OS! 22.04
  • Synpress version: 3.7.0
  • CI platform (if applicable): local testing

Also if someone can suggest a workaround would be much appreciated.

Hey @domalaq please share the way you are calling the cy.allowMetamaskToAddAndSwitchNetwork() method so I can reproduce it and see if can share a solution.

Hey @domalaq please share the way you are calling the cy.allowMetamaskToAddAndSwitchNetwork() method so I can reproduce it and see if can share a solution.

I got it, was able to reproduce, looking at a possible solution.

@domalaq I have pushed a possible solution to the issue:

#763

synthetixio/synpress#55237a0c06895bf996db90723aa429213ad3fcfe

heya @juantor16

Your fix works! I'll use it until it gets accepted.

Thank you very much!

Ok I found that usual allowNetworkToSwitch() is broken now. It tries to find additional popup but fails. I think there should be some condition like if there is additional popup then close otherwise proceed.

Ok I found that usual allowNetworkToSwitch() is broken now. It tries to find additional popup but fails. I think there should be some condition like if there is additional popup then close otherwise proceed.

yeah makes sense, will push the new version today.

Your new changes didn't work. I looked at your code and tried this snippet locally which worked:

    if ((await playwright
        .metamaskWindow()
        .locator(recipientPopupElements.popupCloseButton)
        .count()) > 0) {
      await playwright.waitAndClick(
        recipientPopupElements.popupCloseButton,
      )
    }

Also I think GotItButton is not needed to be declared. You don't use it anyway.
Looking forward to your working code! Thanks for contributing on this.

Hey @domalaq @juantor16, the version with the fix for this is available under @synthetixio/synpress@3.7.2-beta.4!