declare namespace Cypress { interface Chainable { /** * Connect puppeteer with Cypress instance * @example * cy.initPuppeteer() */ initPuppeteer(): Chainable; /** * Assign currently open tabs with puppeteer * @example * cy.assignWindows() */ assignWindows(): Chainable; /** * Assigns currently active tab * @example * cy.assignActiveTabName('tabName') */ assignActiveTabName(): Chainable; /** * Checks if current active tab is metamask * @example * cy.isMetamaskWindowActive() */ isMetamaskWindowActive(): Chainable; /** * Checks if current active tab is cypress * @example * cy.isCypressWindowActive() */ isCypressWindowActive(): Chainable; /** * Switch to Cypress window * @example * cy.switchToCypressWindow() */ switchToCypressWindow(): Chainable; /** * Switch to metamask window * @example * cy.switchToMetamaskWindow() */ switchToMetamaskWindow(): Chainable; /** * Switch to metamask notification window * @example * cy.switchToMetamaskNotification() */ switchToMetamaskNotification(): Chainable; /** * Get current network * @example * cy.getNetwork() */ getNetwork(): Chainable; /** * Add network in metamask * @example * cy.addMetamaskNetwork({networkName: 'name', rpcUrl: 'https://url', chainId: '1', symbol: 'ETH', blockExplorer: 'https://url', isTestnet: true}) */ addMetamaskNetwork(network: object): Chainable; /** * Change network in metamask * @example * cy.changeMetamaskNetwork('kovan') * cy.changeMetamaskNetwork('custom network') * cy.changeMetamaskNetwork({networkName: 'name'}) */ changeMetamaskNetwork(network: string): Chainable; /** * Import new account in metamask using private key * @example * cy.importMetamaskAccount('private_key') */ importMetamaskAccount(privateKey: string): Chainable; /** * Create new account in metamask * @example * cy.createMetamaskAccount() * cy.createMetamaskAccount('accountName') */ createMetamaskAccount(accountName: string | undefined): Chainable; /** * Switch metamask account * @example * cy.switchMetamaskAccount(2) * cy.switchMetamaskAccount('Account 2') */ switchMetamaskAccount( accountNameOrAccountNumber: string | number, ): Chainable; /** * Get current wallet address of metamask wallet * @example * cy.getMetamaskWalletAddress().then(address => cy.log(address)) */ getMetamaskWalletAddress(): Chainable; /** * Activate ability (in metamask settings) to specify custom nonce while doing transactions in metamask * @example * cy.activateCustomNonceInMetamask() */ activateCustomNonceInMetamask(): Chainable; /** * Reset metamask account state in settings * @example * cy.resetMetamaskAccount() */ resetMetamaskAccount(): Chainable; /** * Disconnects metamask wallet from last connected dapp * @example * cy.disconnectMetamaskWalletFromDapp() */ disconnectMetamaskWalletFromDapp(): Chainable; /** * Disconnects metamask wallet from all connected dapps * @example * cy.disconnectMetamaskWalletFromAllDapps() */ disconnectMetamaskWalletFromAllDapps(): Chainable; /** * Confirm metamask permission to sign message * @example * cy.confirmMetamaskSignatureRequest() */ confirmMetamaskSignatureRequest(): Chainable; /** * Reject metamask permission to sign message * @example * cy.rejectMetamaskSignatureRequest() */ rejectMetamaskSignatureRequest(): Chainable; /** * Confirm metamask permission to spend asset * @example * cy.confirmMetamaskPermissionToSpend() */ confirmMetamaskPermissionToSpend(): Chainable; /** * Reject metamask permission to spend asset * @example * cy.rejectMetamaskPermissionToSpend() */ rejectMetamaskPermissionToSpend(): Chainable; /** * Accept metamask access request * @example * cy.acceptMetamaskAccess() */ acceptMetamaskAccess(): Chainable; /** * Confirm metamask atransaction * @example * cy.confirmMetamaskTransaction() * cy.confirmMetamaskTransaction({gasFee: 10, gasLimit: 1000000}) */ confirmMetamaskTransaction(gasConfig : object | undefined): Chainable; /** * Reject metamask transaction * @example * cy.rejectMetamaskTransaction() */ rejectMetamaskTransaction(): Chainable; /** * Allow site to add new network in metamask * @example * cy.allowMetamaskToAddNetwork() */ allowMetamaskToAddNetwork(): Chainable; /** * Reject site to add new network in metamask * @example * cy.rejectMetamaskToAddNetwork() */ rejectMetamaskToAddNetwork(): Chainable; /** * Allow site to switch network in metamask * @example * cy.allowMetamaskToSwitchNetwork() */ allowMetamaskToSwitchNetwork(): Chainable; /** * Reject site to switch network in metamask * @example * cy.rejectMetamaskToSwitchNetwork() */ rejectMetamaskToSwitchNetwork(): Chainable; /** * Allow site to add new network in metamask and switch to it * @example * cy.allowMetamaskToAddAndSwitchNetwork() */ allowMetamaskToAddAndSwitchNetwork(): Chainable; /** * Unlock metamask * @example * cy.unlockMetamask('password') */ unlockMetamask(password: string): Chainable; /** * Fetches previous metamask wallet address * @example * cy.fetchMetamaskWalletAddress().then(address => cy.log(address)) */ fetchMetamaskWalletAddress(): Chainable; /** * Run the flow for metamask setup * @example * cy.setupMetamask('secret, words, ...', 'kovan', 'password for metamask') * cy.setupMetamask('secret, words, ...', {networkName: 'name', rpcUrl: 'https://url', chainId: 1, symbol: 'ETH', blockExplorer: 'https://url', isTestnet: true}, 'password for metamask') * cy.setupMetamask('private_key', 'kovan', 'password for metamask') * cy.setupMetamask('private_key', {networkName: 'name', rpcUrl: 'https://url', chainId: 1, symbol: 'ETH', blockExplorer: 'https://url', isTestnet: true}, 'password for metamask') */ setupMetamask( secretWordsOrPrivateKey: string, network: string | object, password: string, ): Chainable; /** * Execute settle on Exchanger contract * @example * cy.snxExchangerSettle('sETH', '0x...', '123123123123123123...') */ snxExchangerSettle( asset: string, walletAddress: string, privateKey: string, ): Chainable; /** * Check waiting period on Exchanger contract * @example * cy.snxCheckWaitingPeriod('sETH', '0x...') */ snxCheckWaitingPeriod( asset: string, walletAddress: string, ): Chainable; /** * Get transaction status from Etherscan API * @example * cy.etherscanGetTransactionStatus('0xf..') */ etherscanGetTransactionStatus(txid: string): Chainable; /** * Wait until transaction is success using Etherscan API * @example * cy.etherscanWaitForTxSuccess('0xf..') */ etherscanWaitForTxSuccess(txid: string): Chainable; /** * Wait until all XHR requests are finished (networkidle0) * @example * cy.waitForResources() * cy.waitForResources([{name:"fa-solid-900.woff2"}]) * cy.waitForResources([{name:"fonts.gstatic.com/s/worksans",number:2}]) */ waitForResources( resources: Array<{ name: string; number?: number }> | undefined, ): Chainable; /** * Assert that element top is within viewport * @example * cy.get('selector').topIsWithinViewport() * cy.get('selector').topIsWithinViewport(800) */ topIsWithinViewport(viewportWidth: number): Chainable; /** * Assert that element is within viewport * @example * cy.get('selector').isWithinViewport() * cy.get('selector').isWithinViewport(800, 600) */ isWithinViewport( viewportWidth: number, viewportHeight: number, ): Chainable; } }