Skip to content

Commit

Permalink
Add switchNetwork option to acceptAccess function
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception committed Nov 3, 2023
1 parent de76346 commit 26422ce
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 26422ce

Please sign in to comment.