Skip to content

Commit ffd59e9

Browse files
authored
Merge branch 'main' into feat/send-v59
2 parents 1e11058 + 4e9a581 commit ffd59e9

2 files changed

Lines changed: 33 additions & 4 deletions

File tree

test/helpers/actions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,10 @@ export async function enterAddressViaScanPrompt(
14471447
await tap('DialogConfirm');
14481448
}
14491449

1450+
export async function verifyAmountToSend(amount: number) {
1451+
await expectTextWithin('SendNumberField', formatSats(amount));
1452+
}
1453+
14501454
export async function deleteAllDefaultWidgets() {
14511455
await swipeFullScreen('up');
14521456
await swipeFullScreen('up');

test/specs/send.e2e.ts

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import {
2525
editRecipientAddress,
2626
typeRecipientInput,
2727
tap,
28+
enterAmount,
29+
verifyAmountToSend,
2830
} from '../helpers/actions';
2931
import { lndConfig } from '../helpers/constants';
3032
import { reinstallApp } from '../helpers/setup';
@@ -124,7 +126,8 @@ describe('@send - Send', () => {
124126

125127
// Receive funds and check validation w/ balance
126128
await swipeFullScreen('down');
127-
await receiveOnchainFunds();
129+
const amount = 15000;
130+
await receiveOnchainFunds({ sats: amount });
128131

129132
await tap('Send');
130133
await sleep(500);
@@ -139,7 +142,13 @@ describe('@send - Send', () => {
139142
await typeAddressAndVerifyContinue({ address: address2 });
140143
}
141144

142-
// check validation for unified invoice when balance is enough
145+
// type amount over balance and verify you cannot continue
146+
await tap('AddressContinue');
147+
await enterAmount(amount + 1);
148+
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
149+
await tap('NavigationBack');
150+
151+
// check validation for unified invoice when balance is enough (10_000 sats)
143152
const unified1 = 'bitcoin:bcrt1q07x3wl76zdxvdsz3qzzkvxrjg3n6t4tz2vnsx8?amount=0.0001';
144153
try {
145154
await typeAddressAndVerifyContinue({ address: unified1 });
@@ -148,7 +157,13 @@ describe('@send - Send', () => {
148157
await typeAddressAndVerifyContinue({ address: unified1 });
149158
}
150159

151-
// check validation for unified invoice when balance is too low
160+
// verify amount is set correctly
161+
await tap('AddressContinue');
162+
await verifyAmountToSend(10_000);
163+
await elementById('ContinueAmount').waitForEnabled();
164+
await tap('NavigationBack');
165+
166+
// check validation for unified invoice when balance is too low (200_000 sats)
152167
const unified2 = 'bitcoin:bcrt1q07x3wl76zdxvdsz3qzzkvxrjg3n6t4tz2vnsx8?amount=0.002';
153168
try {
154169
await typeRecipientInput(unified2, { confirmKeyboard: false });
@@ -170,6 +185,7 @@ describe('@send - Send', () => {
170185
// - receive lightning funds
171186

172187
// Send
188+
// - try to send amount over balance
173189
// - send to onchain address
174190
// - send to lightning invoice
175191
// - send to unified invoice
@@ -240,11 +256,20 @@ describe('@send - Send', () => {
240256
await expect(totalBalance).toHaveText('110 000'); // 100k onchain + 10k lightning
241257
await expectTextWithin('ActivitySpending', '10 000');
242258

259+
// try to send amount over balance and verify you cannot continue
260+
console.info('Trying to send ln amount over balance...');
261+
const { paymentRequest: invoice0 } = await lnd.addInvoice({});
262+
console.info({ invoice0 });
263+
await enterAddress(invoice0);
264+
await enterAmount(10_000 + 1);
265+
await elementById('ContinueAmount').waitForEnabled({ reverse: true });
266+
await swipeFullScreen('down');
267+
243268
// send to onchain address
244269
console.info('Sending to onchain address...');
245270
const { address: onchainAddress } = await lnd.newAddress();
246271
console.info({ onchainAddress });
247-
await enterAddress(onchainAddress);
272+
await enterAddress(onchainAddress, { acceptCameraPermission: false });
248273
await elementById('AssetButton-savings').waitForDisplayed();
249274
await tap('N1');
250275
await multiTap('N0', 4);

0 commit comments

Comments
 (0)