Skip to content

Commit

Permalink
Merge pull request #366 from Synthetixio/dev
Browse files Browse the repository at this point in the history
promote dev to master
  • Loading branch information
drptbl authored Mar 22, 2022
2 parents 0601b62 + 0e50b91 commit 1d3fa06
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
8 changes: 7 additions & 1 deletion commands/metamask.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,14 @@ module.exports = {
await puppeteer.metamaskWindow().waitForTimeout(1000);
return true;
},
acceptAccess: async () => {
acceptAccess: async (allAccounts) => {
const notificationPage = await puppeteer.switchToMetamaskNotification();
if (allAccounts === true) {
await puppeteer.waitAndClick(
notificationPageElements.selectAllCheck,
notificationPage,
);
}
await puppeteer.waitAndClick(
notificationPageElements.nextButton,
notificationPage,
Expand Down
2 changes: 2 additions & 0 deletions pages/metamask/notification-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ const notificationPage = '.notification';
const nextButton = `${notificationPage} .permissions-connect-choose-account__bottom-buttons button:nth-child(2)`;
const allowToSpendButton = `${notificationPage} [data-testid="page-container-footer-next"]`;
const rejectToSpendButton = `${notificationPage} [data-testid="page-container-footer-cancel"]`;
const selectAllCheck = `${notificationPage} .permissions-connect-choose-account__header-check-box`;
module.exports.notificationPageElements = {
notificationPage,
nextButton,
allowToSpendButton,
rejectToSpendButton,
selectAllCheck,
};

const confirmSignatureRequestButton = `${notificationPage} .request-signature__footer__sign-button`;
Expand Down
4 changes: 2 additions & 2 deletions plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ module.exports = (on, config) => {
const rejected = await metamask.rejectPermissionToSpend();
return rejected;
},
acceptMetamaskAccess: async () => {
const accepted = await metamask.acceptAccess();
acceptMetamaskAccess: async (allAccounts) => {
const accepted = await metamask.acceptAccess(allAccounts);
return accepted;
},
confirmMetamaskTransaction: async gasConfig => {
Expand Down
4 changes: 2 additions & 2 deletions support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ Cypress.Commands.add('rejectMetamaskPermissionToSpend', () => {
return cy.task('rejectMetamaskPermissionToSpend');
});

Cypress.Commands.add('acceptMetamaskAccess', () => {
return cy.task('acceptMetamaskAccess');
Cypress.Commands.add('acceptMetamaskAccess', (allAccounts) => {
return cy.task('acceptMetamaskAccess', allAccounts);
});

Cypress.Commands.add('confirmMetamaskTransaction', gasConfig => {
Expand Down
3 changes: 2 additions & 1 deletion support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ declare namespace Cypress {
* Accept metamask access request
* @example
* cy.acceptMetamaskAccess()
* cy.acceptMetamaskAccess(true)
*/
acceptMetamaskAccess(): Chainable<Subject>;
acceptMetamaskAccess(allAccounts: boolean | undefined): Chainable<Subject>;
/**
* Confirm metamask atransaction
* @example
Expand Down

0 comments on commit 1d3fa06

Please sign in to comment.