diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts index 344fa77..c8a777b 100644 --- a/test/helpers/actions.ts +++ b/test/helpers/actions.ts @@ -849,9 +849,12 @@ export async function typeAddressAndVerifyContinue({ await elementById('AddressContinue').waitForEnabled({ reverse }); } -export async function enterAddress(address: string) { +export async function enterAddress(address: string, { acceptCameraPermission = true } = {}) { await tap('Send'); await sleep(700); + if (acceptCameraPermission) { + await acceptAppNotificationAlert('permission_allow_one_time_button'); + } await tap('RecipientManual'); await typeAddressAndVerifyContinue({ address }); await tap('AddressContinue'); diff --git a/test/specs/boost.e2e.ts b/test/specs/boost.e2e.ts index c5bb101..6582410 100644 --- a/test/specs/boost.e2e.ts +++ b/test/specs/boost.e2e.ts @@ -6,8 +6,6 @@ import { tap, elementById, receiveOnchainFunds, - typeText, - confirmInputOnKeyboard, expectText, dragOnElement, swipeFullScreen, @@ -19,6 +17,7 @@ import { getSeed, waitForBackup, restoreWallet, + enterAddress, } from '../helpers/actions'; import { bitcoinURL } from '../helpers/constants'; import initElectrum from '../helpers/electrum'; @@ -145,18 +144,7 @@ describe('@boost - Boost', () => { // Send 10 000 const coreAddress = await rpc.getNewAddress(); - await tap('Send'); - await sleep(1000); - try { - await tap('RecipientManual'); - await elementById('RecipientInput').waitForDisplayed(); - } catch { - console.warn('RecipientInput not found, trying again'); - await tap('RecipientManual'); - } - await typeText('RecipientInput', coreAddress); - await confirmInputOnKeyboard(); - await tap('AddressContinue'); + await enterAddress(coreAddress); await tap('N1'); await tap('N0'); await tap('N000'); diff --git a/test/specs/send.e2e.ts b/test/specs/send.e2e.ts index cb94111..7f20238 100644 --- a/test/specs/send.e2e.ts +++ b/test/specs/send.e2e.ts @@ -20,6 +20,7 @@ import { mineBlocks, dismissQuickPayIntro, doNavigationClose, + acceptAppNotificationAlert, } from '../helpers/actions'; import { bitcoinURL, lndConfig } from '../helpers/constants'; import { reinstallApp } from '../helpers/setup'; @@ -63,6 +64,7 @@ describe('@send - Send', () => { ciIt('@send_1 - Validates payment data in the manual input', async () => { await tap('Send'); + await acceptAppNotificationAlert('permission_allow_foreground_only_button'); await tap('RecipientManual'); // check validation for empty address @@ -222,7 +224,7 @@ describe('@send - Send', () => { const { paymentRequest: invoice1 } = await lnd.addInvoice({}); console.info({ invoice1 }); await sleep(1000); - await enterAddress(invoice1); + await enterAddress(invoice1, { acceptCameraPermission: false }); await elementById('AssetButton-spending').waitForDisplayed(); await tap('N2'); await multiTap('N0', 3); @@ -240,7 +242,7 @@ describe('@send - Send', () => { console.info('Editing invoice on review screen...'); const { paymentRequest: invoice2 } = await lnd.addInvoice({ value: '2000' }); console.info({ invoice2 }); - await enterAddress(invoice2); + await enterAddress(invoice2, { acceptCameraPermission: false }); const reviewAmt = await elementByIdWithin('ReviewAmount-primary', 'MoneyText'); await reviewAmt.waitForDisplayed(); await expect(reviewAmt).toHaveText('2 000'); @@ -280,7 +282,7 @@ describe('@send - Send', () => { }); console.info({ unified1 }); await sleep(1000); - await enterAddress(unified1); + await enterAddress(unified1, { acceptCameraPermission: false }); await expect(reviewAmt).toHaveText('1 000'); // invoice amount await dragOnElement('GRAB', 'right', 0.95); await elementById('SendSuccess').waitForDisplayed(); @@ -302,7 +304,7 @@ describe('@send - Send', () => { }); console.info({ unified2 }); await sleep(1000); - await enterAddress(unified2); + await enterAddress(unified2, { acceptCameraPermission: false }); // should only allow spending from savings await elementById('AssetButton-savings').waitForDisplayed(); await sleep(500); @@ -334,7 +336,7 @@ describe('@send - Send', () => { // // console.info(JSON.stringify(dec, null, 2)); // await sleep(1000); - // await enterAddress(unified3); + // await enterAddress(unified3, { acceptCameraPermission: false }); // await elementById('AssetButton-savings').waitForDisplayed(); // await tap('N1'); // await multiTap('N0', 4); @@ -358,7 +360,7 @@ describe('@send - Send', () => { const unified4 = encode(onchainAddress, { lightning: invoice5 }); console.info({ unified4 }); await sleep(1000); - await enterAddress(unified4); + await enterAddress(unified4, { acceptCameraPermission: false }); // max amount (lightning) await expectText('6 000', { strategy: 'contains' }); // current balance 8k - 1k reserve balance await tap('AssetButton-switch'); @@ -384,7 +386,7 @@ describe('@send - Send', () => { const unified5 = encode(onchainAddress, { lightning: invoice6 }); console.info({ unified5 }); await sleep(1000); - await enterAddress(unified5); + await enterAddress(unified5, { acceptCameraPermission: false }); // max amount (lightning) await tap('AvailableAmount'); await tap('ContinueAmount'); @@ -426,7 +428,7 @@ describe('@send - Send', () => { await doNavigationClose(); await sleep(1000); - await enterAddress(invoice7); + await enterAddress(invoice7, { acceptCameraPermission: false }); await elementById('SendSuccess').waitForDisplayed(); await sleep(500); await tap('Close'); @@ -443,7 +445,7 @@ describe('@send - Send', () => { }); console.info({ unified7 }); await sleep(1000); - await enterAddress(unified7); + await enterAddress(unified7, { acceptCameraPermission: false }); await elementById('SendSuccess').waitForDisplayed(); await sleep(500); await tap('Close'); @@ -469,7 +471,7 @@ describe('@send - Send', () => { const { paymentRequest: invoice9 } = await lnd.addInvoice({ value: '10000' }); console.info({ invoice9 }); await sleep(1000); - await enterAddress(invoice9); + await enterAddress(invoice9, { acceptCameraPermission: false }); await elementById('ReviewAmount').waitForDisplayed(); await swipeFullScreen('down'); });