首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >cy.confirmMetamaskSignatureRequest()失败-同步插件

cy.confirmMetamaskSignatureRequest()失败-同步插件
EN

Stack Overflow用户
提问于 2022-09-09 21:54:04
回答 1查看 92关注 0票数 0

我在测试一个有赌注的dapp。使用柏树与同步插件,这使Metamask互动容易。https://github.com/Synthetixio/synpress

现在dapp起作用了。当它转到confirmMetamaskSignatureRequest时,元问题就会保持打开状态。我尝试了cy.switchToMetamaskWindow();,cy.rejectMetamaskSignatureRequest()。这张图显示了测试正在空转,最终失败的地方。有什么想法吗?

停下来看这幅画

代码语言:javascript
复制
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");
});
EN

回答 1

Stack Overflow用户

发布于 2022-09-16 15:40:22

解决了:而不是..。

代码语言:javascript
复制
cy.confirmMetamaskSignatureRequest().should("be.true");

...you应该使用以下方法:

代码语言:javascript
复制
cy.confirmMetamaskTransaction().should("be.true");
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73667824

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档