Skip to content

Commit 8ad57d7

Browse files
authored
Merge pull request #65 from synonymdev/test/lnurl
Test/lnurl
2 parents f584c1c + 4777408 commit 8ad57d7

File tree

3 files changed

+25
-40
lines changed

3 files changed

+25
-40
lines changed

test/helpers/actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ export async function waitForToast(
703703
*/
704704
export async function acknowledgeReceivedPayment() {
705705
await elementById('ReceivedTransaction').waitForDisplayed();
706+
await sleep(500);
706707
await tap('ReceivedTransactionButton');
707708
await sleep(300);
708709
}

test/specs/lightning.e2e.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,8 @@ describe('@lightning - Lightning', () => {
100100
await waitForActiveChannel(lnd, ldkNodeId);
101101

102102
// Toast message
103-
if (driver.isIOS) {
104-
await expectText('Spending Balance Ready');
105-
await expectText('Spending Balance Ready', { visible: false });
106-
} else {
107-
await waitForToast('SpendingBalanceReadyToast');
108-
}
103+
await waitForToast('SpendingBalanceReadyToast');
104+
109105
// check channel status
110106
await checkChannelStatus();
111107

test/specs/lnurl.e2e.ts

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
waitForToast,
2424
dismissBackgroundPaymentsTimedSheet,
2525
enterAddressViaScanPrompt,
26+
acknowledgeReceivedPayment,
2627
} from '../helpers/actions';
2728
import { reinstallApp } from '../helpers/setup';
2829
import { ciIt } from '../helpers/suite';
@@ -161,23 +162,20 @@ describe('@lnurl - LNURL', () => {
161162
console.log('payRequest1', payRequest1);
162163

163164
await enterAddressViaScanPrompt(payRequest1.encoded, { acceptCameraPermission: false });
164-
await expectTextWithin('SendNumberField', sats);
165+
await expectTextWithin('SendNumberField', '0');
165166
// Check amounts 99 - 201 not allowed
166-
await multiTap('NRemove', 3); // remove "100"
167167
await tap('N2');
168168
await tap('N0');
169169
await tap('N1');
170170
await expectTextWithin('SendNumberField', '201');
171171
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
172172
await multiTap('NRemove', 3); // remove "201"
173173
await multiTap('N9', 2);
174+
174175
await expectTextWithin('SendNumberField', '99');
175-
if (driver.isIOS) {
176-
await tap('ContinueAmount');
177-
await waitForToast('LnurlPayAmountTooLowToast');
178-
} else {
179-
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
180-
}
176+
await tap('ContinueAmount');
177+
await waitForToast('LnurlPayAmountTooLowToast');
178+
181179
await multiTap('NRemove', 2); // remove "99"
182180
// go with 150
183181
await tap('N1');
@@ -219,14 +217,9 @@ describe('@lnurl - LNURL', () => {
219217
});
220218
console.log('payRequest2', payRequest2);
221219

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-
}
220+
await enterAddressViaScanPrompt(payRequest2.encoded, { acceptCameraPermission: false });
221+
await sleep(2000);
222+
await elementById('ReviewAmount-primary').waitForDisplayed({ timeout: 5000 });
230223
// Comment input should not be visible
231224
await elementById('CommentInput').waitForDisplayed({ reverse: true });
232225
const reviewAmt = await elementByIdWithin('ReviewAmount-primary', 'MoneyText');
@@ -247,7 +240,6 @@ describe('@lnurl - LNURL', () => {
247240

248241
// lnurl-pay via manual entry
249242
const minSendable = 321000; // msats
250-
const minSendableSats = (minSendable / 1000).toString();
251243
const payRequest3 = await lnurlServer.generateNewUrl('payRequest', {
252244
minSendable,
253245
maxSendable: 350000,
@@ -256,7 +248,11 @@ describe('@lnurl - LNURL', () => {
256248
console.log('payRequest3', payRequest3);
257249

258250
await enterAddress(payRequest3.encoded, { acceptCameraPermission: false });
259-
await expectTextWithin('SendNumberField', minSendableSats);
251+
await expectTextWithin('SendNumberField', '0');
252+
// go with 321
253+
await tap('N3');
254+
await tap('N2');
255+
await tap('N1');
260256
await elementById('ContinueAmount').waitForDisplayed();
261257
await tap('ContinueAmount');
262258
await dragOnElement('GRAB', 'right', 0.95);
@@ -281,22 +277,15 @@ describe('@lnurl - LNURL', () => {
281277
});
282278
console.log('withdrawRequest1', withdrawRequest1);
283279

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-
}
280+
await enterAddressViaScanPrompt(withdrawRequest1.encoded, {
281+
acceptCameraPermission: false,
282+
});
283+
await sleep(2000);
284+
await elementById('SendNumberField').waitForDisplayed({ timeout: 5000 });
295285
await expectTextWithin('SendNumberField', '102');
296286
await tap('ContinueAmount');
297287
await tap('WithdrawConfirmButton');
298-
await elementById('ReceivedTransaction').waitForDisplayed();
299-
await swipeFullScreen('down');
288+
await acknowledgeReceivedPayment();
300289
await expectTextWithin('ActivitySpending', '19 410'); // 19 308 + 102 = 19 410
301290
await swipeFullScreen('up');
302291
await swipeFullScreen('up');
@@ -323,8 +312,7 @@ describe('@lnurl - LNURL', () => {
323312
const reviewAmtWithdraw = await elementByIdWithin('WithdrawAmount-primary', 'MoneyText');
324313
await expect(reviewAmtWithdraw).toHaveText('303');
325314
await tap('WithdrawConfirmButton');
326-
await elementById('ReceivedTransaction').waitForDisplayed();
327-
await swipeFullScreen('down');
315+
await acknowledgeReceivedPayment();
328316
await expectTextWithin('ActivitySpending', '19 713'); // 19 410 + 303 = 19 713
329317
await swipeFullScreen('up');
330318
await swipeFullScreen('up');
@@ -342,7 +330,7 @@ describe('@lnurl - LNURL', () => {
342330
console.log('loginRequest1', loginRequest1);
343331
const loginEvent = new Promise<void>((resolve) => lnurlServer.once('login', resolve));
344332
await enterAddressViaScanPrompt(loginRequest1.encoded, { acceptCameraPermission: false });
345-
await tap('continue_button');
333+
await tap('LnurlAuthContinue');
346334
await expectText('Signed In');
347335
await loginEvent;
348336
}

0 commit comments

Comments
 (0)