Skip to content

Commit

Permalink
Promote dev to master (#980)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Piotr Frankowski <[email protected]>
Co-authored-by: Rafał Majchrzak <[email protected]>
  • Loading branch information
4 people authored Nov 3, 2023
1 parent baedac4 commit 3c0bfea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions commands/metamask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions docs/synpress-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ acceptMetamaskAccess(options?: {
allAccounts?: boolean;
confirmSignatureRequest?: boolean;
confirmDataSignatureRequest?: boolean;
switchNetwork?: boolean;
}): Chainable<boolean>;
```

Expand Down
1 change: 1 addition & 0 deletions support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ declare namespace Cypress {
allAccounts?: boolean;
confirmSignatureRequest?: boolean;
confirmDataSignatureRequest?: boolean;
switchNetwork?: boolean;
}): Chainable<boolean>;
/**
* Reject metamask access request
Expand Down

0 comments on commit 3c0bfea

Please sign in to comment.