@@ -22,6 +22,8 @@ import {
2222 doNavigationClose ,
2323 waitForToast ,
2424 acceptAppNotificationAlert ,
25+ dismissBackgroundPaymentsTimedSheet ,
26+ acknowledgeReceivedPayment ,
2527} from '../helpers/actions' ;
2628import { bitcoinURL , lndConfig } from '../helpers/constants' ;
2729import { reinstallApp } from '../helpers/setup' ;
@@ -193,10 +195,13 @@ describe('@send - Send', () => {
193195 // console.info(JSON.stringify(dec, null, 2));
194196 const response = await lnd . sendPaymentSync ( { paymentRequest : receive , amt : '10000' } ) ;
195197 console . info ( { response } ) ;
196- await elementById ( 'ReceivedTransaction' ) . waitForDisplayed ( ) ;
197- await tap ( 'ReceivedTransactionButton' ) ;
198- await sleep ( 500 ) ;
199- await dismissQuickPayIntro ( ) ;
198+ await acknowledgeReceivedPayment ( ) ;
199+ if ( driver . isIOS ) {
200+ await dismissBackgroundPaymentsTimedSheet ( { triggerTimedSheet : driver . isIOS } ) ;
201+ await dismissQuickPayIntro ( { triggerTimedSheet : driver . isIOS } ) ;
202+ } else {
203+ await dismissQuickPayIntro ( ) ;
204+ }
200205
201206 const totalBalance = await elementByIdWithin ( 'TotalBalance-primary' , 'MoneyText' ) ;
202207 await expect ( totalBalance ) . toHaveText ( '110 000' ) ; // 100k onchain + 10k lightning
@@ -363,10 +368,12 @@ describe('@send - Send', () => {
363368 await sleep ( 1000 ) ;
364369 await enterAddress ( unified4 , { acceptCameraPermission : false } ) ;
365370 // max amount (lightning)
366- await expectText ( '6 000' , { strategy : 'contains' } ) ; // current balance 8k - 1k reserve balance
371+ // Android shows raw `maxSendLightningSats` (7k - 1k reserve = 6k).
372+ // iOS subtracts an estimated routing fee which includes a hardcoded 2 sat buffer (see SendAmountView.calculateRoutingFee()).
373+ await expectText ( driver . isIOS ? '5 998' : '6 000' , { strategy : 'contains' } ) ;
367374 await tap ( 'AssetButton-switch' ) ;
368375 // max amount (onchain)
369- await expectText ( '6 000' , { visible : false , strategy : 'contains' } ) ;
376+ await expectText ( driver . isIOS ? '5 998' : '6 000' , { visible : false , strategy : 'contains' } ) ;
370377 await tap ( 'AssetButton-switch' ) ;
371378 await tap ( 'N1' ) ;
372379 await multiTap ( 'N0' , 3 ) ;
@@ -391,15 +398,21 @@ describe('@send - Send', () => {
391398 // max amount (lightning)
392399 await tap ( 'AvailableAmount' ) ;
393400 await tap ( 'ContinueAmount' ) ;
394- await expectText ( '5 000' , { strategy : 'contains' } ) ;
401+ await expectText ( driver . isIOS ? '4 998' : '5 000' , { strategy : 'contains' } ) ;
395402 // expect toast about reserve balance
396403 await expectText ( 'Reserve Balance' ) ;
397404 await tap ( 'NavigationBack' ) ;
398405 // max amount (onchain)
399406 await tap ( 'AssetButton-switch' ) ;
400407 await tap ( 'AvailableAmount' ) ;
408+ if ( driver . isIOS ) {
409+ // iOS runs an autopilot coin selection step on Continue; when the amount is the true "max"
410+ // this can fail with a "Coin selection failed" toast. We only care that onchain max isn't
411+ // clamped to the Lightning max, so back off the exact-max edge case.
412+ await tap ( 'NRemove' ) ;
413+ }
401414 await tap ( 'ContinueAmount' ) ;
402- await expectText ( '5 000' , { visible : false , strategy : 'contains' } ) ;
415+ await expectText ( driver . isIOS ? '4 998' : '5 000' , { visible : false , strategy : 'contains' } ) ;
403416 await tap ( 'NavigationBack' ) ;
404417 await multiTap ( 'NRemove' , 6 ) ;
405418 await tap ( 'N1' ) ;
@@ -464,9 +477,7 @@ describe('@send - Send', () => {
464477 await swipeFullScreen ( 'down' ) ;
465478 const r = await lnd . sendPaymentSync ( { paymentRequest : receive2 , amt : '10000' } ) ;
466479 console . info ( { r } ) ;
467- await elementById ( 'ReceivedTransaction' ) . waitForDisplayed ( ) ;
468- await tap ( 'ReceivedTransactionButton' ) ;
469- await sleep ( 500 ) ;
480+ await acknowledgeReceivedPayment ( ) ;
470481 await expectTextWithin ( 'ActivitySpending' , '14 000' ) ;
471482
472483 const { paymentRequest : invoice9 } = await lnd . addInvoice ( { value : '10000' } ) ;
0 commit comments