From f82adeaf8313223ba80f22357776af84095fbe02 Mon Sep 17 00:00:00 2001 From: Rafal2228 Date: Tue, 17 Oct 2023 14:21:40 +0200 Subject: [PATCH 1/4] Fix typo in Permission word --- commands/metamask.js | 4 ++-- docs/synpress-commands.md | 30 ++++++++++++++++++------------ plugins/index.js | 5 +++-- support/commands.js | 8 ++++---- support/index.d.ts | 22 +++++++++++----------- tests/e2e/specs/metamask-spec.js | 8 ++++---- 6 files changed, 42 insertions(+), 35 deletions(-) diff --git a/commands/metamask.js b/commands/metamask.js index 3b796c48f..c6ac6c517 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, diff --git a/docs/synpress-commands.md b/docs/synpress-commands.md index 408d800aa..b96878732 100644 --- a/docs/synpress-commands.md +++ b/docs/synpress-commands.md @@ -132,7 +132,8 @@ 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( @@ -142,7 +143,8 @@ activateAdvancedGasControlInMetamask( #### `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; @@ -150,7 +152,8 @@ 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( @@ -170,7 +173,8 @@ activateShowTestnetNetworksInMetamask( #### `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; @@ -178,7 +182,8 @@ 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( @@ -324,20 +329,20 @@ Confirm metamask permission to spend asset. 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.rejectMetamaskPermissionToSpend()` @@ -370,7 +375,8 @@ confirmMetamaskTransaction(gasConfig?: object | string): Chainable; #### `cy.confirmMetamaskTransactionAndWaitForMining()` -Confirm metamask transaction (auto-detects eip-1559 and legacy transactions) and wait for ALL pending transactions to be mined. +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; @@ -386,7 +392,8 @@ 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; @@ -514,4 +521,3 @@ isWithinViewport( viewportHeight: number, ): Chainable; ``` - diff --git a/plugins/index.js b/plugins/index.js index 51fe4965b..6d24f0dd3 100644 --- a/plugins/index.js +++ b/plugins/index.js @@ -103,8 +103,9 @@ 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, acceptMetamaskAccess: metamask.acceptAccess, rejectMetamaskAccess: metamask.rejectAccess, confirmMetamaskTransaction: metamask.confirmTransaction, diff --git a/support/commands.js b/support/commands.js index 73869e3fc..8c3fc8590 100644 --- a/support/commands.js +++ b/support/commands.js @@ -215,12 +215,12 @@ 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('allowMetamaskToAddNetwork', waitForEvent => { diff --git a/support/index.d.ts b/support/index.d.ts index 804e32d54..c699e4e54 100644 --- a/support/index.d.ts +++ b/support/index.d.ts @@ -278,15 +278,15 @@ 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; /** * Reject metamask permission to spend asset * @example @@ -345,14 +345,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..5e11ab0d7 100644 --- a/tests/e2e/specs/metamask-spec.js +++ b/tests/e2e/specs/metamask-spec.js @@ -128,19 +128,19 @@ 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; }); }); From 5fc3d5eb0fc17e8c4915ea84fa66d7f2afe00739 Mon Sep 17 00:00:00 2001 From: Rafal2228 Date: Tue, 17 Oct 2023 16:38:23 +0200 Subject: [PATCH 2/4] Add permission revoking actions --- commands/metamask.js | 18 ++++++++++++++++++ plugins/index.js | 2 ++ support/commands.js | 8 ++++++++ support/index.d.ts | 12 ++++++++++++ 4 files changed, 40 insertions(+) diff --git a/commands/metamask.js b/commands/metamask.js index c6ac6c517..5e6e726e7 100644 --- a/commands/metamask.js +++ b/commands/metamask.js @@ -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/plugins/index.js b/plugins/index.js index 6d24f0dd3..c41090ed6 100644 --- a/plugins/index.js +++ b/plugins/index.js @@ -106,6 +106,8 @@ module.exports = (on, config) => { 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 8c3fc8590..282ab8b3e 100644 --- a/support/commands.js +++ b/support/commands.js @@ -223,6 +223,14 @@ 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 => { return cy.task('allowMetamaskToAddNetwork', { waitForEvent }); }); diff --git a/support/index.d.ts b/support/index.d.ts index c699e4e54..fb5bbb3e1 100644 --- a/support/index.d.ts +++ b/support/index.d.ts @@ -287,6 +287,18 @@ declare namespace Cypress { * cy.rejectMetamaskPermissionToApproveAll() */ 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 From 9410680c4c9052736058f111d46f7020b93a2614 Mon Sep 17 00:00:00 2001 From: Rafal2228 Date: Tue, 17 Oct 2023 16:38:33 +0200 Subject: [PATCH 3/4] Add tests for permission revoking actions --- tests/e2e/specs/metamask-spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/e2e/specs/metamask-spec.js b/tests/e2e/specs/metamask-spec.js index 5e11ab0d7..4cbdcf635 100644 --- a/tests/e2e/specs/metamask-spec.js +++ b/tests/e2e/specs/metamask-spec.js @@ -144,6 +144,18 @@ describe('Metamask', () => { 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; + }); + }); it(`importMetamaskAccount should import new account using private key`, () => { cy.importMetamaskAccount( '0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6', From ab416f6a968771ae6c1f0d0c2f140fa5558d1f0d Mon Sep 17 00:00:00 2001 From: Rafal2228 Date: Tue, 17 Oct 2023 16:38:49 +0200 Subject: [PATCH 4/4] Regenerate synpress commands file --- docs/synpress-commands.md | 197 +++++++++++++++++++++++++++----------- 1 file changed, 140 insertions(+), 57 deletions(-) diff --git a/docs/synpress-commands.md b/docs/synpress-commands.md index b96878732..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,7 +138,7 @@ switchMetamaskAccount( Get current wallet address of metamask wallet. ```ts -getMetamaskWalletAddress(): Chainable; +getMetamaskWalletAddress(): Chainable; ``` #### `cy.activateAdvancedGasControlInMetamask()` @@ -138,7 +149,7 @@ while doing transactions in metamask. ```ts activateAdvancedGasControlInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.activateShowHexDataInMetamask()` @@ -147,7 +158,7 @@ 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()` @@ -158,7 +169,7 @@ metamask. ```ts activateTestnetConversionInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.activateShowTestnetNetworksInMetamask()` @@ -168,7 +179,7 @@ Activate ability (in metamask settings) to show testnet networks in metamask. ```ts activateShowTestnetNetworksInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.activateCustomNonceInMetamask()` @@ -177,7 +188,7 @@ 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()` @@ -188,7 +199,7 @@ reminder in metamask. ```ts activateDismissBackupReminderInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.activateEthSignRequestsInMetamask()` @@ -196,7 +207,7 @@ activateDismissBackupReminderInMetamask( Activate eth sign requests in metamask settings. ```ts -activateEthSignRequestsInMetamask(skipSetup?: boolean): Chainable; +activateEthSignRequestsInMetamask(skipSetup?: boolean): Chainable; ``` #### `cy.activateImprovedTokenAllowanceInMetamask()` @@ -206,7 +217,7 @@ Activate improved token allowance in metamask settings (experimental). ```ts activateImprovedTokenAllowanceInMetamask( skipSetup?: boolean, -): Chainable; +): Chainable; ``` #### `cy.resetMetamaskAccount()` @@ -214,7 +225,7 @@ activateImprovedTokenAllowanceInMetamask( Reset metamask account state in settings. ```ts -resetMetamaskAccount(): Chainable; +resetMetamaskAccount(): Chainable; ``` #### `cy.disconnectMetamaskWalletFromDapp()` @@ -222,7 +233,7 @@ resetMetamaskAccount(): Chainable; Disconnects metamask wallet from last connected dapp. ```ts -disconnectMetamaskWalletFromDapp(): Chainable; +disconnectMetamaskWalletFromDapp(): Chainable; ``` #### `cy.disconnectMetamaskWalletFromAllDapps()` @@ -230,7 +241,7 @@ disconnectMetamaskWalletFromDapp(): Chainable; Disconnects metamask wallet from all connected dapps. ```ts -disconnectMetamaskWalletFromAllDapps(): Chainable; +disconnectMetamaskWalletFromAllDapps(): Chainable; ``` #### `cy.confirmMetamaskSignatureRequest()` @@ -238,7 +249,7 @@ disconnectMetamaskWalletFromAllDapps(): Chainable; Confirm metamask permission to sign message. ```ts -confirmMetamaskSignatureRequest(): Chainable; +confirmMetamaskSignatureRequest(): Chainable; ``` #### `cy.confirmMetamaskDataSignatureRequest()` @@ -246,7 +257,7 @@ confirmMetamaskSignatureRequest(): Chainable; Confirm metamask permission to sign Data message. ```ts -confirmMetamaskDataSignatureRequest(): Chainable; +confirmMetamaskDataSignatureRequest(): Chainable; ``` #### `cy.rejectMetamaskSignatureRequest()` @@ -254,7 +265,7 @@ confirmMetamaskDataSignatureRequest(): Chainable; Reject metamask permission to sign message. ```ts -rejectMetamaskSignatureRequest(): Chainable; +rejectMetamaskSignatureRequest(): Chainable; ``` #### `cy.confirmMetamaskEncryptionPublicKeyRequest()` @@ -262,7 +273,7 @@ rejectMetamaskSignatureRequest(): Chainable; Confirm metamask request for public encryption key. ```ts -confirmMetamaskEncryptionPublicKeyRequest(): Chainable; +confirmMetamaskEncryptionPublicKeyRequest(): Chainable; ``` #### `cy.rejectMetamaskEncryptionPublicKeyRequest()` @@ -270,7 +281,7 @@ confirmMetamaskEncryptionPublicKeyRequest(): Chainable; Reject metamask request for public encryption key. ```ts -rejectMetamaskEncryptionPublicKeyRequest(): Chainable; +rejectMetamaskEncryptionPublicKeyRequest(): Chainable; ``` #### `cy.confirmMetamaskDecryptionRequest()` @@ -278,7 +289,7 @@ rejectMetamaskEncryptionPublicKeyRequest(): Chainable; Confirm metamask request to decrypt message with private key. ```ts -confirmMetamaskDecryptionRequest(): Chainable; +confirmMetamaskDecryptionRequest(): Chainable; ``` #### `cy.rejectMetamaskDecryptionRequest()` @@ -286,7 +297,7 @@ confirmMetamaskDecryptionRequest(): Chainable; Reject metamask request to decrypt message with private key. ```ts -rejectMetamaskDecryptionRequest(): Chainable; +rejectMetamaskDecryptionRequest(): Chainable; ``` #### `cy.rejectMetamaskDataSignatureRequest()` @@ -294,7 +305,7 @@ rejectMetamaskDecryptionRequest(): Chainable; Reject metamask permission to sign Data message. ```ts -rejectMetamaskDataSignatureRequest(): Chainable; +rejectMetamaskDataSignatureRequest(): Chainable; ``` #### `cy.importMetamaskToken()` @@ -302,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()` @@ -310,7 +328,7 @@ importMetamaskToken(tokenConfig?: object | string): Chainable; Confirm metamask request to add token. ```ts -confirmMetamaskAddToken(): Chainable; +confirmMetamaskAddToken(): Chainable; ``` #### `cy.rejectMetamaskAddToken()` @@ -318,7 +336,7 @@ confirmMetamaskAddToken(): Chainable; Reject metamask request to add token. ```ts -rejectMetamaskAddToken(): Chainable; +rejectMetamaskAddToken(): Chainable; ``` #### `cy.confirmMetamaskPermissionToSpend()` @@ -326,7 +344,7 @@ rejectMetamaskAddToken(): Chainable; Confirm metamask permission to spend asset. ```ts -confirmMetamaskPermissionToSpend(spendLimit?: string): Chainable; +confirmMetamaskPermissionToSpend(spendLimit?: string): Chainable; ``` #### `cy.confirmMetamaskPermissionToApproveAll()` @@ -334,7 +352,7 @@ confirmMetamaskPermissionToSpend(spendLimit?: string): Chainable; Confirm metamask permission to access all elements (example: collectibles). ```ts -confirmMetamaskPermissionToApproveAll(): Chainable; +confirmMetamaskPermissionToApproveAll(): Chainable; ``` #### `cy.rejectMetamaskPermissionToApproveAll()` @@ -342,7 +360,25 @@ confirmMetamaskPermissionToApproveAll(): Chainable; Reject metamask permission to access all elements (example: collectibles). ```ts -rejectMetamaskPermissionToApproveAll(): 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()` @@ -350,7 +386,7 @@ rejectMetamaskPermissionToApproveAll(): Chainable; Reject metamask permission to spend asset. ```ts -rejectMetamaskPermissionToSpend(): Chainable; +rejectMetamaskPermissionToSpend(): Chainable; ``` #### `cy.acceptMetamaskAccess()` @@ -362,7 +398,15 @@ acceptMetamaskAccess(options?: { allAccounts?: boolean; confirmSignatureRequest?: boolean; confirmDataSignatureRequest?: boolean; -}): Chainable; +}): Chainable; +``` + +#### `cy.rejectMetamaskAccess()` + +Reject metamask access request. + +```ts +rejectMetamaskAccess(): Chainable; ``` #### `cy.confirmMetamaskTransaction()` @@ -370,7 +414,22 @@ 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()` @@ -379,7 +438,22 @@ 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; +confirmMetamaskTransactionAndWaitForMining( + gasConfig?: + | { + gasLimit?: number; + baseFee?: number; + priorityFee?: number; + } + | { + gasLimit?: number; + gasPrice?: number; + } + | 'low' + | 'market' + | 'aggressive' + | 'site', +): Chainable; ``` #### `cy.rejectMetamaskTransaction()` @@ -387,7 +461,7 @@ confirmMetamaskTransactionAndWaitForMining(gasConfig?: object | string): Chainab Reject metamask transaction. ```ts -rejectMetamaskTransaction(): Chainable; +rejectMetamaskTransaction(): Chainable; ``` #### `cy.openMetamaskTransactionDetails()` @@ -401,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()` @@ -412,7 +486,7 @@ closeMetamaskTransactionDetailsPopup(): Chainable; Allow site to add new network in metamask. ```ts -allowMetamaskToAddNetwork(waitForEvent?: string): Chainable; +allowMetamaskToAddNetwork(waitForEvent?: string): Chainable; ``` #### `cy.rejectMetamaskToAddNetwork()` @@ -420,7 +494,7 @@ allowMetamaskToAddNetwork(waitForEvent?: string): Chainable; Reject site to add new network in metamask. ```ts -rejectMetamaskToAddNetwork(): Chainable; +rejectMetamaskToAddNetwork(): Chainable; ``` #### `cy.allowMetamaskToSwitchNetwork()` @@ -428,7 +502,7 @@ rejectMetamaskToAddNetwork(): Chainable; Allow site to switch network in metamask. ```ts -allowMetamaskToSwitchNetwork(): Chainable; +allowMetamaskToSwitchNetwork(): Chainable; ``` #### `cy.rejectMetamaskToSwitchNetwork()` @@ -436,7 +510,7 @@ allowMetamaskToSwitchNetwork(): Chainable; Reject site to switch network in metamask. ```ts -rejectMetamaskToSwitchNetwork(): Chainable; +rejectMetamaskToSwitchNetwork(): Chainable; ``` #### `cy.allowMetamaskToAddAndSwitchNetwork()` @@ -444,7 +518,7 @@ rejectMetamaskToSwitchNetwork(): Chainable; Allow site to add new network in metamask and switch to it. ```ts -allowMetamaskToAddAndSwitchNetwork(): Chainable; +allowMetamaskToAddAndSwitchNetwork(): Chainable; ``` #### `cy.unlockMetamask()` @@ -452,7 +526,7 @@ allowMetamaskToAddAndSwitchNetwork(): Chainable; Unlock metamask. ```ts -unlockMetamask(password: string): Chainable; +unlockMetamask(password: string): Chainable; ``` #### `cy.fetchMetamaskWalletAddress()` @@ -460,7 +534,7 @@ unlockMetamask(password: string): Chainable; Fetches previous metamask wallet address. ```ts -fetchMetamaskWalletAddress(): Chainable; +fetchMetamaskWalletAddress(): Chainable; ``` #### `cy.setupMetamask()` @@ -470,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, @@ -490,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()`