From de76346e5ad8e86851531070a746a1f0108342f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Majchrzak?= Date: Wed, 18 Oct 2023 17:22:42 +0200 Subject: [PATCH] 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 --- commands/metamask.js | 22 ++- docs/synpress-commands.md | 227 +++++++++++++++++++++---------- plugins/index.js | 7 +- support/commands.js | 16 ++- support/index.d.ts | 34 +++-- tests/e2e/specs/metamask-spec.js | 20 ++- 6 files changed, 234 insertions(+), 92 deletions(-) diff --git a/commands/metamask.js b/commands/metamask.js index 3b796c48f..5e6e726e7 100644 --- a/commands/metamask.js +++ b/commands/metamask.js @@ -1348,7 +1348,7 @@ const metamask = { ); return true; }, - async confirmPermisionToApproveAll() { + async confirmPermissionToApproveAll() { const notificationPage = await playwright.switchToMetamaskNotification(); await playwright.waitAndClick( notificationPageElements.allowToSpendButton, @@ -1361,7 +1361,7 @@ const metamask = { ); return true; }, - async rejectPermisionToApproveAll() { + async rejectPermissionToApproveAll() { const notificationPage = await playwright.switchToMetamaskNotification(); await playwright.waitAndClick( notificationPageElements.allowToSpendButton, @@ -1374,6 +1374,24 @@ const metamask = { ); return true; }, + async confirmRevokePermissionToAll() { + const notificationPage = await playwright.switchToMetamaskNotification(); + await playwright.waitAndClick( + notificationPageElements.allowToSpendButton, + notificationPage, + { waitForEvent: 'close' }, + ); + return true; + }, + async rejectRevokePermissionToAll() { + const notificationPage = await playwright.switchToMetamaskNotification(); + await playwright.waitAndClick( + notificationPageElements.rejectToSpendButton, + notificationPage, + { waitForEvent: 'close' }, + ); + return true; + }, async allowToAddNetwork({ waitForEvent } = {}) { const notificationPage = await playwright.switchToMetamaskNotification(); if (waitForEvent) { diff --git a/docs/synpress-commands.md b/docs/synpress-commands.md index 408d800aa..8a5564c95 100644 --- a/docs/synpress-commands.md +++ b/docs/synpress-commands.md @@ -5,7 +5,7 @@ Connect playwright with Cypress instance. ```ts -initPlaywright(): Chainable; +initPlaywright(): Chainable; ``` #### `cy.assignWindows()` @@ -13,7 +13,7 @@ initPlaywright(): Chainable; Assign currently open tabs with playwright. ```ts -assignWindows(): Chainable; +assignWindows(): Chainable; ``` #### `cy.assignActiveTabName()` @@ -21,7 +21,7 @@ assignWindows(): Chainable; Assigns currently active tab. ```ts -assignActiveTabName(): Chainable; +assignActiveTabName(tabName: string): Chainable; ``` #### `cy.isMetamaskWindowActive()` @@ -29,7 +29,7 @@ assignActiveTabName(): Chainable; Checks if current active tab is metamask. ```ts -isMetamaskWindowActive(): Chainable; +isMetamaskWindowActive(): Chainable; ``` #### `cy.isCypressWindowActive()` @@ -37,7 +37,7 @@ isMetamaskWindowActive(): Chainable; Checks if current active tab is cypress. ```ts -isCypressWindowActive(): Chainable; +isCypressWindowActive(): Chainable; ``` #### `cy.switchToCypressWindow()` @@ -45,7 +45,7 @@ isCypressWindowActive(): Chainable; Switch to Cypress window. ```ts -switchToCypressWindow(): Chainable; +switchToCypressWindow(): Chainable; ``` #### `cy.switchToMetamaskWindow()` @@ -53,7 +53,7 @@ switchToCypressWindow(): Chainable; Switch to metamask window. ```ts -switchToMetamaskWindow(): Chainable; +switchToMetamaskWindow(): Chainable; ``` #### `cy.switchToMetamaskNotification()` @@ -61,7 +61,7 @@ switchToMetamaskWindow(): Chainable; Switch to metamask notification window. ```ts -switchToMetamaskNotification(): Chainable; +switchToMetamaskNotification(): Chainable; ``` #### `cy.getCurrentNetwork()` @@ -77,15 +77,26 @@ getCurrentNetwork(): Chainable; Add network in metamask (and also switch to the newly added network). ```ts -addMetamaskNetwork(network: object): Chainable; +addMetamaskNetwork( + network: + | string + | { + networkName: string; + rpcUrl: string; + chainId: number; + symbol?: string; + blockExplorer?: string; + isTestnet: boolean; + }, +): Chainable; ``` #### `cy.changeMetamaskNetwork()` -Change network in metamask. +Change network in metamask (if network is not present, it will be added). ```ts -changeMetamaskNetwork(network: string): Chainable; +changeMetamaskNetwork(network: string): Chainable; ``` #### `cy.importMetamaskAccount()` @@ -93,7 +104,7 @@ changeMetamaskNetwork(network: string): Chainable; Import new account in metamask using private key. ```ts -importMetamaskAccount(privateKey: string): Chainable; +importMetamaskAccount(privateKey: string): Chainable; ``` #### `cy.createMetamaskAccount()` @@ -101,7 +112,7 @@ importMetamaskAccount(privateKey: string): Chainable; Create new account in metamask. ```ts -createMetamaskAccount(accountName?: string): Chainable; +createMetamaskAccount(accountName?: string): Chainable; ``` #### `cy.renameMetamaskAccount()` @@ -109,7 +120,7 @@ createMetamaskAccount(accountName?: string): Chainable; Rename current account in metamask. ```ts -createMetamaskAccount(newAccountName: string): Chainable; +renameMetamaskAccount(newAccountName: string): Chainable; ``` #### `cy.switchMetamaskAccount()` @@ -119,7 +130,7 @@ Switch metamask account. ```ts switchMetamaskAccount( accountNameOrAccountNumber: string | number, -): Chainable; +): Chainable; ``` #### `cy.getMetamaskWalletAddress()` @@ -127,35 +138,38 @@ switchMetamaskAccount( Get current wallet address of metamask wallet. ```ts -getMetamaskWalletAddress(): Chainable; +getMetamaskWalletAddress(): Chainable; ``` #### `cy.activateAdvancedGasControlInMetamask()` -Activate ability (in metamask settings) to specify custom gas price and limit while doing transactions in metamask. +Activate ability (in metamask settings) to specify custom gas price and limit +while doing transactions in metamask. ```ts activateAdvancedGasControlInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.activateShowHexDataInMetamask()` -Activate ability (in metamask settings) to show hex data while doing transaction in metamask. +Activate ability (in metamask settings) to show hex data while doing transaction +in metamask. ```ts -activateShowHexDataInMetamask(skipSetup?: boolean): Chainable; +activateShowHexDataInMetamask(skipSetup?: boolean): Chainable; ``` #### `cy.activateTestnetConversionInMetamask()` -Activate ability (in metamask settings) to show fiat conversions on testnets in metamask. +Activate ability (in metamask settings) to show fiat conversions on testnets in +metamask. ```ts activateTestnetConversionInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.activateShowTestnetNetworksInMetamask()` @@ -165,25 +179,27 @@ Activate ability (in metamask settings) to show testnet networks in metamask. ```ts activateShowTestnetNetworksInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.activateCustomNonceInMetamask()` -Activate ability (in metamask settings) to specify custom nonce while doing transactions in metamask. +Activate ability (in metamask settings) to specify custom nonce while doing +transactions in metamask. ```ts -activateCustomNonceInMetamask(skipSetup?: boolean): Chainable; +activateCustomNonceInMetamask(skipSetup?: boolean): Chainable; ``` #### `cy.activateDismissBackupReminderInMetamask()` -Activate ability (in metamask settings) to dismiss secret recovery phrase reminder in metamask. +Activate ability (in metamask settings) to dismiss secret recovery phrase +reminder in metamask. ```ts activateDismissBackupReminderInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.activateEthSignRequestsInMetamask()` @@ -191,7 +207,7 @@ activateDismissBackupReminderInMetamask( Activate eth sign requests in metamask settings. ```ts -activateEthSignRequestsInMetamask(skipSetup?: boolean): Chainable; +activateEthSignRequestsInMetamask(skipSetup?: boolean): Chainable; ``` #### `cy.activateImprovedTokenAllowanceInMetamask()` @@ -201,7 +217,7 @@ Activate improved token allowance in metamask settings (experimental). ```ts activateImprovedTokenAllowanceInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.resetMetamaskAccount()` @@ -209,7 +225,7 @@ activateImprovedTokenAllowanceInMetamask( Reset metamask account state in settings. ```ts -resetMetamaskAccount(): Chainable; +resetMetamaskAccount(): Chainable; ``` #### `cy.disconnectMetamaskWalletFromDapp()` @@ -217,7 +233,7 @@ resetMetamaskAccount(): Chainable; Disconnects metamask wallet from last connected dapp. ```ts -disconnectMetamaskWalletFromDapp(): Chainable; +disconnectMetamaskWalletFromDapp(): Chainable; ``` #### `cy.disconnectMetamaskWalletFromAllDapps()` @@ -225,7 +241,7 @@ disconnectMetamaskWalletFromDapp(): Chainable; Disconnects metamask wallet from all connected dapps. ```ts -disconnectMetamaskWalletFromAllDapps(): Chainable; +disconnectMetamaskWalletFromAllDapps(): Chainable; ``` #### `cy.confirmMetamaskSignatureRequest()` @@ -233,7 +249,7 @@ disconnectMetamaskWalletFromAllDapps(): Chainable; Confirm metamask permission to sign message. ```ts -confirmMetamaskSignatureRequest(): Chainable; +confirmMetamaskSignatureRequest(): Chainable; ``` #### `cy.confirmMetamaskDataSignatureRequest()` @@ -241,7 +257,7 @@ confirmMetamaskSignatureRequest(): Chainable; Confirm metamask permission to sign Data message. ```ts -confirmMetamaskDataSignatureRequest(): Chainable; +confirmMetamaskDataSignatureRequest(): Chainable; ``` #### `cy.rejectMetamaskSignatureRequest()` @@ -249,7 +265,7 @@ confirmMetamaskDataSignatureRequest(): Chainable; Reject metamask permission to sign message. ```ts -rejectMetamaskSignatureRequest(): Chainable; +rejectMetamaskSignatureRequest(): Chainable; ``` #### `cy.confirmMetamaskEncryptionPublicKeyRequest()` @@ -257,7 +273,7 @@ rejectMetamaskSignatureRequest(): Chainable; Confirm metamask request for public encryption key. ```ts -confirmMetamaskEncryptionPublicKeyRequest(): Chainable; +confirmMetamaskEncryptionPublicKeyRequest(): Chainable; ``` #### `cy.rejectMetamaskEncryptionPublicKeyRequest()` @@ -265,7 +281,7 @@ confirmMetamaskEncryptionPublicKeyRequest(): Chainable; Reject metamask request for public encryption key. ```ts -rejectMetamaskEncryptionPublicKeyRequest(): Chainable; +rejectMetamaskEncryptionPublicKeyRequest(): Chainable; ``` #### `cy.confirmMetamaskDecryptionRequest()` @@ -273,7 +289,7 @@ rejectMetamaskEncryptionPublicKeyRequest(): Chainable; Confirm metamask request to decrypt message with private key. ```ts -confirmMetamaskDecryptionRequest(): Chainable; +confirmMetamaskDecryptionRequest(): Chainable; ``` #### `cy.rejectMetamaskDecryptionRequest()` @@ -281,7 +297,7 @@ confirmMetamaskDecryptionRequest(): Chainable; Reject metamask request to decrypt message with private key. ```ts -rejectMetamaskDecryptionRequest(): Chainable; +rejectMetamaskDecryptionRequest(): Chainable; ``` #### `cy.rejectMetamaskDataSignatureRequest()` @@ -289,7 +305,7 @@ rejectMetamaskDecryptionRequest(): Chainable; Reject metamask permission to sign Data message. ```ts -rejectMetamaskDataSignatureRequest(): Chainable; +rejectMetamaskDataSignatureRequest(): Chainable; ``` #### `cy.importMetamaskToken()` @@ -297,7 +313,14 @@ rejectMetamaskDataSignatureRequest(): Chainable; Add custom token to metamask. ```ts -importMetamaskToken(tokenConfig?: object | string): Chainable; +importMetamaskToken( + tokenConfig?: + | { + address: string; + symbol: string; + } + | string, +): Chainable; ``` #### `cy.confirmMetamaskAddToken()` @@ -305,7 +328,7 @@ importMetamaskToken(tokenConfig?: object | string): Chainable; Confirm metamask request to add token. ```ts -confirmMetamaskAddToken(): Chainable; +confirmMetamaskAddToken(): Chainable; ``` #### `cy.rejectMetamaskAddToken()` @@ -313,7 +336,7 @@ confirmMetamaskAddToken(): Chainable; Reject metamask request to add token. ```ts -rejectMetamaskAddToken(): Chainable; +rejectMetamaskAddToken(): Chainable; ``` #### `cy.confirmMetamaskPermissionToSpend()` @@ -321,23 +344,41 @@ rejectMetamaskAddToken(): Chainable; Confirm metamask permission to spend asset. ```ts -confirmMetamaskPermissionToSpend(spendLimit?: string): Chainable; +confirmMetamaskPermissionToSpend(spendLimit?: string): Chainable; ``` -#### `cy.confirmMetamaskPermisionToApproveAll()` +#### `cy.confirmMetamaskPermissionToApproveAll()` Confirm metamask permission to access all elements (example: collectibles). ```ts -confirmMetamaskPermisionToApproveAll(): Chainable; +confirmMetamaskPermissionToApproveAll(): Chainable; ``` -#### `cy.rejectMetamaskPermisionToApproveAll()` +#### `cy.rejectMetamaskPermissionToApproveAll()` Reject metamask permission to access all elements (example: collectibles). ```ts -rejectMetamaskPermisionToApproveAll(): Chainable; +rejectMetamaskPermissionToApproveAll(): Chainable; +``` + +#### `cy.confirmMetamaskRevokePermissionToAll()` + +Confirm metamask revoking permission to access all elements (example: +collectibles). + +```ts +confirmMetamaskRevokePermissionToAll(): Chainable; +``` + +#### `cy.rejectMetamaskRevokePermissionToAll()` + +Reject metamask revoking permission to access all elements (example: +collectibles). + +```ts +rejectMetamaskRevokePermissionToAll(): Chainable; ``` #### `cy.rejectMetamaskPermissionToSpend()` @@ -345,7 +386,7 @@ rejectMetamaskPermisionToApproveAll(): Chainable; Reject metamask permission to spend asset. ```ts -rejectMetamaskPermissionToSpend(): Chainable; +rejectMetamaskPermissionToSpend(): Chainable; ``` #### `cy.acceptMetamaskAccess()` @@ -357,7 +398,15 @@ acceptMetamaskAccess(options?: { allAccounts?: boolean; confirmSignatureRequest?: boolean; confirmDataSignatureRequest?: boolean; -}): Chainable; +}): Chainable; +``` + +#### `cy.rejectMetamaskAccess()` + +Reject metamask access request. + +```ts +rejectMetamaskAccess(): Chainable; ``` #### `cy.confirmMetamaskTransaction()` @@ -365,15 +414,46 @@ acceptMetamaskAccess(options?: { Confirm metamask transaction (auto-detects eip-1559 and legacy transactions). ```ts -confirmMetamaskTransaction(gasConfig?: object | string): Chainable; +confirmMetamaskTransaction( + gasConfig?: + | { + gasLimit?: number; + baseFee?: number; + priorityFee?: number; + } + | { + gasLimit?: number; + gasPrice?: number; + } + | 'low' + | 'market' + | 'aggressive' + | 'site', +): Chainable; ``` #### `cy.confirmMetamaskTransactionAndWaitForMining()` -Confirm metamask transaction (auto-detects eip-1559 and legacy transactions) and wait for ALL pending transactions to be mined. - -```ts -confirmMetamaskTransactionAndWaitForMining(gasConfig?: object | string): Chainable; +Confirm metamask transaction (auto-detects eip-1559 and legacy transactions) and +wait for ALL pending transactions to be mined. + +```ts +confirmMetamaskTransactionAndWaitForMining( + gasConfig?: + | { + gasLimit?: number; + baseFee?: number; + priorityFee?: number; + } + | { + gasLimit?: number; + gasPrice?: number; + } + | 'low' + | 'market' + | 'aggressive' + | 'site', +): Chainable; ``` #### `cy.rejectMetamaskTransaction()` @@ -381,12 +461,13 @@ confirmMetamaskTransactionAndWaitForMining(gasConfig?: object | string): Chainab Reject metamask transaction. ```ts -rejectMetamaskTransaction(): Chainable; +rejectMetamaskTransaction(): Chainable; ``` #### `cy.openMetamaskTransactionDetails()` -Open metamask transaction details based on the index of the transaction in the list on the activity tab. +Open metamask transaction details based on the index of the transaction in the +list on the activity tab. ```ts openMetamaskTransactionDetails(txIndex: number): Chainable; @@ -394,10 +475,10 @@ openMetamaskTransactionDetails(txIndex: number): Chainable; #### `cy.closeMetamaskTransactionDetailsPopup()` -Close currently open transaction details popup. +Close metamask transaction details popup. ```ts -closeMetamaskTransactionDetailsPopup(): Chainable; +closeMetamaskTransactionDetailsPopup(): Chainable; ``` #### `cy.allowMetamaskToAddNetwork()` @@ -405,7 +486,7 @@ closeMetamaskTransactionDetailsPopup(): Chainable; Allow site to add new network in metamask. ```ts -allowMetamaskToAddNetwork(waitForEvent?: string): Chainable; +allowMetamaskToAddNetwork(waitForEvent?: string): Chainable; ``` #### `cy.rejectMetamaskToAddNetwork()` @@ -413,7 +494,7 @@ allowMetamaskToAddNetwork(waitForEvent?: string): Chainable; Reject site to add new network in metamask. ```ts -rejectMetamaskToAddNetwork(): Chainable; +rejectMetamaskToAddNetwork(): Chainable; ``` #### `cy.allowMetamaskToSwitchNetwork()` @@ -421,7 +502,7 @@ rejectMetamaskToAddNetwork(): Chainable; Allow site to switch network in metamask. ```ts -allowMetamaskToSwitchNetwork(): Chainable; +allowMetamaskToSwitchNetwork(): Chainable; ``` #### `cy.rejectMetamaskToSwitchNetwork()` @@ -429,7 +510,7 @@ allowMetamaskToSwitchNetwork(): Chainable; Reject site to switch network in metamask. ```ts -rejectMetamaskToSwitchNetwork(): Chainable; +rejectMetamaskToSwitchNetwork(): Chainable; ``` #### `cy.allowMetamaskToAddAndSwitchNetwork()` @@ -437,7 +518,7 @@ rejectMetamaskToSwitchNetwork(): Chainable; Allow site to add new network in metamask and switch to it. ```ts -allowMetamaskToAddAndSwitchNetwork(): Chainable; +allowMetamaskToAddAndSwitchNetwork(): Chainable; ``` #### `cy.unlockMetamask()` @@ -445,7 +526,7 @@ allowMetamaskToAddAndSwitchNetwork(): Chainable; Unlock metamask. ```ts -unlockMetamask(password: string): Chainable; +unlockMetamask(password: string): Chainable; ``` #### `cy.fetchMetamaskWalletAddress()` @@ -453,7 +534,7 @@ unlockMetamask(password: string): Chainable; Fetches previous metamask wallet address. ```ts -fetchMetamaskWalletAddress(): Chainable; +fetchMetamaskWalletAddress(): Chainable; ``` #### `cy.setupMetamask()` @@ -463,7 +544,16 @@ Run the flow for metamask setup. ```ts setupMetamask( secretWordsOrPrivateKey?: string, - network?: string | object, + network?: + | string + | { + networkName: string; + rpcUrl: string; + chainId: number; + symbol?: string; + blockExplorer?: string; + isTestnet: boolean; + }, password?: string, enableAdvancedSettings?: boolean, enableExperimentalSettings?: boolean, @@ -483,7 +573,7 @@ etherscanGetTransactionStatus(txid: string): Chainable; Wait until transaction is success using Etherscan API. ```ts -etherscanWaitForTxSuccess(txid: string): Chainable; +etherscanWaitForTxSuccess(txid: string): Chainable; ``` #### `cy.waitForResources()` @@ -514,4 +604,3 @@ isWithinViewport( viewportHeight: number, ): Chainable; ``` - diff --git a/plugins/index.js b/plugins/index.js index 51fe4965b..c41090ed6 100644 --- a/plugins/index.js +++ b/plugins/index.js @@ -103,8 +103,11 @@ module.exports = (on, config) => { rejectMetamaskAddToken: metamask.rejectAddToken, confirmMetamaskPermissionToSpend: metamask.confirmPermissionToSpend, rejectMetamaskPermissionToSpend: metamask.rejectPermissionToSpend, - confirmMetamaskPermisionToApproveAll: metamask.confirmPermisionToApproveAll, - rejectMetamaskPermisionToApproveAll: metamask.rejectPermisionToApproveAll, + confirmMetamaskPermissionToApproveAll: + metamask.confirmPermissionToApproveAll, + rejectMetamaskPermissionToApproveAll: metamask.rejectPermissionToApproveAll, + confirmMetamaskRevokePermissionToAll: metamask.confirmRevokePermissionToAll, + rejectMetamaskRevokePermissionToAll: metamask.rejectRevokePermissionToAll, acceptMetamaskAccess: metamask.acceptAccess, rejectMetamaskAccess: metamask.rejectAccess, confirmMetamaskTransaction: metamask.confirmTransaction, diff --git a/support/commands.js b/support/commands.js index 73869e3fc..282ab8b3e 100644 --- a/support/commands.js +++ b/support/commands.js @@ -215,12 +215,20 @@ Cypress.Commands.add('closeMetamaskTransactionDetailsPopup', () => { return cy.task('closeMetamaskTransactionDetailsPopup'); }); -Cypress.Commands.add('rejectMetamaskPermisionToApproveAll', () => { - return cy.task('rejectMetamaskPermisionToApproveAll'); +Cypress.Commands.add('rejectMetamaskPermissionToApproveAll', () => { + return cy.task('rejectMetamaskPermissionToApproveAll'); }); -Cypress.Commands.add('confirmMetamaskPermisionToApproveAll', () => { - return cy.task('confirmMetamaskPermisionToApproveAll'); +Cypress.Commands.add('confirmMetamaskPermissionToApproveAll', () => { + return cy.task('confirmMetamaskPermissionToApproveAll'); +}); + +Cypress.Commands.add('confirmMetamaskRevokePermissionToAll', () => { + return cy.task('confirmMetamaskRevokePermissionToAll'); +}); + +Cypress.Commands.add('rejectMetamaskRevokePermissionToAll', () => { + return cy.task('rejectMetamaskRevokePermissionToAll'); }); Cypress.Commands.add('allowMetamaskToAddNetwork', waitForEvent => { diff --git a/support/index.d.ts b/support/index.d.ts index 804e32d54..fb5bbb3e1 100644 --- a/support/index.d.ts +++ b/support/index.d.ts @@ -278,15 +278,27 @@ declare namespace Cypress { /** * Confirm metamask permission to access all elements (example: collectibles) * @example - * cy.confirmMetamaskPermisionToApproveAll() + * cy.confirmMetamaskPermissionToApproveAll() */ - confirmMetamaskPermisionToApproveAll(): Chainable; + confirmMetamaskPermissionToApproveAll(): Chainable; /** * Reject metamask permission to access all elements (example: collectibles) * @example - * cy.rejectMetamaskPermisionToApproveAll() + * cy.rejectMetamaskPermissionToApproveAll() */ - rejectMetamaskPermisionToApproveAll(): Chainable; + rejectMetamaskPermissionToApproveAll(): Chainable; + /** + * Confirm metamask revoking permission to access all elements (example: collectibles) + * @example + * cy.confirmMetamaskRevokePermissionToAll() + */ + confirmMetamaskRevokePermissionToAll(): Chainable; + /** + * Reject metamask revoking permission to access all elements (example: collectibles) + * @example + * cy.rejectMetamaskRevokePermissionToAll() + */ + rejectMetamaskRevokePermissionToAll(): Chainable; /** * Reject metamask permission to spend asset * @example @@ -345,14 +357,14 @@ declare namespace Cypress { confirmMetamaskTransactionAndWaitForMining( gasConfig?: | { - gasLimit?: number; - baseFee?: number; - priorityFee?: number; - } + gasLimit?: number; + baseFee?: number; + priorityFee?: number; + } | { - gasLimit?: number; - gasPrice?: number; - } + gasLimit?: number; + gasPrice?: number; + } | 'low' | 'market' | 'aggressive' diff --git a/tests/e2e/specs/metamask-spec.js b/tests/e2e/specs/metamask-spec.js index 3b00ae2a2..4cbdcf635 100644 --- a/tests/e2e/specs/metamask-spec.js +++ b/tests/e2e/specs/metamask-spec.js @@ -128,19 +128,31 @@ describe('Metamask', () => { cy.changeMetamaskNetwork('sepolia'); } }); - it(`rejectMetamaskPermisionToApproveAll should reject permission to approve all NFTs upon warning`, () => { + it(`rejectMetamaskPermissionToApproveAll should reject permission to approve all NFTs upon warning`, () => { cy.get('#deployNFTsButton').click(); cy.confirmMetamaskTransaction(); cy.get('#mintButton').click(); cy.confirmMetamaskTransaction(); cy.get('#setApprovalForAllButton').click(); - cy.rejectMetamaskPermisionToApproveAll().then(rejected => { + cy.rejectMetamaskPermissionToApproveAll().then(rejected => { expect(rejected).to.be.true; }); }); - it(`confirmMetamaskPermisionToApproveAll should confirm permission to approve all NFTs`, () => { + it(`confirmMetamaskPermissionToApproveAll should confirm permission to approve all NFTs`, () => { cy.get('#setApprovalForAllButton').click(); - cy.confirmMetamaskPermisionToApproveAll().then(confirmed => { + cy.confirmMetamaskPermissionToApproveAll().then(confirmed => { + expect(confirmed).to.be.true; + }); + }); + it(`rejectMetamaskRevokePermissionToAll should reject revoking permission to all NFTs`, () => { + cy.get('#revokeButton').click(); + cy.rejectMetamaskRevokePermissionToAll().then(confirmed => { + expect(confirmed).to.be.true; + }); + }); + it(`confirmMetamaskRevokePermissionToAll should confirm revoking permission to all NFTs`, () => { + cy.get('#revokeButton').click(); + cy.confirmMetamaskRevokePermissionToAll().then(confirmed => { expect(confirmed).to.be.true; }); });