synpress: confirmMetamaskTransaction function fails with the default metamask version 9.7.1
Thanks for the great work on Synpress, this library looks awesome. Anyway I am struggling with something when I try to confirm transactions.
Steps to reproduce: Leave env variable for metamask version blank (use the hardcoded version 9.7.1) Execute: synpress run Metamask is being initialized The chosen address is visited The user wallet is connected to the dApp Button leading to transaction which needs confirmation from metamask is pressed.
Once needed to confirm metamask transaction, it is failed(screenshot attached)
Note: Debugged the library and found where the confirmation is failing
cy.confirmMetamaskTransaction is calling -> confirmTransaction in ./commands/metamask.js
which is calling:
await puppeteer.waitClearAndType( newGasFee, confirmPageElements.gasFeeInput, notificationPage, );
- all the params passed to waitClearAndType defined.
The function waitClearAndType is failing on the step:
await input.click({ clickCount: 3 });
Where ‘input’ is defined.
I tried to replace waitClearAndType
with waitAndType
when called from confirmTransaction
and the transaction is passed successfully ( but the gas fee paid for the transaction is not right of course)
Other workaround I tried is to skip the calling of waitClearAndType
it is working as well, but there is possibility for the transaction not to be mined if the gas fee increased from the moment we triggered the transaction.
Also if some of the latest versions of Metamask is used(tried with 10.2.2), confirmMetamaskTransaction
is failing as well as in the last versions of Metamask, the confirmation page has no input field for the gas fee at all and it seems that the gas fee is recalculated by Metamask automatically. For these versions of metamask we could skip the steps for manually getting and setting the gas fee.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 21 (9 by maintainers)
@drptbl Thanks for the fast response. Using version 0.9.25-beta.26 I am still experiencing the same issue. I am applying a screenshot with part of the latest fix you provided
await puppeteer.metamaskWindow().waitForTimeout(1000);
just to be sure I applied the last changes.@DimitarTAtanasov @RAMTO @ochikov thanks for reports guys. I will take a look in to this asap (today).
Cheers, Jakub.
@drptbl seems to be working with 0.9.25-beta.30 with
waitAndSetValue
. I think you are right, It seems this could be puppeter related issue. Thanks for the help @drptbl really appreciate it. I think we could close this issue. If you find time to include the changes forchangeMetamaskNetwork
in some of the next releases I will be extremely grateful.Thanks again and have a nice evening 😃
Thanks for everything @DimitarTAtanasov, gonna dig in to this today, hopefully will have some solution until tonight.
@drptbl Can you give us a hand once again? Thank you in advance.
@DimitarTAtanasov @RAMTO @ochikov this issue should be fixed now. Please use:
@synthetixio/synpress@0.9.25-beta.26
and let me know if it works for you now.It was a quick fix, I will come up with something better until end of the week, but it should be still fine for now.
I’m going to work on Metamask 10+ support in upcoming week and support both versions (<10 also).
Thanks, Jakub.