synpress: Synpress can't find the Metamask locator('.notification .request-signature__footer__sign-button')

My code: cy.acceptMetamaskAccess({signInSignature: true}).should(‘be.true’);

The error:

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

page.waitForSelector: Timeout 30000ms exceeded.

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

waiting for locator('.notification .request-signature__footer__sign-button') to be visible

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

https://on.cypress.io/api/task support/commands.js:184:1 182 | 183 | Cypress.Commands.add('acceptMetamaskAccess', options => {

184 | return cy.task('acceptMetamaskAccess', options); | ^ 185 | }); 186 | 187 | Cypress.Commands.add('confirmMetamaskTransaction', gasConfig => {

I don’t understand why. It even scrolls down, but can’t find this “SIGN” button, which I actually see. enter image description here

Tried: cy.acceptMetamaskAccess({signInSignature: true}).should(‘be.true’);

Expected: Metamask signs my request.

Preivew

1 2

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 29 (17 by maintainers)

Most upvoted comments

Just want to confirm that you re-installed your dependencies yarn install or npm install? If you didn’t install Synpress after updating your package.json it will not work! Also, can you please use the new comment below?

// Use this new commit hash below 👇 
 "@synthetixio/synpress": "https://github.com/Synthetixio/synpress.git#ad0e77db3be0bc43816f7d4cafd135dcc9c6623c", 

Demo Screen.Recording.2023-05-02.at.11.10.06.AM.mov

👍 This one fixes the login flow for our app. Any idea when this could be released?

Happy to hear that it works for you! Ideally, this fix will be included in the next release!

About your points:

  1. I think the first issue you shared happens because the “cypress” app and the “browser” might not be completely closed. make sure to close them so it works for you. The “comma” doesn’t matter. If you are on Mac go to your dock and “quit” them.

  2. I didn’t fully understand what you are trying to say in your next point, can you please elaborate on this more, please?

Just want to confirm that you re-installed your dependencies yarn install or npm install? If you didn’t install Synpress after updating your package.json it will not work! Also, can you please use the new comment below?

// Use this new commit hash below 👇 
 "@synthetixio/synpress": "https://github.com/Synthetixio/synpress.git#ad0e77db3be0bc43816f7d4cafd135dcc9c6623c", 
Demo

https://user-images.githubusercontent.com/72753578/235614406-3ca4d3a0-e1fd-4f49-9b80-63b614207eda.mov

@neuodev I tried as you told me - only use ‘confirmDataSignatureRequest’ parameter, but it doesn’t work - no actions in the Metamask Signature request window, that is why then the same error - "waiting for event ‘close’ ". I also copied your code and tried with it - the test failed with exactly the same error. You can see this on the gif: 5

I think I found the issue, as for now cy.acceptMetamaskAccess({signInSignature: true}) can only sign any message except for “type 4”. I will work on a fix.

I am planning to add a new flag to indicate that you are signing a type 4 message.

cy.acceptMetamaskAccess({
  confirmDataSignatureRequest: true, // confirm data type 4 signing request 
  confirmSignatureRequest: true, // confirm regular signature request
 signInSignature: true, // will be left for backward compatibility with a warning indicating it will be removed soon. 
})

Until the fix is ready, you can try updating your codebase to split this into two steps then you can use

cy.acceptMetamaskAccess(); // without sing in signature 
cy.confirmMetamaskDataSignatureRequest();