synpress icon indicating copy to clipboard operation
synpress copied to clipboard

`changeMetamaskNetwork` should silently skip switching to current network

Open fionnachan opened this issue 1 year ago • 1 comments

Describe the bug A clear and concise description of what the bug is. When metamask is already on a certain network (e.g. Sepolia), and cy.changeMetamaskNetwork('Sepolia test network') is called again, it throws an error

To Reproduce Steps to reproduce the behavior:

  1. cy.acceptMetamaskAccess()
  2. cy.changeMetamaskNetwork('Sepolia test network')
  3. cy.changeMetamaskNetwork('Sepolia test network')

Expected behavior A clear and concise description of what you expected to happen. changeMetamaskNetwork should silently skip attempting to switch to the same network

Screenshots If applicable, add screenshots to help explain your problem. Switch Networks -- User is on test network L1 -- Test Networks list in Wrong Network UI -- should show wrong network UI (failed) (attempt 2)

CypressError
cy.task('changeMetamaskNetwork') failed with the following error:



> locator.click: Error: strict mode violation: locator('text=sepolia test network') resolved to 2 elements:

    1) <span class="box box--margin-top-1 box--margin-bottom-…>Sepolia test network</span> aka getByTestId('network-display')

    2) <span class="network-name-item" data-testid="sepolia-n…>Sepolia test network</span> aka getByTestId('sepolia-network-item')



=========================== logs ===========================

waiting for locator('text=sepolia test network')

============================================================



https://on.cypress.io/api/task

Desktop (please complete the following information):

  • OS: macOS Monterey
  • Synpress version: 3.5.1
  • CI platform (if applicable): locally

fionnachan avatar Apr 14 '23 11:04 fionnachan

Thanks for submitting this issue @fionnachan!

This issue is finally merged, and you can take a look at the fix here #737, and help in the review! feel free to test it!

Note: this issue will be closed once the PR is merged and the fix is confirmed

neuodev avatar Apr 29 '23 18:04 neuodev