Open LsilvaPorto opened 9 months ago
Hey! How often does this happen? I'm 99% sure that this is due to MetaMask waiting for a response from the RPC ๐ค
Related to https://github.com/Synthetixio/synpress/issues/411
The error in this case is:
CypressError: `cy.task('confirmMetamaskTransaction')` failed with the following error:
> [switchToMetamaskNotification] Max amount of retries to switch to metamask notification window has been reached. It was never found.
https://on.cypress.io/api/task
at <unknown> (https://localhost:3001/__cypress/runner/cypress_runner.js:151389:78)
at tryCatcher (https://localhost:3001/__cypress/runner/cypress_runner.js:18744:23)
at Promise._settlePromiseFromHandler (https://localhost:3001/__cypress/runner/cypress_runner.js:16679:31)
at Promise._settlePromise (https://localhost:3001/__cypress/runner/cypress_runner.js:16736:18)
at Promise._settlePromise0 (https://localhost:3001/__cypress/runner/cypress_runner.js:16781:10)
at Promise._settlePromises (https://localhost:3001/__cypress/runner/cypress_runner.js:16857:18)
at _drainQueueStep (https://localhost:3001/__cypress/runner/cypress_runner.js:13451:12)
at _drainQueue (https://localhost:3001/__cypress/runner/cypress_runner.js:13444:9)
at ../../node_modules/bluebird/js/release/async.js.Async._drainQueues (https://localhost:3001/__cypress/runner/cypress_runner.js:13460:5)
at Async.drainQueues (https://localhost:3001/__cypress/runner/cypress_runner.js:13330:14)
Haven't tested it myself yet. Agree that this is related to #411, but how is that error you just showcased linked to all of this @louis-md? The problem in question is about the spinner and not notification window not appearing. I'm asking out of curiosity cause at this point you'll have better knowledge than I do on this topic ๐ค
I still believe this is, unfortunately, related to how on rare occasions MetaMask hangs while waiting for an RPC response. I've had it happen to me a few times while writing the new version of Synpress, but not during confirming transactions but rather at the beginning of the onboarding process to MetaMask.
After spending some time on this I think I went on the bottom of it. The command cy.confirmMetamaskTransaction
ends with waiting for a close()
event (the metamask window closing after confirming the transaction). However in the case where there are a set of multiple transactions, after one transaction is confirmed, the window does not close, instead it moves to the next transaction.
To make it work using multiple transactions, I used patch-package
to comment out this line:
This is a dirty fix, hopefully this could be solved in future versions by passing an option to cy.confirmMetamaskTransaction
.
@duckception, the error I mentioned actually originated from my code, once fixed I had the same error than originally mentioned by @LsilvaPorto.
Hope it helps!
Hey! How often does this happen? I'm 99% sure that this is due to MetaMask waiting for a response from the RPC ๐ค
a lot, every time I need to call this method more than twice consecutively, that happens
๐ Have you searched existing issues to avoid duplicates?
๐งช 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?
Synpress version
3.7.2-beta.9
Node.js version
18.18.2
Operating system
MacOS Sonoma 14.2 (23C64)
Run mode
Synpress (standalone)
CI platform (if applicable)
No response
Are you running your tests inside docker? (if applicable)
What happened?
When I'm trying to confirm a transaction with synpress, a spin appears in metamask window, it doesn't close and test fails, it happens intermittently, but always with the method cy.confirmMetamaskTransaction()
What is your expected behavior?
Metamask window close after transaction
How to reproduce the bug.
open a page connect metamask accept 3 transactions one after other
Relevant log output