Skip to content

Commit c52f79f

Browse files
authored
Merge pull request #64 from synonymdev/feat/send-sheet-redesign
operate permission to use cam notification
2 parents d96a7c8 + 3a14361 commit c52f79f

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

test/helpers/actions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,12 @@ export async function typeAddressAndVerifyContinue({
849849
await elementById('AddressContinue').waitForEnabled({ reverse });
850850
}
851851

852-
export async function enterAddress(address: string) {
852+
export async function enterAddress(address: string, { acceptCameraPermission = true } = {}) {
853853
await tap('Send');
854854
await sleep(700);
855+
if (acceptCameraPermission) {
856+
await acceptAppNotificationAlert('permission_allow_one_time_button');
857+
}
855858
await tap('RecipientManual');
856859
await typeAddressAndVerifyContinue({ address });
857860
await tap('AddressContinue');

test/specs/boost.e2e.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import {
66
tap,
77
elementById,
88
receiveOnchainFunds,
9-
typeText,
10-
confirmInputOnKeyboard,
119
expectText,
1210
dragOnElement,
1311
swipeFullScreen,
@@ -19,6 +17,7 @@ import {
1917
getSeed,
2018
waitForBackup,
2119
restoreWallet,
20+
enterAddress,
2221
} from '../helpers/actions';
2322
import { bitcoinURL } from '../helpers/constants';
2423
import initElectrum from '../helpers/electrum';
@@ -145,18 +144,7 @@ describe('@boost - Boost', () => {
145144

146145
// Send 10 000
147146
const coreAddress = await rpc.getNewAddress();
148-
await tap('Send');
149-
await sleep(1000);
150-
try {
151-
await tap('RecipientManual');
152-
await elementById('RecipientInput').waitForDisplayed();
153-
} catch {
154-
console.warn('RecipientInput not found, trying again');
155-
await tap('RecipientManual');
156-
}
157-
await typeText('RecipientInput', coreAddress);
158-
await confirmInputOnKeyboard();
159-
await tap('AddressContinue');
147+
await enterAddress(coreAddress);
160148
await tap('N1');
161149
await tap('N0');
162150
await tap('N000');

test/specs/send.e2e.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
mineBlocks,
2121
dismissQuickPayIntro,
2222
doNavigationClose,
23+
acceptAppNotificationAlert,
2324
} from '../helpers/actions';
2425
import { bitcoinURL, lndConfig } from '../helpers/constants';
2526
import { reinstallApp } from '../helpers/setup';
@@ -63,6 +64,7 @@ describe('@send - Send', () => {
6364

6465
ciIt('@send_1 - Validates payment data in the manual input', async () => {
6566
await tap('Send');
67+
await acceptAppNotificationAlert('permission_allow_foreground_only_button');
6668
await tap('RecipientManual');
6769

6870
// check validation for empty address
@@ -222,7 +224,7 @@ describe('@send - Send', () => {
222224
const { paymentRequest: invoice1 } = await lnd.addInvoice({});
223225
console.info({ invoice1 });
224226
await sleep(1000);
225-
await enterAddress(invoice1);
227+
await enterAddress(invoice1, { acceptCameraPermission: false });
226228
await elementById('AssetButton-spending').waitForDisplayed();
227229
await tap('N2');
228230
await multiTap('N0', 3);
@@ -240,7 +242,7 @@ describe('@send - Send', () => {
240242
console.info('Editing invoice on review screen...');
241243
const { paymentRequest: invoice2 } = await lnd.addInvoice({ value: '2000' });
242244
console.info({ invoice2 });
243-
await enterAddress(invoice2);
245+
await enterAddress(invoice2, { acceptCameraPermission: false });
244246
const reviewAmt = await elementByIdWithin('ReviewAmount-primary', 'MoneyText');
245247
await reviewAmt.waitForDisplayed();
246248
await expect(reviewAmt).toHaveText('2 000');
@@ -280,7 +282,7 @@ describe('@send - Send', () => {
280282
});
281283
console.info({ unified1 });
282284
await sleep(1000);
283-
await enterAddress(unified1);
285+
await enterAddress(unified1, { acceptCameraPermission: false });
284286
await expect(reviewAmt).toHaveText('1 000'); // invoice amount
285287
await dragOnElement('GRAB', 'right', 0.95);
286288
await elementById('SendSuccess').waitForDisplayed();
@@ -302,7 +304,7 @@ describe('@send - Send', () => {
302304
});
303305
console.info({ unified2 });
304306
await sleep(1000);
305-
await enterAddress(unified2);
307+
await enterAddress(unified2, { acceptCameraPermission: false });
306308
// should only allow spending from savings
307309
await elementById('AssetButton-savings').waitForDisplayed();
308310
await sleep(500);
@@ -334,7 +336,7 @@ describe('@send - Send', () => {
334336
// // console.info(JSON.stringify(dec, null, 2));
335337

336338
// await sleep(1000);
337-
// await enterAddress(unified3);
339+
// await enterAddress(unified3, { acceptCameraPermission: false });
338340
// await elementById('AssetButton-savings').waitForDisplayed();
339341
// await tap('N1');
340342
// await multiTap('N0', 4);
@@ -358,7 +360,7 @@ describe('@send - Send', () => {
358360
const unified4 = encode(onchainAddress, { lightning: invoice5 });
359361
console.info({ unified4 });
360362
await sleep(1000);
361-
await enterAddress(unified4);
363+
await enterAddress(unified4, { acceptCameraPermission: false });
362364
// max amount (lightning)
363365
await expectText('6 000', { strategy: 'contains' }); // current balance 8k - 1k reserve balance
364366
await tap('AssetButton-switch');
@@ -384,7 +386,7 @@ describe('@send - Send', () => {
384386
const unified5 = encode(onchainAddress, { lightning: invoice6 });
385387
console.info({ unified5 });
386388
await sleep(1000);
387-
await enterAddress(unified5);
389+
await enterAddress(unified5, { acceptCameraPermission: false });
388390
// max amount (lightning)
389391
await tap('AvailableAmount');
390392
await tap('ContinueAmount');
@@ -426,7 +428,7 @@ describe('@send - Send', () => {
426428
await doNavigationClose();
427429

428430
await sleep(1000);
429-
await enterAddress(invoice7);
431+
await enterAddress(invoice7, { acceptCameraPermission: false });
430432
await elementById('SendSuccess').waitForDisplayed();
431433
await sleep(500);
432434
await tap('Close');
@@ -443,7 +445,7 @@ describe('@send - Send', () => {
443445
});
444446
console.info({ unified7 });
445447
await sleep(1000);
446-
await enterAddress(unified7);
448+
await enterAddress(unified7, { acceptCameraPermission: false });
447449
await elementById('SendSuccess').waitForDisplayed();
448450
await sleep(500);
449451
await tap('Close');
@@ -469,7 +471,7 @@ describe('@send - Send', () => {
469471
const { paymentRequest: invoice9 } = await lnd.addInvoice({ value: '10000' });
470472
console.info({ invoice9 });
471473
await sleep(1000);
472-
await enterAddress(invoice9);
474+
await enterAddress(invoice9, { acceptCameraPermission: false });
473475
await elementById('ReviewAmount').waitForDisplayed();
474476
await swipeFullScreen('down');
475477
});

0 commit comments

Comments
 (0)