@@ -13,14 +13,16 @@ import {
1313 swipeFullScreen ,
1414 dragOnElement ,
1515 completeOnboarding ,
16- acceptAppNotificationAlert ,
1716 multiTap ,
1817 receiveOnchainFunds ,
1918 expectTextWithin ,
2019 enterAddress ,
2120 expectText ,
2221 dismissQuickPayIntro ,
2322 doNavigationClose ,
23+ waitForToast ,
24+ dismissBackgroundPaymentsTimedSheet ,
25+ enterAddressViaScanPrompt ,
2426} from '../helpers/actions' ;
2527import { reinstallApp } from '../helpers/setup' ;
2628import { ciIt } from '../helpers/suite' ;
@@ -118,16 +120,11 @@ describe('@lnurl - LNURL', () => {
118120 } ) ;
119121 console . log ( 'channelReq' , channelReq ) ;
120122
121- await tap ( 'Scan' ) ;
122- // on the first time we need to accept the notifications permission dialog to use camera
123- await acceptAppNotificationAlert ( 'permission_allow_foreground_only_button' ) ;
124- await tap ( 'ScanPrompt' ) ;
125- await typeText ( 'QRInput' , channelReq . encoded ) ;
126- await confirmInputOnKeyboard ( ) ;
127- await tap ( 'DialogConfirm' ) ;
123+ await enterAddressViaScanPrompt ( channelReq . encoded ) ;
128124
129125 const channelRequestPromise = waitForEvent ( lnurlServer , 'channelRequest:action' ) ;
130126 await elementById ( 'ConnectButton' ) . waitForDisplayed ( ) ;
127+ // await sleep(100000);
131128 await tap ( 'ConnectButton' ) ;
132129 await channelRequestPromise ;
133130
@@ -142,10 +139,14 @@ describe('@lnurl - LNURL', () => {
142139 await waitForActiveChannel ( lnd as any , ldkNodeID ) ;
143140
144141 // Success toast/flow
145- await dismissQuickPayIntro ( ) ;
142+ if ( driver . isIOS ) await waitForToast ( 'SpendingBalanceReadyToast' ) ;
143+ if ( driver . isAndroid ) await dismissQuickPayIntro ( ) ;
146144 await elementById ( 'ExternalSuccess' ) . waitForDisplayed ( { timeout : 30_000 } ) ;
147145 await tap ( 'ExternalSuccess-button' ) ;
148-
146+ if ( driver . isIOS ) {
147+ await dismissBackgroundPaymentsTimedSheet ( ) ;
148+ await dismissQuickPayIntro ( { triggerTimedSheet : driver . isIOS } ) ;
149+ }
149150 await expectTextWithin ( 'ActivitySpending' , '20 001' ) ;
150151
151152 // lnurl-pay (min != max) with comment
@@ -159,11 +160,7 @@ describe('@lnurl - LNURL', () => {
159160 } ) ;
160161 console . log ( 'payRequest1' , payRequest1 ) ;
161162
162- await tap ( 'Scan' ) ;
163- await tap ( 'ScanPrompt' ) ;
164- await typeText ( 'QRInput' , payRequest1 . encoded ) ;
165- await confirmInputOnKeyboard ( ) ;
166- await tap ( 'DialogConfirm' ) ;
163+ await enterAddressViaScanPrompt ( payRequest1 . encoded , { acceptCameraPermission : false } ) ;
167164 await expectTextWithin ( 'SendNumberField' , sats ) ;
168165 // Check amounts 99 - 201 not allowed
169166 await multiTap ( 'NRemove' , 3 ) ; // remove "100"
@@ -175,7 +172,12 @@ describe('@lnurl - LNURL', () => {
175172 await multiTap ( 'NRemove' , 3 ) ; // remove "201"
176173 await multiTap ( 'N9' , 2 ) ;
177174 await expectTextWithin ( 'SendNumberField' , '99' ) ;
178- await elementById ( 'ContinueAmount' ) . waitForEnabled ( { reverse : true } ) ;
175+ if ( driver . isIOS ) {
176+ await tap ( 'ContinueAmount' ) ;
177+ await waitForToast ( 'LnurlPayAmountTooLowToast' ) ;
178+ } else {
179+ await elementById ( 'ContinueAmount' ) . waitForEnabled ( { reverse : true } ) ;
180+ }
179181 await multiTap ( 'NRemove' , 2 ) ; // remove "99"
180182 // go with 150
181183 await tap ( 'N1' ) ;
@@ -217,11 +219,14 @@ describe('@lnurl - LNURL', () => {
217219 } ) ;
218220 console . log ( 'payRequest2' , payRequest2 ) ;
219221
220- await tap ( 'Scan' ) ;
221- await tap ( 'ScanPrompt' ) ;
222- await typeText ( 'QRInput' , payRequest2 . encoded ) ;
223- await confirmInputOnKeyboard ( ) ;
224- await tap ( 'DialogConfirm' ) ;
222+ try {
223+ await enterAddressViaScanPrompt ( payRequest2 . encoded , { acceptCameraPermission : false } ) ;
224+ await elementById ( 'ReviewAmount-primary' ) . waitForDisplayed ( { timeout : 5000 } ) ;
225+ } catch {
226+ console . warn ( 'ReviewAmount not found, trying again' ) ;
227+ await enterAddressViaScanPrompt ( payRequest2 . encoded , { acceptCameraPermission : false } ) ;
228+ await sleep ( 1000 ) ;
229+ }
225230 // Comment input should not be visible
226231 await elementById ( 'CommentInput' ) . waitForDisplayed ( { reverse : true } ) ;
227232 const reviewAmt = await elementByIdWithin ( 'ReviewAmount-primary' , 'MoneyText' ) ;
@@ -250,7 +255,7 @@ describe('@lnurl - LNURL', () => {
250255 } ) ;
251256 console . log ( 'payRequest3' , payRequest3 ) ;
252257
253- await enterAddress ( payRequest3 . encoded ) ;
258+ await enterAddress ( payRequest3 . encoded , { acceptCameraPermission : false } ) ;
254259 await expectTextWithin ( 'SendNumberField' , minSendableSats ) ;
255260 await elementById ( 'ContinueAmount' ) . waitForDisplayed ( ) ;
256261 await tap ( 'ContinueAmount' ) ;
@@ -276,11 +281,17 @@ describe('@lnurl - LNURL', () => {
276281 } ) ;
277282 console . log ( 'withdrawRequest1' , withdrawRequest1 ) ;
278283
279- await tap ( 'Scan' ) ;
280- await tap ( 'ScanPrompt' ) ;
281- await typeText ( 'QRInput' , withdrawRequest1 . encoded ) ;
282- await confirmInputOnKeyboard ( ) ;
283- await tap ( 'DialogConfirm' ) ;
284+ try {
285+ await enterAddressViaScanPrompt ( withdrawRequest1 . encoded , {
286+ acceptCameraPermission : false ,
287+ } ) ;
288+ await elementById ( 'SendNumberField' ) . waitForDisplayed ( { timeout : 5000 } ) ;
289+ } catch {
290+ console . warn ( 'SendNumberField not found, trying again' ) ;
291+ await enterAddressViaScanPrompt ( withdrawRequest1 . encoded , {
292+ acceptCameraPermission : false ,
293+ } ) ;
294+ }
284295 await expectTextWithin ( 'SendNumberField' , '102' ) ;
285296 await tap ( 'ContinueAmount' ) ;
286297 await tap ( 'WithdrawConfirmButton' ) ;
@@ -308,7 +319,7 @@ describe('@lnurl - LNURL', () => {
308319
309320 // TODO: after https://github.com/synonymdev/bitkit-android/issues/418 is resolved
310321 // we should test the scan flow here
311- await enterAddress ( withdrawRequest2 . encoded ) ;
322+ await enterAddress ( withdrawRequest2 . encoded , { acceptCameraPermission : false } ) ;
312323 const reviewAmtWithdraw = await elementByIdWithin ( 'WithdrawAmount-primary' , 'MoneyText' ) ;
313324 await expect ( reviewAmtWithdraw ) . toHaveText ( '303' ) ;
314325 await tap ( 'WithdrawConfirmButton' ) ;
@@ -329,12 +340,8 @@ describe('@lnurl - LNURL', () => {
329340 // lnurl-auth
330341 const loginRequest1 = await lnurlServer . generateNewUrl ( 'login' ) ;
331342 console . log ( 'loginRequest1' , loginRequest1 ) ;
332- await tap ( 'Scan' ) ;
333- await tap ( 'ScanPrompt' ) ;
334- await typeText ( 'QRInput' , loginRequest1 . encoded ) ;
335343 const loginEvent = new Promise < void > ( ( resolve ) => lnurlServer . once ( 'login' , resolve ) ) ;
336- await confirmInputOnKeyboard ( ) ;
337- await tap ( 'DialogConfirm' ) ;
344+ await enterAddressViaScanPrompt ( loginRequest1 . encoded , { acceptCameraPermission : false } ) ;
338345 await tap ( 'continue_button' ) ;
339346 await expectText ( 'Signed In' ) ;
340347 await loginEvent ;
0 commit comments