Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: cy.importMetamaskAccount() timeout on duplicate account #898

Open
3 of 4 tasks
MichalLytek opened this issue Oct 3, 2023 · 1 comment
Open
3 of 4 tasks
Labels
bug 🐛 Something isn't working needs triaging ⏳

Comments

@MichalLytek
Copy link

🔎 Have you searched existing issues to avoid duplicates?

  • I have made sure that my issue is not a duplicate.

🧪 Have you tested your code using latest version of Synpress?

💡 Are you able to provide enough information to be able to reproduce your issue locally?

  • I can provide enough details to reproduce my issue on local environment.

Synpress version

3.7.2-beta.7

Node.js version

18.18.0

Operating system

Ubuntu 20.04

Run mode

Cypress + Synpress (as plugin)

CI platform (if applicable)

No response

Are you running your tests inside docker? (if applicable)

  • This issue could be related to docker.

What happened?

When I run my test suite for the first time, the cy.importMetamaskAccount() command works fine.

When I re-run the test, the cy.importMetamaskAccount() command hangs and cause cypress timeout:

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



> page.waitForNavigation: Timeout 30000ms exceeded.

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

waiting for navigation until "load"

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

If I check the metamask extension window, it stucks on the duplicate account error:

image

It's caused by the fact that the metamask extension has a shared state between the test runs. Even cypress/browser restart does not change it, only manually removing the extension from the chrome browser.

What is your expected behavior?

The command should check if the error is displayed, then click cancel and return false from the command.

This way we can detect that the account was already imported and we can do cy.switchMetamaskAccount() to activate the account on which behalf we want to operate in our dApp.

How to reproduce the bug.

const walletKey = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';

describe('bug reproduction', () => {
  it('crashes on subsequent `importMetamaskAccount` calls', () => {
    cy.importMetamaskAccount(walletKey);
  });
});

Relevant log output

No response

@MichalLytek MichalLytek added bug 🐛 Something isn't working needs triaging ⏳ labels Oct 3, 2023
@mliu
Copy link

mliu commented Apr 25, 2024

Also experiencing this. Did you ever find a workaround @MichalLytek?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working needs triaging ⏳
Projects
None yet
Development

No branches or pull requests

2 participants