Changeset View
Changeset View
Standalone View
Standalone View
apps/marlin-wallet/web/cypress/e2e/send.cy.ts
| // Copyright (c) 2026 The Bitcoin developers | // Copyright (c) 2026 The Bitcoin developers | ||||
| // Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
| import { | import { | ||||
| normalizeBalanceText, | normalizeBalanceText, | ||||
| selectFirmaAsset, | selectFirmaAsset, | ||||
| visitWithWalletMnemonic, | visitWithWalletMnemonic, | ||||
| waitForMainLoaded, | waitForMainLoaded, | ||||
| FIRMA_FORMATTED_TICKER, | |||||
| } from '../fixture/common'; | } from '../fixture/common'; | ||||
| import { DEFAULT_DUST_SATS } from 'ecash-lib'; | import { DEFAULT_DUST_SATS } from 'ecash-lib'; | ||||
| import { atomsToUnit } from '../../src/amount'; | import { atomsToUnit } from '../../src/amount'; | ||||
| import { FIRMA_TOKEN, XEC_ASSET } from '../../src/supported-assets'; | import { FIRMA_TOKEN, XEC_ASSET } from '../../src/supported-assets'; | ||||
| import { createBip21Uri } from '../../src/bip21'; | import { createBip21Uri } from '../../src/bip21'; | ||||
| import { | import { | ||||
| runWithChronik, | runWithChronik, | ||||
| stubChronikBroadcastsSuccess, | stubChronikBroadcastsSuccess, | ||||
| ▲ Show 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | describe('BIP21 URI pasted into recipient field', () => { | ||||
| runWithChronik(CHRONIK_STUB, () => { | runWithChronik(CHRONIK_STUB, () => { | ||||
| visitWithWalletMnemonic(TEST_MNEMONIC, { | visitWithWalletMnemonic(TEST_MNEMONIC, { | ||||
| requireHoldToSend: false, | requireHoldToSend: false, | ||||
| }); | }); | ||||
| waitForMainLoaded(); | waitForMainLoaded(); | ||||
| selectFirmaAsset(); | selectFirmaAsset(); | ||||
| openManualSendScreen(); | openManualSendScreen(); | ||||
| cy.get('#ticker-label').should('contain', 'FIRMA'); | cy.get('#ticker-label').should('contain', 'Firma α'); | ||||
| pasteBip21UriIntoRecipient(uri); | pasteBip21UriIntoRecipient(uri); | ||||
| cy.get('#ticker-label').should('contain', 'XEC'); | cy.get('#ticker-label').should('contain', 'XEC'); | ||||
| cy.get('#recipient-address') | cy.get('#recipient-address') | ||||
| .should('have.value', WALLET_ADDRESS) | .should('have.value', WALLET_ADDRESS) | ||||
| .and('have.attr', 'readonly'); | .and('have.attr', 'readonly'); | ||||
| cy.get('#recipient-address').should('have.class', 'valid'); | cy.get('#recipient-address').should('have.class', 'valid'); | ||||
| cy.get('#send-amount') | cy.get('#send-amount') | ||||
| .should('have.value', '100.00') | .should('have.value', '100.00') | ||||
| Show All 14 Lines | describe('BIP21 URI pasted into recipient field', () => { | ||||
| openManualSendScreen(); | openManualSendScreen(); | ||||
| cy.get('#ticker-label').should('contain', 'XEC'); | cy.get('#ticker-label').should('contain', 'XEC'); | ||||
| pasteBip21UriIntoRecipient(uri); | pasteBip21UriIntoRecipient(uri); | ||||
| cy.get('#recipient-address') | cy.get('#recipient-address') | ||||
| .should('have.value', WALLET_ADDRESS) | .should('have.value', WALLET_ADDRESS) | ||||
| .and('have.attr', 'readonly'); | .and('have.attr', 'readonly'); | ||||
| cy.get('#recipient-address').should('have.class', 'valid'); | cy.get('#recipient-address').should('have.class', 'valid'); | ||||
| cy.get('#ticker-label').should('contain', 'FIRMA'); | cy.get('#ticker-label').should('contain', 'Firma α'); | ||||
| cy.get('#send-amount') | cy.get('#send-amount') | ||||
| .should('have.value', tokenQty) | .should('have.value', tokenQty) | ||||
| .and('have.attr', 'readonly'); | .and('have.attr', 'readonly'); | ||||
| cy.get('#amount-slider').should('be.disabled'); | cy.get('#amount-slider').should('be.disabled'); | ||||
| cy.get('#fee-display').should('be.visible'); | cy.get('#fee-display').should('be.visible'); | ||||
| }); | }); | ||||
| }); | }); | ||||
| it('switches to Firma without locking amount when token_decimalized_qty is omitted', () => { | it('switches to Firma without locking amount when token_decimalized_qty is omitted', () => { | ||||
| const uri = firmaTokenBip21Uri(WALLET_ADDRESS); | const uri = firmaTokenBip21Uri(WALLET_ADDRESS); | ||||
| runWithChronik(CHRONIK_STUB, () => { | runWithChronik(CHRONIK_STUB, () => { | ||||
| visitWithWalletMnemonic(TEST_MNEMONIC, { | visitWithWalletMnemonic(TEST_MNEMONIC, { | ||||
| requireHoldToSend: false, | requireHoldToSend: false, | ||||
| }); | }); | ||||
| waitForMainLoaded(); | waitForMainLoaded(); | ||||
| openManualSendScreen(); | openManualSendScreen(); | ||||
| cy.get('#ticker-label').should('contain', 'XEC'); | cy.get('#ticker-label').should('contain', 'XEC'); | ||||
| pasteBip21UriIntoRecipient(uri); | pasteBip21UriIntoRecipient(uri); | ||||
| cy.get('#recipient-address') | cy.get('#recipient-address') | ||||
| .should('have.value', WALLET_ADDRESS) | .should('have.value', WALLET_ADDRESS) | ||||
| .and('have.attr', 'readonly'); | .and('have.attr', 'readonly'); | ||||
| cy.get('#recipient-address').should('have.class', 'valid'); | cy.get('#recipient-address').should('have.class', 'valid'); | ||||
| cy.get('#ticker-label').should('contain', 'FIRMA'); | cy.get('#ticker-label').should('contain', 'Firma α'); | ||||
| cy.get('#send-amount').should( | cy.get('#send-amount').should( | ||||
| 'have.value', | 'have.value', | ||||
| MIN_FIRMA_SLIDER_PRIMARY.toFixed(FIRMA_TOKEN.decimals), | MIN_FIRMA_SLIDER_PRIMARY.toFixed(FIRMA_TOKEN.decimals), | ||||
| ); | ); | ||||
| cy.get('#send-amount').should('not.have.attr', 'readonly'); | cy.get('#send-amount').should('not.have.attr', 'readonly'); | ||||
| cy.get('#amount-slider').should('not.be.disabled'); | cy.get('#amount-slider').should('not.be.disabled'); | ||||
| cy.get('#fee-display').should('be.visible'); | cy.get('#fee-display').should('be.visible'); | ||||
| }); | }); | ||||
| }); | }); | ||||
| it('switches to Firma without locking amount when token_decimalized_qty has too many decimals', () => { | it('switches to Firma without locking amount when token_decimalized_qty has too many decimals', () => { | ||||
| const uri = firmaTokenBip21Uri(WALLET_ADDRESS, '1.23456'); | const uri = firmaTokenBip21Uri(WALLET_ADDRESS, '1.23456'); | ||||
| runWithChronik(CHRONIK_STUB, () => { | runWithChronik(CHRONIK_STUB, () => { | ||||
| visitWithWalletMnemonic(TEST_MNEMONIC, { | visitWithWalletMnemonic(TEST_MNEMONIC, { | ||||
| requireHoldToSend: false, | requireHoldToSend: false, | ||||
| }); | }); | ||||
| waitForMainLoaded(); | waitForMainLoaded(); | ||||
| openManualSendScreen(); | openManualSendScreen(); | ||||
| cy.get('#ticker-label').should('contain', 'XEC'); | cy.get('#ticker-label').should('contain', 'XEC'); | ||||
| pasteBip21UriIntoRecipient(uri); | pasteBip21UriIntoRecipient(uri); | ||||
| cy.get('#recipient-address') | cy.get('#recipient-address') | ||||
| .should('have.value', WALLET_ADDRESS) | .should('have.value', WALLET_ADDRESS) | ||||
| .and('have.attr', 'readonly'); | .and('have.attr', 'readonly'); | ||||
| cy.get('#ticker-label').should('contain', 'FIRMA'); | cy.get('#ticker-label').should('contain', 'Firma α'); | ||||
| cy.get('#send-amount').should( | cy.get('#send-amount').should( | ||||
| 'have.value', | 'have.value', | ||||
| MIN_FIRMA_SLIDER_PRIMARY.toFixed(FIRMA_TOKEN.decimals), | MIN_FIRMA_SLIDER_PRIMARY.toFixed(FIRMA_TOKEN.decimals), | ||||
| ); | ); | ||||
| cy.get('#send-amount').should('not.have.attr', 'readonly'); | cy.get('#send-amount').should('not.have.attr', 'readonly'); | ||||
| cy.get('#amount-slider').should('not.be.disabled'); | cy.get('#amount-slider').should('not.be.disabled'); | ||||
| }); | }); | ||||
| }); | }); | ||||
| ▲ Show 20 Lines • Show All 658 Lines • ▼ Show 20 Lines | it('sends max Firma to self', () => { | ||||
| requireHoldToSend: false, | requireHoldToSend: false, | ||||
| }); | }); | ||||
| waitForMainLoaded(); | waitForMainLoaded(); | ||||
| selectFirmaAsset(); | selectFirmaAsset(); | ||||
| cy.get('#primary-balance').should($el => { | cy.get('#primary-balance').should($el => { | ||||
| expect(normalizeBalanceText($el.text())).to.equal( | expect(normalizeBalanceText($el.text())).to.equal( | ||||
| '0.5000 FIRMA', | `0.5000 ${FIRMA_FORMATTED_TICKER}`, | ||||
| ); | ); | ||||
| }); | }); | ||||
| openManualSendScreen(); | openManualSendScreen(); | ||||
| fillRecipientAndMaxSlider(); | fillRecipientAndMaxSlider(); | ||||
| cy.get('#ticker-label').should('contain', 'FIRMA'); | cy.get('#ticker-label').should('contain', 'Firma α'); | ||||
| cy.get('#send-amount').should('have.attr', 'step', '0.0001'); | cy.get('#send-amount').should('have.attr', 'step', '0.0001'); | ||||
| cy.get('#fee-display') | cy.get('#fee-display') | ||||
| .should('be.visible') | .should('be.visible') | ||||
| .and('not.have.class', 'error'); | .and('not.have.class', 'error'); | ||||
| cy.get('#fee-display .fee-item.title').should( | cy.get('#fee-display .fee-item.title').should( | ||||
| 'contain', | 'contain', | ||||
| 'Transaction Details', | 'Transaction Details', | ||||
| ▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines | |||||