cy.confirmMetamaskSignatureRequest() fails - synpress plugin

Viewed 38

I am testing a staking dapp. Using cypress with the synpress plugin, that makes Metamask interactions easy. https://github.com/Synthetixio/synpress

Now the dapp works. When it goes to confirmMetamaskSignatureRequest, metamask just stays open. I tried cy.switchToMetamaskWindow();, cy.rejectMetamaskSignatureRequest(). The picture shows where the test is idling and eventually failing. Any ideas?

halting at this picture

it('test', () => {  
// imports a custom address
cy.importMetamaskAccount(Cypress.env('PRIVATE_KEY'))

// open the staking tab
cy.visit('/staking', {
  auth: {
    username: Cypress.env('URL_USERNAME'),
    password: Cypress.env('URL_PASSWORD')
  },
});

// connect wallet to dapp
cy.contains('Connect Wallet').click();
cy.contains('MetaMask').click();

cy.switchToMetamaskWindow();
cy.acceptMetamaskAccess().should("be.true");

// check if address is recognised by dapp
cy.getMetamaskWalletAddress().then(address => {
  cy.switchToCypressWindow();
  cy.get('p').contains('WALLET:').should('exist');
  console.log(address);
  cy.get('p').contains(address).should('exist');
  cy.get('p').contains('DISCONNECT').should('exist');
});

// input the amount to stake
cy.get('input[name="Token[enter image description here][1]Value"]').type('1');

// choose the time to stake
cy.contains('10 days').click();

// confirm staking
cy.contains('confirm Staking').click();

// should sign metamask tx but its only metamask window is open
cy.confirmMetamaskSignatureRequest().should("be.true");
});
1 Answers

Solved: Instead of...

cy.confirmMetamaskSignatureRequest().should("be.true");

...you should use this:

cy.confirmMetamaskTransaction().should("be.true");
Related