From 3c0bfeac602185f89492f04808b67c42deaf7117 Mon Sep 17 00:00:00 2001 From: Daniel Izdebski Date: Fri, 3 Nov 2023 19:07:12 +0100 Subject: [PATCH] Promote `dev` to `master` (#980) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove leftover TODOs * Remove text based locators * Add `Known problems with MetaMask` section * Remove Promise wrap from `cy.setupMetamask()` (#927) * Fix localized Chrome's extension id (#928) * Fix localized Chrome's extension id * Improve id handling --------- Co-authored-by: Piotr Frankowski * Lint * Feature/revoke permission to all (#932) * Fix typo in Permission word * Add permission revoking actions * Add tests for permission revoking actions * Regenerate synpress commands file * Add `switchNetwork` option to `acceptAccess` function --------- Co-authored-by: Peter F Co-authored-by: Piotr Frankowski Co-authored-by: RafaƂ Majchrzak --- commands/metamask.js | 14 ++++++++++++++ docs/synpress-commands.md | 1 + support/index.d.ts | 1 + 3 files changed, 16 insertions(+) diff --git a/commands/metamask.js b/commands/metamask.js index 5e6e726e7..fdad8daad 100644 --- a/commands/metamask.js +++ b/commands/metamask.js @@ -933,6 +933,20 @@ const metamask = { return true; } + if (options && options.switchNetwork) { + await playwright.waitAndClick( + permissionsPageElements.connectButton, + notificationPage, + { waitForEvent: 'navi' }, + ); + await playwright.waitAndClick( + confirmationPageElements.footer.approveButton, + notificationPage, + { waitForEvent: 'close' }, + ); + return true; + } + await playwright.waitAndClick( permissionsPageElements.connectButton, notificationPage, diff --git a/docs/synpress-commands.md b/docs/synpress-commands.md index 8a5564c95..2ae6bee81 100644 --- a/docs/synpress-commands.md +++ b/docs/synpress-commands.md @@ -398,6 +398,7 @@ acceptMetamaskAccess(options?: { allAccounts?: boolean; confirmSignatureRequest?: boolean; confirmDataSignatureRequest?: boolean; + switchNetwork?: boolean; }): Chainable; ``` diff --git a/support/index.d.ts b/support/index.d.ts index fb5bbb3e1..68d42b311 100644 --- a/support/index.d.ts +++ b/support/index.d.ts @@ -315,6 +315,7 @@ declare namespace Cypress { allAccounts?: boolean; confirmSignatureRequest?: boolean; confirmDataSignatureRequest?: boolean; + switchNetwork?: boolean; }): Chainable; /** * Reject metamask access request