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()`