From 22a023ed12d87670db2c781f9efeb22f0fdeb856 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 15 Jan 2026 22:40:33 +0100 Subject: [PATCH 1/3] adjust numberpad --- test/specs/numberpad.e2e.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/specs/numberpad.e2e.ts b/test/specs/numberpad.e2e.ts index 2f09ef7..ad9d917 100644 --- a/test/specs/numberpad.e2e.ts +++ b/test/specs/numberpad.e2e.ts @@ -1,3 +1,4 @@ +import BitcoinJsonRpc from 'bitcoin-json-rpc'; import { completeOnboarding, enterAddress, @@ -8,14 +9,30 @@ import { tap, doNavigationClose, expectTextWithin, + receiveOnchainFunds, + elementById, } from '../helpers/actions'; +import initElectrum from '../helpers/electrum'; import { launchFreshApp, reinstallApp } from '../helpers/setup'; import { ciIt } from '../helpers/suite'; +import { bitcoinURL } from '../helpers/constants'; describe('@numberpad - NumberPad', () => { + let electrum: Awaited> | undefined; + const rpc = new BitcoinJsonRpc(bitcoinURL); before(async () => { + let balance = await rpc.getBalance(); + const address = await rpc.getNewAddress(); + + while (balance < 10) { + await rpc.generateToAddress(10, address); + balance = await rpc.getBalance(); + } + + electrum = await initElectrum(); await reinstallApp(); await completeOnboarding(); + await receiveOnchainFunds(rpc, { sats: 10_000 }); }); beforeEach(async () => { @@ -74,9 +91,12 @@ async function modernDenominationChecks(mode: NumberpadMode) { await tap('N000'); await expectText('123 000'); + await checkContinueButton(mode, { aboveBalance: true }); // Switch to USD await tap(`${mode}NumberPadUnit`); + await checkContinueButton(mode, { aboveBalance: true }); + // reset to 0 await multiTap('NRemove', 8); if (mode === 'Send') { @@ -94,6 +114,7 @@ async function modernDenominationChecks(mode: NumberpadMode) { await tap('NDecimal'); await tap('N1'); await expectText('1.01'); + await checkContinueButton(mode, { aboveBalance: false }); // Switch back to BTC await tap(`${mode}NumberPadUnit`); @@ -134,6 +155,21 @@ async function classicDenominationChecks(mode: NumberpadMode) { // still there await expectText('4.20690000'); + await checkContinueButton(mode); +} + +async function checkContinueButton( + mode: NumberpadMode, + { aboveBalance = true }: { aboveBalance?: boolean } = {} +) { + if (mode === 'Send') { + // make sure Continue button is disabled as amount is above balance + if (driver.isAndroid) return; // https://github.com/synonymdev/bitkit-android/issues/611 + await elementById('ContinueAmount').waitForEnabled({ reverse: aboveBalance }); + } else { + // In receive mode Continue is always enabled + await elementById('ReceiveNumberPadSubmit').waitForEnabled(); + } } async function makeSureIsBitcoinInput(mode: NumberpadMode) { From efd3bc1fd4c7ac14fc7d51aefc5cae55560e5d04 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 16 Jan 2026 22:57:19 +0100 Subject: [PATCH 2/3] verify toasts --- test/helpers/actions.ts | 6 +++++- test/specs/send.e2e.ts | 41 +++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts index 09c9fe6..e7a7eff 100644 --- a/test/helpers/actions.ts +++ b/test/helpers/actions.ts @@ -696,7 +696,11 @@ export type ToastId = | 'ReceivedTransactionReplacedToast' | 'TransactionReplacedToast' | 'TransactionUnconfirmedToast' - | 'TransactionRemovedToast'; + | 'TransactionRemovedToast' + | 'InvalidAddressToast' + | 'ExpiredLightningToast' + | 'InsufficientSpendingToast' + | 'InsufficientSavingsToast'; export async function waitForToast( toastId: ToastId, diff --git a/test/specs/send.e2e.ts b/test/specs/send.e2e.ts index f7bbb27..17d2e5c 100644 --- a/test/specs/send.e2e.ts +++ b/test/specs/send.e2e.ts @@ -75,24 +75,24 @@ describe('@send - Send', () => { // check validation for invalid data await typeAddressAndVerifyContinue({ address: 'test123', reverse: true }); + await waitForToast('InvalidAddressToast'); - //--- skip due to: https://github.com/synonymdev/bitkit-android/issues/354 ---// + // check validation for invalid address (network mismatch) + const mainnetAddress = 'bc1qnc8at2e2navahnz7lvtl39r4dnfzxv3cc9e7ax'; + await typeAddressAndVerifyContinue({ address: mainnetAddress, reverse: true }); + await waitForToast('InvalidAddressToast'); - // // check validation for invalid address (network mismatch) - // const mainnetAddress = 'bc1qnc8at2e2navahnz7lvtl39r4dnfzxv3cc9e7ax'; - // await typeAddressAndVerifyContinue({ address: mainnetAddress, reverse: true }) - - // // check validation for address when balance is 0 - // const address = await rpc.getNewAddress(); - // console.info({ address }); - // await typeAddressAndVerifyContinue({ address: address, reverse: true }) - - // // check validation for expired invoice - // const invoice = - // 'lnbcrt1pn3zpqpdqqnp4qfh2x8nyvvzq4kf8j9wcaau2chr580l93pnyrh5027l8f7qtm48h6pp5lmwkulnpze4ek4zqwfepguahcr2ma3vfhwa6uepxfd378xlldprssp5wnq34d553g50suuvfy387csx5hx6mdv8zezem6f4tky7rhezycas9qyysgqcqpcxqrrssrzjqtr7pzpunxgwjddwdqucegdphm6776xcarz60gw9gxva0rhal5ntmapyqqqqqqqqpqqqqqlgqqqqqqgq2ql9zpeakxvff9cz5rd6ssc3cngl256u8htm860qv3r28vqkwy9xe3wp0l9ms3zcqvys95yf3r34ytmegz6zynuthh5s0kh7cueunm3mspg3uwpt'; - // await typeAddressAndVerifyContinue({ address: invoice, reverse: true }) + // check validation for address when balance is 0 + const address = await rpc.getNewAddress(); + console.info({ address }); + await typeAddressAndVerifyContinue({ address: address, reverse: true }); + await waitForToast('InsufficientSavingsToast'); - //--- skip due to: https://github.com/synonymdev/bitkit-android/issues/354 ---// + // check validation for expired invoice + const invoice = + 'lnbcrt1pn3zpqpdqqnp4qfh2x8nyvvzq4kf8j9wcaau2chr580l93pnyrh5027l8f7qtm48h6pp5lmwkulnpze4ek4zqwfepguahcr2ma3vfhwa6uepxfd378xlldprssp5wnq34d553g50suuvfy387csx5hx6mdv8zezem6f4tky7rhezycas9qyysgqcqpcxqrrssrzjqtr7pzpunxgwjddwdqucegdphm6776xcarz60gw9gxva0rhal5ntmapyqqqqqqqqpqqqqqlgqqqqqqgq2ql9zpeakxvff9cz5rd6ssc3cngl256u8htm860qv3r28vqkwy9xe3wp0l9ms3zcqvys95yf3r34ytmegz6zynuthh5s0kh7cueunm3mspg3uwpt'; + await typeAddressAndVerifyContinue({ address: invoice, reverse: true }); + await waitForToast('ExpiredLightningToast'); // Receive funds and check validation w/ balance await swipeFullScreen('down'); @@ -120,13 +120,10 @@ describe('@send - Send', () => { await typeAddressAndVerifyContinue({ address: unified1 }); } - //--- skip due to: https://github.com/synonymdev/bitkit-android/issues/354 ---// - - // // check validation for unified invoice when balance is too low - // const unified2 = 'bitcoin:bcrt1q07x3wl76zdxvdsz3qzzkvxrjg3n6t4tz2vnsx8?amount=0.002'; - // await typeAddressAndVerifyContinue({ address: unified2, reverse: true }); - - //--- skip due to: https://github.com/synonymdev/bitkit-android/issues/354 ---// + // check validation for unified invoice when balance is too low + const unified2 = 'bitcoin:bcrt1q07x3wl76zdxvdsz3qzzkvxrjg3n6t4tz2vnsx8?amount=0.002'; + await typeAddressAndVerifyContinue({ address: unified2, reverse: true }); + await waitForToast('InsufficientSavingsToast'); }); ciIt('@send_2 - Can receive funds and send to different invoices', async () => { From a9cae8a704149bb409492a8f1f770199abd40f09 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Sat, 17 Jan 2026 11:52:14 +0100 Subject: [PATCH 3/3] add sleep --- test/specs/send.e2e.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/specs/send.e2e.ts b/test/specs/send.e2e.ts index 17d2e5c..3f11521 100644 --- a/test/specs/send.e2e.ts +++ b/test/specs/send.e2e.ts @@ -68,6 +68,7 @@ describe('@send - Send', () => { ciIt('@send_1 - Validates payment data in the manual input', async () => { await tap('Send'); await handleAndroidAlert('permission_allow_foreground_only_button'); + await sleep(5000); await tap('RecipientManual'); // check validation for empty address