@@ -544,4 +544,77 @@ describe('@send - Send', () => {
544544 await elementById ( 'Activity-1' ) . waitForDisplayed ( ) ;
545545 await elementById ( 'Activity-2' ) . waitForDisplayed ( ) ;
546546 } ) ;
547+
548+ ciIt ( '@send_3 - Can pay regular invoices with msat precision' , async ( ) => {
549+ await receiveOnchainFunds ( ) ;
550+
551+ // send funds to LND node and open a channel
552+ const { lnd, lndNodeID } = await setupLND ( rpc , lndConfig ) ;
553+ await electrum ?. waitForSync ( ) ;
554+
555+ // get LDK Node id
556+ const ldkNodeId = await getLDKNodeID ( ) ;
557+
558+ // connect to LND
559+ await connectToLND ( lndNodeID ) ;
560+
561+ // wait for peer to be connected
562+ await waitForPeerConnection ( lnd , ldkNodeId ) ;
563+
564+ // open a channel and wait until active
565+ await openLNDAndSync ( lnd , rpc , ldkNodeId ) ;
566+ await electrum ?. waitForSync ( ) ;
567+ await waitForActiveChannel ( lnd , ldkNodeId ) ;
568+
569+ await waitForToast ( 'SpendingBalanceReadyToast' ) ;
570+
571+ // Ensure spending balance by paying ourselves from LND.
572+ let receive : string ;
573+ try {
574+ receive = await getReceiveAddress ( 'lightning' ) ;
575+ } catch {
576+ await swipeFullScreen ( 'down' ) ;
577+ await sleep ( 10_000 ) ;
578+ await attemptRefreshOnHomeScreen ( ) ;
579+ await sleep ( 10_000 ) ;
580+ await attemptRefreshOnHomeScreen ( ) ;
581+ await sleep ( 1000 ) ;
582+ receive = await getReceiveAddress ( 'lightning' ) ;
583+ }
584+ if ( ! receive ) throw new Error ( 'No lightning invoice received' ) ;
585+ await swipeFullScreen ( 'down' ) ;
586+ await lnd . sendPaymentSync ( { paymentRequest : receive , amt : '10000' } ) ;
587+ await acknowledgeReceivedPayment ( ) ;
588+ if ( driver . isIOS ) {
589+ await dismissBackgroundPaymentsTimedSheet ( { triggerTimedSheet : driver . isIOS } ) ;
590+ await dismissQuickPayIntro ( { triggerTimedSheet : driver . isIOS } ) ;
591+ } else {
592+ await dismissQuickPayIntro ( { triggerTimedSheet : true } ) ;
593+ }
594+ await expectTextWithin ( 'ActivitySpending' , '10 000' ) ;
595+
596+ async function payMsatInvoice ( valueMsat : string , acceptCameraPermission : boolean ) {
597+ const { paymentRequest } = await lnd . addInvoice ( { valueMsat } ) ;
598+ console . info ( { valueMsat, paymentRequest } ) ;
599+ await sleep ( 1000 ) ;
600+ await enterAddress ( paymentRequest , { acceptCameraPermission } ) ;
601+ await elementById ( 'ReviewAmount-primary' ) . waitForDisplayed ( { timeout : 15_000 } ) ;
602+ await dragOnElement ( 'GRAB' , 'right' , 0.95 ) ;
603+ await elementById ( 'SendSuccess' ) . waitForDisplayed ( ) ;
604+ await tap ( 'Close' ) ;
605+ await elementById ( 'ActivityShort-0' ) . waitForDisplayed ( ) ;
606+ await expectTextWithin ( 'ActivityShort-0' , '-' ) ;
607+ await expectTextWithin ( 'ActivityShort-0' , 'Sent' ) ;
608+ await sleep ( 1000 ) ;
609+ await swipeFullScreen ( 'down' ) ;
610+ await swipeFullScreen ( 'down' ) ;
611+ }
612+
613+ // >500 msat remainder
614+ await payMsatInvoice ( '222538' , true ) ;
615+ // <500 msat remainder
616+ await payMsatInvoice ( '222222' , false ) ;
617+ // exactly 500 msat remainder
618+ await payMsatInvoice ( '500500' , false ) ;
619+ } ) ;
547620} ) ;
0 commit comments