synpress
synpress copied to clipboard
[๐ Bug]: `cy.importMetamaskAccount()` timeout on duplicate account
๐ Have you searched existing issues to avoid duplicates?
- [X] I have made sure that my issue is not a duplicate.
๐งช Have you tested your code using latest version of Synpress?
- [X] I have made sure that my issue still exists on latest version of Synpress.
๐ก Are you able to provide enough information to be able to reproduce your issue locally?
- [X] 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:
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
Also experiencing this. Did you ever find a workaround @MichalLytek?