Skip to content

Commit 7b01149

Browse files
committed
lnurl adjustments
1 parent 44d4df1 commit 7b01149

File tree

3 files changed

+45
-15
lines changed

3 files changed

+45
-15
lines changed

test/helpers/actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ export async function receiveOnchainFunds(
671671
}
672672

673673
export type ToastId =
674+
| 'LnurlPayAmountTooLowToast'
674675
| 'SpendingBalanceReadyToast'
675676
| 'BalanceUnitSwitchedToast'
676677
| 'BalanceHiddenToast'
@@ -792,7 +793,7 @@ export async function dismissQuickPayIntro({
792793
await sleep(500);
793794
} else {
794795
await elementById('QuickpayIntroDescription').waitForDisplayed();
795-
await sleep(500); // wait for the app to settle
796+
await sleep(1000); // wait for the app to settle
796797
await tap('QuickpayIntroCancel');
797798
await sleep(500);
798799
}

test/specs/lnurl.e2e.ts

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ describe('@lnurl - LNURL', () => {
145145
await waitForActiveChannel(lnd as any, ldkNodeID);
146146

147147
// Success toast/flow
148-
if (driver.isIOS) await waitForToast('SpendingBalanceReadyToast')
148+
if (driver.isIOS) await waitForToast('SpendingBalanceReadyToast');
149149
if (driver.isAndroid) await dismissQuickPayIntro();
150150
await elementById('ExternalSuccess').waitForDisplayed({ timeout: 30_000 });
151151
await tap('ExternalSuccess-button');
152152
if (driver.isIOS) {
153153
await dismissBackgroundPaymentsTimedSheet();
154154
await dismissQuickPayIntro({ triggerTimedSheet: driver.isIOS });
155-
}
155+
}
156156
await expectTextWithin('ActivitySpending', '20 001');
157157

158158
// lnurl-pay (min != max) with comment
@@ -182,7 +182,12 @@ describe('@lnurl - LNURL', () => {
182182
await multiTap('NRemove', 3); // remove "201"
183183
await multiTap('N9', 2);
184184
await expectTextWithin('SendNumberField', '99');
185-
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
185+
if (driver.isIOS) {
186+
await tap('ContinueAmount');
187+
await waitForToast('LnurlPayAmountTooLowToast');
188+
} else {
189+
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
190+
}
186191
await multiTap('NRemove', 2); // remove "99"
187192
// go with 150
188193
await tap('N1');
@@ -224,11 +229,24 @@ describe('@lnurl - LNURL', () => {
224229
});
225230
console.log('payRequest2', payRequest2);
226231

227-
await tap('Scan');
228-
await tap('ScanPrompt');
229-
await typeText('QRInput', payRequest2.encoded);
230-
await confirmInputOnKeyboard();
231-
await tap('DialogConfirm');
232+
try {
233+
await tap('Scan');
234+
await tap('ScanPrompt');
235+
await typeText('QRInput', payRequest2.encoded);
236+
await confirmInputOnKeyboard();
237+
await tap('DialogConfirm');
238+
await sleep(1000);
239+
await elementById('ReviewAmount-primary').waitForDisplayed({ timeout: 5000 });
240+
} catch {
241+
console.warn('ReviewAmount not found, trying again');
242+
await dismissQuickPayIntro({ triggerTimedSheet: driver.isIOS });
243+
await tap('Scan');
244+
await tap('ScanPrompt');
245+
await typeText('QRInput', payRequest2.encoded);
246+
await confirmInputOnKeyboard();
247+
await tap('DialogConfirm');
248+
await sleep(1000);
249+
}
232250
// Comment input should not be visible
233251
await elementById('CommentInput').waitForDisplayed({ reverse: true });
234252
const reviewAmt = await elementByIdWithin('ReviewAmount-primary', 'MoneyText');
@@ -283,11 +301,22 @@ describe('@lnurl - LNURL', () => {
283301
});
284302
console.log('withdrawRequest1', withdrawRequest1);
285303

286-
await tap('Scan');
287-
await tap('ScanPrompt');
288-
await typeText('QRInput', withdrawRequest1.encoded);
289-
await confirmInputOnKeyboard();
290-
await tap('DialogConfirm');
304+
try {
305+
await tap('Scan');
306+
await tap('ScanPrompt');
307+
await typeText('QRInput', withdrawRequest1.encoded);
308+
await confirmInputOnKeyboard();
309+
await tap('DialogConfirm');
310+
await elementById('SendNumberField').waitForDisplayed({ timeout: 5000 });
311+
} catch {
312+
console.warn('SendNumberField not found, trying again');
313+
await dismissQuickPayIntro({ triggerTimedSheet: driver.isIOS });
314+
await tap('Scan');
315+
await tap('ScanPrompt');
316+
await typeText('QRInput', withdrawRequest1.encoded);
317+
await confirmInputOnKeyboard();
318+
await tap('DialogConfirm');
319+
}
291320
await expectTextWithin('SendNumberField', '102');
292321
await tap('ContinueAmount');
293322
await tap('WithdrawConfirmButton');

test/specs/transfer.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ describe('@transfer - Transfer', () => {
332332

333333
await mineBlocks(rpc, 6);
334334
await electrum?.waitForSync();
335-
await waitForToast('SpendingBalanceReadyToast');
335+
await waitForToast('SpendingBalanceReadyToast');
336336
await dismissQuickPayIntro();
337337
await waitForActiveChannel(lnd, ldkNodeId);
338338

0 commit comments

Comments
 (0)