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
29 changes: 19 additions & 10 deletions test/helpers/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ export async function restoreWallet(
type addressType = 'bitcoin' | 'lightning';
export async function getReceiveAddress(which: addressType = 'bitcoin'): Promise<string> {
await tap('Receive');
await sleep(500);
return getAddressFromQRCode(which);
}

Expand Down Expand Up @@ -635,12 +636,22 @@ export async function receiveOnchainFunds(
// send - onchain - receiver sees no confetti — missing-in-ldk-node missing onchain payment event
// await elementById('ReceivedTransaction').waitForDisplayed();

await dismissBackupTimedSheet();
if (expectHighBalanceWarning) {
await acknowledgeHighBalanceWarning();
if (driver.isAndroid) {
await dismissBackupTimedSheet();
if (expectHighBalanceWarning) {
await acknowledgeHighBalanceWarning();
}
}

const moneyText = await elementByIdWithin('TotalBalance-primary', 'MoneyText');
await expect(moneyText).toHaveText(formattedSats);

if (driver.isIOS) {
await dismissBackupTimedSheet({ triggerTimedSheet: true });
if (expectHighBalanceWarning) {
await acknowledgeHighBalanceWarning({ triggerTimedSheet: true });
}
}
}

/**
Expand Down Expand Up @@ -677,13 +688,12 @@ export async function doTriggerTimedSheet() {
export async function dismissBackupTimedSheet({
triggerTimedSheet = false,
}: { triggerTimedSheet?: boolean } = {}) {
if (driver.isIOS) return; // Not supported on iOS yet
if (triggerTimedSheet) {
await doTriggerTimedSheet();
}
await elementById('backup_description').waitForDisplayed();
await elementById('BackupIntroViewDescription').waitForDisplayed();
await sleep(500); // wait for the app to settle
await tap('later_button');
await tap('BackupIntroViewCancel');
await sleep(500);
}

Expand Down Expand Up @@ -733,13 +743,12 @@ export async function dismissQuickPayIntro({
export async function acknowledgeHighBalanceWarning({
triggerTimedSheet = false,
}: { triggerTimedSheet?: boolean } = {}) {
if (driver.isIOS) return; // Not supported on iOS yet
if (triggerTimedSheet) {
await doTriggerTimedSheet();
}
await elementById('high_balance_image').waitForDisplayed();
await tap('understood_button');
await elementById('high_balance_image').waitForDisplayed({ reverse: true });
await elementById('HighBalanceSheetDescription').waitForDisplayed();
await tap('HighBalanceSheetContinue');
await elementById('HighBalanceSheetDescription').waitForDisplayed({ reverse: true });
await sleep(500);
}

Expand Down
65 changes: 44 additions & 21 deletions test/specs/boost.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('@boost - Boost', () => {

// old tx
await tap('ActivityShort-0');
await expectText('100 000');
await expectText('100 000', { strategy: 'contains' });
await tap('ActivityTxDetails');
const origTxId = await getTextUnder('TXID');
console.info({ oldTxId: origTxId });
Expand All @@ -71,19 +71,31 @@ describe('@boost - Boost', () => {
await tap('CustomFeeButton');
await tap('Plus');
await tap('Minus');
await tap('RecomendedFeeButton');
await tap('RecommendedFeeButton');
await dragOnElement('GRAB', 'right', 0.95); // Swipe to confirm

// check Activity
await elementById('BoostingIcon').waitForDisplayed();
await elementById('ActivityShort-0').waitForDisplayed();
await expect(elementById('ActivityShort-1')).toBeDisplayed();
await expect(elementById('ActivityShort-2')).not.toBeDisplayed();

// no additional boost tx item on iOS, there is one on Android
const showsBoostTxItem = driver.isAndroid;
if (showsBoostTxItem) {
await expect(elementById('ActivityShort-1')).toBeDisplayed();
await expect(elementById('ActivityShort-2')).not.toBeDisplayed();
} else {
await expect(elementById('ActivityShort-1')).not.toBeDisplayed();
await expect(elementById('ActivityShort-2')).not.toBeDisplayed();
}

// orig tx still there
await swipeFullScreen('up');
await tap('ActivityShort-1');
await expectText('100 000');
if (showsBoostTxItem) {
await tap('ActivityShort-1');
} else {
await tap('ActivityShort-0');
}
await expectText('100 000', { strategy: 'contains' });
await elementById('BoostedButton').waitForDisplayed();
await elementById('StatusBoosting').waitForDisplayed();
await tap('ActivityTxDetails');
Expand All @@ -95,15 +107,17 @@ describe('@boost - Boost', () => {
console.info({ parentTxId });
await doNavigationClose();

// new tx
await tap('ActivityShort-0');
await tap('ActivityTxDetails');
const boostTxId = await getTextUnder('TXID');
console.info({ newTxId: boostTxId });
await expect(origTxId !== boostTxId).toBe(true);
// TODO: not implemented yet
// await expect(boostTxId === parentTxId).toBe(true);
await doNavigationClose();
if (showsBoostTxItem) {
// new tx
await tap('ActivityShort-0');
await tap('ActivityTxDetails');
const boostTxId = await getTextUnder('TXID');
console.info({ newTxId: boostTxId });
await expect(origTxId !== boostTxId).toBe(true);
// TODO: not implemented yet
// await expect(boostTxId === parentTxId).toBe(true);
await doNavigationClose();
}

// --- skip due to: https://github.com/synonymdev/bitkit-android/issues/321 --- //

Expand All @@ -119,8 +133,13 @@ describe('@boost - Boost', () => {
// check activity after restore
await swipeFullScreen('up');
await elementById('BoostingIcon').waitForDisplayed();
await elementById('ActivityShort-1').waitForDisplayed();
await tap('ActivityShort-1');
if (showsBoostTxItem) {
await elementById('ActivityShort-1').waitForDisplayed();
await tap('ActivityShort-1');
} else {
await elementById('ActivityShort-0').waitForDisplayed();
await tap('ActivityShort-0');
}
await elementById('BoostedButton').waitForDisplayed();
await elementById('StatusBoosting').waitForDisplayed();

Expand All @@ -135,14 +154,18 @@ describe('@boost - Boost', () => {
await attemptRefreshOnHomeScreen();
await swipeFullScreen('up');
await elementById('ActivityShort-0').waitForDisplayed();
await elementById('ActivityShort-1').waitForDisplayed();
if (showsBoostTxItem) {
await elementById('ActivityShort-1').waitForDisplayed();
}
// TEMP: refresh until proper events available

await tap('ActivityShort-0');
await elementById('StatusConfirmed').waitForDisplayed();
await doNavigationClose();
await tap('ActivityShort-1');
await elementById('StatusConfirmed').waitForDisplayed();
if (showsBoostTxItem) {
await tap('ActivityShort-1');
await elementById('StatusConfirmed').waitForDisplayed();
}
});

ciIt('@boost_2 - Can do RBF', async () => {
Expand Down Expand Up @@ -205,7 +228,7 @@ describe('@boost - Boost', () => {
await tap('CustomFeeButton');
await tap('Plus');
await tap('Minus');
await tap('RecomendedFeeButton');
await tap('RecommendedFeeButton');
await dragOnElement('GRAB', 'right', 0.95); // Swipe to confirm

// check Activity
Expand Down