synpress icon indicating copy to clipboard operation
synpress copied to clipboard

acceptMetamaskAccess() failing with cy.task() error

Open mflorlorenzo opened this issue 2 years ago • 3 comments

Describe the bug acceptMetamaskAccess() is failing.

CypressError: cy.task() must only be invoked from the spec file or support file.

From Your Spec Code: at Context.eval (webpack:///./node_modules/@synthetixio/synpress/support/commands.js:184:0)

Line 184: return cy.task('acceptMetamaskAccess', options);

To Reproduce Steps to reproduce the behavior:

  1. Run the project
  2. Wait until framework has to accept the metamask login access
  3. See error

Expected behavior Login successfully. acceptMetamaskAccess() should works as it did before.

Desktop (please complete the following information):

  • OS: macOS 12.6.5
  • Synpress version: 3.7.1
  • running locally

Additional context There was an issue on cypress related to this on a new version (12.15.0), but I'm using an old one (12.11.0), so should works. https://github.com/cypress-io/code-coverage/issues/667

mflorlorenzo avatar Jul 05 '23 17:07 mflorlorenzo

@mflorlorenzo I also faced the same issue a few days ago. For me the thing was even though I had gone back to an older version the test run was still using the latest version. You can try by checking the starting of the test where it shows all the spec files and other info

ayushrungta8 avatar Jul 06 '23 06:07 ayushrungta8

Well, I found the issue. I changed the cypress version from 12.16.0 to 12.14.0 on @synthetixio/synpress/node_modules/cypress/package.json and works ! @synthetixio-team is there a chance to take a look on it please? From Cypress say version 12.16.0 has the fix for this error, but it's not working here. Thanks

mflorlorenzo avatar Jul 06 '23 19:07 mflorlorenzo

@mflorlorenzo: it's not Synpress's fault. As the Cypress team expressed here they know about some edge cases that still exist in 12.16.0. I do confirm that pinning Cypress version to 12.14.0 solves the problem for me too.

aziolek avatar Jul 07 '23 13:07 aziolek