Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 18 additions & 25 deletions test/helpers/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ export async function waitForSetupWalletScreenFinish(timeout: number = 150_000)
await settingUpWallet.waitForDisplayed({ reverse: true, timeout, interval: 100 });
}

export async function completeOnboarding({ isFirstTime = true } = {}) {
export async function completeOnboarding() {
// TOS and PP
await elementById('Continue').waitForDisplayed();
await sleep(1000); // Wait for the app to settle
Expand All @@ -700,10 +700,6 @@ export async function completeOnboarding({ isFirstTime = true } = {}) {
await tap('NewWallet');
await waitForSetupWalletScreenFinish();

if (isFirstTime) {
await handleAndroidAlert();
}

// Wait for wallet to be created
await elementById('TotalBalance-primary').waitForDisplayed({ timeout: 60_000 });
}
Expand All @@ -716,14 +712,12 @@ export async function restoreWallet(
expectBackupSheet = false,
expectBackGroundPaymentsSheet = false,
reinstall = true,
expectAndroidAlert = true,
}: {
passphrase?: string;
expectQuickPayTimedSheet?: boolean;
expectBackupSheet?: boolean;
expectBackGroundPaymentsSheet?: boolean;
reinstall?: boolean;
expectAndroidAlert?: boolean;
} = {}
) {
console.info('→ Restoring wallet with seed:', seed);
Expand Down Expand Up @@ -784,9 +778,6 @@ export async function restoreWallet(
await getStarted.waitForDisplayed({ timeout: 180000 });
await tap('GetStartedButton');
await sleep(1000);
if (expectAndroidAlert) {
await handleAndroidAlert();
}

if (expectBackupSheet) {
await dismissBackupTimedSheet();
Expand Down Expand Up @@ -1018,18 +1009,13 @@ export async function transferSavingsToSpending({
console.info('→ SpendingBalanceReadyToast not found, continuing...');
}

// verify transfer activity on savings
// see : https://github.com/synonymdev/bitkit-ios/issues/464
if (driver.isAndroid) {
await dismissQuickPayIntro({ triggerTimedSheet: false });
await tap('ActivitySavings');
await expectTextWithin('Activity-1', 'Transfer', { timeout: 60_000 });
await expectTextWithin('Activity-1', '-');
await tap('NavigationBack');
} else {
await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: false });
await dismissQuickPayIntro({ triggerTimedSheet: true });
}
await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: false });
await dismissQuickPayIntro({ triggerTimedSheet: true });

await tap('ActivitySavings');
await expectTextWithin('Activity-1', 'Transfer', { timeout: 60_000 });
await expectTextWithin('Activity-1', '-');
await tap('NavigationBack');
await sleep(2000);
}

Expand Down Expand Up @@ -1287,9 +1273,16 @@ export async function dismissBackgroundPaymentsTimedSheet({
if (triggerTimedSheet) {
await doTriggerTimedSheet();
}
await elementById('BackgroundPaymentsDescription').waitForDisplayed();
await sleep(500); // wait for the app to settle
await tap('BackgroundPaymentsCancel');

if (driver.isAndroid) {
await elementById('BackgroundPaymentsIntro-later').waitForDisplayed();
await sleep(500); // wait for the app to settle
await tap('BackgroundPaymentsIntro-later');
} else {
await elementById('BackgroundPaymentsDescription').waitForDisplayed();
await sleep(500); // wait for the app to settle
await tap('BackgroundPaymentsCancel');
}
await sleep(500);
}

Expand Down
10 changes: 4 additions & 6 deletions test/specs/lightning.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,10 @@ describe('@lightning - Lightning', () => {
console.info({ response });
await acknowledgeReceivedPayment();
await sleep(500);
if (driver.isIOS) {
await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: driver.isIOS });
await dismissQuickPayIntro({ triggerTimedSheet: driver.isIOS });
} else {
await dismissQuickPayIntro({ triggerTimedSheet: true });
}

await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: true });
await dismissQuickPayIntro({ triggerTimedSheet: true });

const totalBalance = await elementByIdWithin('TotalBalance-primary', 'MoneyText');
await expect(totalBalance).toHaveText('11 000'); // 1k onchain + 10k lightning
await expectTextWithin('ActivitySpending', '10 000');
Expand Down
10 changes: 4 additions & 6 deletions test/specs/lnurl.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,10 @@ describe('@lnurl - LNURL', () => {
// Success toast/flow
await waitForToast('SpendingBalanceReadyToast');
await acknowledgeExternalSuccess();
if (driver.isIOS) {
await dismissBackgroundPaymentsTimedSheet();
await dismissQuickPayIntro({ triggerTimedSheet: driver.isIOS });
} else {
await dismissQuickPayIntro({ triggerTimedSheet: driver.isAndroid });
}

await dismissBackgroundPaymentsTimedSheet();
await dismissQuickPayIntro({ triggerTimedSheet: true });

await expectTextWithin('ActivitySpending', '20 001');

// lnurl-pay (min != max) with comment
Expand Down
3 changes: 0 additions & 3 deletions test/specs/migration.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
getAccessibleText,
getReceiveAddress,
getUriFromQRCode,
handleAndroidAlert,
pasteIOSText,
restoreWallet,
sleep,
Expand Down Expand Up @@ -483,7 +482,6 @@ async function sendRnToSelf(amountSats: number): Promise<void> {
async function handleMigrationFlow({ withSweep = false }): Promise<void> {
console.info('→ Handling migration flow...');
await expectText('MIGRATING', { strategy: 'contains' });
await handleAndroidAlert();
if (withSweep) {
await handleSweepFlow();
}
Expand Down Expand Up @@ -832,7 +830,6 @@ async function transferToSpendingRN(sats: number, existingBalance = 0): Promise<
await sleep(1000);
await dragOnElement('GRAB', 'right', 0.95);
await sleep(5000);
await handleAndroidAlert();

// Mine blocks periodically to progress the channel opening
console.info('→ Mining blocks to confirm channel...');
Expand Down
10 changes: 4 additions & 6 deletions test/specs/multiaddress.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,10 @@ describe('@multi_address - Multi address', () => {
await mineBlocks(6);
await electrum?.waitForSync();
await waitForToast('SpendingBalanceReadyToast');
if (driver.isIOS) {
await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: true });
await dismissQuickPayIntro({ triggerTimedSheet: true });
} else {
await dismissQuickPayIntro({ triggerTimedSheet: true });
}

await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: true });
await dismissQuickPayIntro({ triggerTimedSheet: true });

await checkChannelStatus({ size: formatSats(channelSize) });

// savings includes legacy; max channel funding may leave small taproot change
Expand Down
5 changes: 0 additions & 5 deletions test/specs/onboarding.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
handleAndroidAlert,
confirmInputOnKeyboard,
elementById,
elementByText,
Expand Down Expand Up @@ -44,8 +43,6 @@ describe('@onboarding - Onboarding', () => {
await tap('NewWallet');
await waitForSetupWalletScreenFinish();

await handleAndroidAlert();

await elementByText('TO GET').waitForDisplayed();
});

Expand All @@ -71,8 +68,6 @@ describe('@onboarding - Onboarding', () => {
await tap('CreateNewWallet');
await waitForSetupWalletScreenFinish();

await handleAndroidAlert();

// Wait for wallet to be created
await elementById('TotalBalance').waitForDisplayed();

Expand Down
19 changes: 7 additions & 12 deletions test/specs/send.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,9 @@ describe('@send - Send', () => {
const response = await lnd.sendPaymentSync({ paymentRequest: receive, amt: '10000' });
console.info({ response });
await acknowledgeReceivedPayment();
if (driver.isIOS) {
await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: driver.isIOS });
await dismissQuickPayIntro({ triggerTimedSheet: driver.isIOS });
} else {
await dismissQuickPayIntro({ triggerTimedSheet: true });
}

await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: true });
await dismissQuickPayIntro({ triggerTimedSheet: true });

const totalBalance = await elementByIdWithin('TotalBalance-primary', 'MoneyText');
await expect(totalBalance).toHaveText('110 000'); // 100k onchain + 10k lightning
Expand Down Expand Up @@ -597,12 +594,10 @@ describe('@send - Send', () => {
await swipeFullScreen('down');
await lnd.sendPaymentSync({ paymentRequest: receive, amt: '10000' });
await acknowledgeReceivedPayment();
if (driver.isIOS) {
await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: driver.isIOS });
await dismissQuickPayIntro({ triggerTimedSheet: driver.isIOS });
} else {
await dismissQuickPayIntro({ triggerTimedSheet: true });
}

await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: true });
await dismissQuickPayIntro({ triggerTimedSheet: true });

await expectTextWithin('ActivitySpending', '10 000');

async function payMsatInvoice(
Expand Down
12 changes: 4 additions & 8 deletions test/specs/transfer.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,10 @@ describe('@transfer - Transfer', () => {
await electrum?.waitForSync();
await waitForToast('SpendingBalanceReadyToast');
await sleep(1000);
if (driver.isIOS) {
await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: driver.isIOS });
await dismissQuickPayIntro({ triggerTimedSheet: driver.isIOS });
} else if (!quickPayDismissed) {
// only try to dismiss if it wasn't already dismissed earlier
await sleep(2000);
await dismissQuickPayIntro({ triggerTimedSheet: true });
}

await dismissBackgroundPaymentsTimedSheet({ triggerTimedSheet: true });
await dismissQuickPayIntro({ triggerTimedSheet: true });

await expectNoTextWithin('ActivitySpending', '0');
await waitForActiveChannel(lnd, ldkNodeId);

Expand Down