Skip to content

Commit a6610fe

Browse files
authored
Merge pull request #73 from synonymdev/test/send2
Test/send
2 parents a5a805f + e4030f2 commit a6610fe

File tree

4 files changed

+27
-13
lines changed

4 files changed

+27
-13
lines changed

test/specs/boost.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ describe('@boost - Boost', () => {
192192
await tap('RecommendedFeeButton');
193193
await dragOnElement('GRAB', 'right', 0.95); // Swipe to confirm
194194
await waitForToast('BoostSuccessToast');
195-
195+
196196
// check Activity
197197
await elementById('BoostingIcon').waitForDisplayed();
198198
await elementById('ActivityShort-0').waitForDisplayed();

test/specs/lightning.e2e.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ describe('@lightning - Lightning', () => {
166166
await expect(totalBalance).toHaveText('11 000'); // 1k onchain + 10k lightning
167167
await expectTextWithin('ActivitySpending', '10 000');
168168

169-
await console.info('send lightning payment (lightning invoice with amount = 1000) and manually added tag');
169+
await console.info(
170+
'send lightning payment (lightning invoice with amount = 1000) and manually added tag'
171+
);
170172
const value = '1000';
171173
const { paymentRequest: invoice4 } = await lnd.addInvoice({
172174
value: value,

test/specs/lnurl.e2e.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ describe('@lnurl - LNURL', () => {
197197
await expectTextWithin('ActivityShort-0', 'Sent');
198198

199199
// --- skip due to: https://github.com/synonymdev/bitkit-android/issues/417 ---//
200+
// https://github.com/synonymdev/bitkit-ios/issues/277
200201
// await tap('ActivityShort-0');
201202
// await elementById('InvoiceComment').waitForDisplayed();
202203
// await expectTextWithin('InvoiceComment', 'test comment');

test/specs/send.e2e.ts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import {
2222
doNavigationClose,
2323
waitForToast,
2424
acceptAppNotificationAlert,
25+
dismissBackgroundPaymentsTimedSheet,
26+
acknowledgeReceivedPayment,
2527
} from '../helpers/actions';
2628
import { bitcoinURL, lndConfig } from '../helpers/constants';
2729
import { 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

Comments
 (0)