diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts index 27d3b74..36cb46c 100644 --- a/test/helpers/actions.ts +++ b/test/helpers/actions.ts @@ -295,7 +295,7 @@ export async function getTotalBalance(): Promise { return Number(digits); } -export type BalanceCondition = 'eq' | 'gt' | 'gte' | 'lt' | 'lte'; +export type BalanceCondition = 'eq' | 'gt' | 'gte' | 'lt' | 'lte' | 'neq'; function checkBalanceCondition(value: number, expected: number, condition: BalanceCondition): boolean { switch (condition) { @@ -309,6 +309,8 @@ function checkBalanceCondition(value: number, expected: number, condition: Balan return value < expected; case 'lte': return value <= expected; + case 'neq': + return value !== expected; } } @@ -632,14 +634,7 @@ export async function completeOnboarding({ isFirstTime = true } = {}) { } // Wait for wallet to be created - for (let i = 1; i <= 3; i++) { - try { - await tap('WalletOnboardingClose'); - break; - } catch { - if (i === 3) throw new Error('Tapping "WalletOnboardingClose" timeout'); - } - } + await elementById('TotalBalance-primary').waitForDisplayed( { timeout: 60_000 } ); } export async function restoreWallet( @@ -728,10 +723,7 @@ export async function restoreWallet( } } } - - // Wait for Suggestions Label to appear - const suggestions = await elementById('Suggestions'); - await suggestions.waitForDisplayed(); + await elementById('TotalBalance-primary').waitForDisplayed( { timeout: 60_000 } ); } type addressType = 'bitcoin' | 'lightning'; @@ -1107,8 +1099,9 @@ export async function receiveOnchainFunds({ await mineBlocks(blocksToMine); - const moneyText = await elementByIdWithin('TotalBalance-primary', 'MoneyText'); - await expect(moneyText).toHaveText(formattedSats); + await expectTotalBalance(sats); + await expectSavingsBalance(sats); + await expectSpendingBalance(0); await dismissBackupTimedSheet({ triggerTimedSheet: true }); if (expectHighBalanceWarning) { diff --git a/test/specs/boost.e2e.ts b/test/specs/boost.e2e.ts index 7fb276e..b1113dd 100644 --- a/test/specs/boost.e2e.ts +++ b/test/specs/boost.e2e.ts @@ -44,7 +44,6 @@ describe('@boost - Boost', () => { await receiveOnchainFunds({ sats: 100_000, blocksToMine: 0 }); // check Activity - await swipeFullScreen('up'); await expectTextWithin('ActivityShort-0', '100 000'); await expectTextWithin('ActivityShort-0', '+'); @@ -77,7 +76,6 @@ describe('@boost - Boost', () => { await expectTextWithin('ActivityShort-1', '+'); // orig tx still there - await swipeFullScreen('up'); await tap('ActivityShort-1'); await expectText('100 000', { strategy: 'contains' }); await elementById('BoostedButton').waitForDisplayed(); @@ -106,7 +104,6 @@ describe('@boost - Boost', () => { await restoreWallet(seed); // check activity after restore - await swipeFullScreen('up'); await elementById('BoostingIcon').waitForDisplayed(); await elementById('ActivityShort-1').waitForDisplayed(); await tap('ActivityShort-1'); @@ -148,7 +145,6 @@ describe('@boost - Boost', () => { await expect(moneyText).not.toHaveText('100 000'); // check Activity - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await expectTextWithin('ActivityShort-0', '-'); await elementById('ActivityShort-1').waitForDisplayed(); @@ -212,7 +208,6 @@ describe('@boost - Boost', () => { await restoreWallet(seed); // check activity after restore - await swipeFullScreen('up'); (await elementByIdWithin('ActivityShort-0', 'BoostingIcon')).waitForDisplayed(); await tap('ActivityShort-0'); await elementById('BoostedButton').waitForDisplayed(); diff --git a/test/specs/lightning.e2e.ts b/test/specs/lightning.e2e.ts index 3671f15..54a9593 100644 --- a/test/specs/lightning.e2e.ts +++ b/test/specs/lightning.e2e.ts @@ -2,7 +2,6 @@ import initElectrum from '../helpers/electrum'; import { completeOnboarding, receiveOnchainFunds, - expectText, enterAddress, multiTap, tap, @@ -186,8 +185,6 @@ describe('@lightning - Lightning', () => { await expectTextWithin('ActivitySpending', '9 000'); // check tx history - await swipeFullScreen('up'); - await swipeFullScreen('up'); await expectTextWithin('ActivityShort-0', '1 000'); await expectTextWithin('ActivityShort-1', '111'); await expectTextWithin('ActivityShort-2', '111'); @@ -200,8 +197,6 @@ describe('@lightning - Lightning', () => { // check activity filters & tags await sleep(500); // wait for the app to settle - await swipeFullScreen('up'); - await swipeFullScreen('up'); await tap('ActivityShowAll'); // All transactions @@ -257,8 +252,6 @@ describe('@lightning - Lightning', () => { await expectTextWithin('ActivitySpending', '9 000'); // check tx history - await swipeFullScreen('up'); - await swipeFullScreen('up'); await expectTextWithin('ActivityShort-0', '1 000'); await expectTextWithin('ActivityShort-1', '111'); await expectTextWithin('ActivityShort-2', '111'); @@ -295,7 +288,6 @@ describe('@lightning - Lightning', () => { } await doNavigationClose(); - await swipeFullScreen('up'); await expectTextWithin('ActivityShort-0', '9 000'); }); }); diff --git a/test/specs/lnurl.e2e.ts b/test/specs/lnurl.e2e.ts index 1ba6586..d0f1304 100644 --- a/test/specs/lnurl.e2e.ts +++ b/test/specs/lnurl.e2e.ts @@ -185,8 +185,6 @@ describe('@lnurl - LNURL', () => { await elementById('SendSuccess').waitForDisplayed(); await tap('Close'); await expectTextWithin('ActivitySpending', '19 851'); // 20 001 - 150 - await swipeFullScreen('up'); - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await expectTextWithin('ActivityShort-0', '150'); await expectTextWithin('ActivityShort-0', '-'); @@ -224,8 +222,6 @@ describe('@lnurl - LNURL', () => { await elementById('SendSuccess').waitForDisplayed(); await tap('Close'); await expectTextWithin('ActivitySpending', '19 629'); // 19 851 - 222 = 19 629 - await swipeFullScreen('up'); - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await expectTextWithin('ActivityShort-0', '222'); await expectTextWithin('ActivityShort-0', '-'); @@ -255,8 +251,6 @@ describe('@lnurl - LNURL', () => { await elementById('SendSuccess').waitForDisplayed(); await tap('Close'); await expectTextWithin('ActivitySpending', '19 308'); // 19 629 - 321 = 19 308 - await swipeFullScreen('up'); - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await expectTextWithin('ActivityShort-0', '321'); await expectTextWithin('ActivityShort-0', '-'); @@ -283,8 +277,6 @@ describe('@lnurl - LNURL', () => { await tap('WithdrawConfirmButton'); await acknowledgeReceivedPayment(); await expectTextWithin('ActivitySpending', '19 410'); // 19 308 + 102 = 19 410 - await swipeFullScreen('up'); - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await expectTextWithin('ActivityShort-0', '102'); await expectTextWithin('ActivityShort-0', '+'); @@ -308,8 +300,6 @@ describe('@lnurl - LNURL', () => { await tap('WithdrawConfirmButton'); await acknowledgeReceivedPayment(); await expectTextWithin('ActivitySpending', '19 713'); // 19 410 + 303 = 19 713 - await swipeFullScreen('up'); - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await expectTextWithin('ActivityShort-0', '303'); await expectTextWithin('ActivityShort-0', '+'); diff --git a/test/specs/migration.e2e.ts b/test/specs/migration.e2e.ts index e8c6b7d..30692a0 100644 --- a/test/specs/migration.e2e.ts +++ b/test/specs/migration.e2e.ts @@ -1001,8 +1001,6 @@ async function verifyMigration(expectedBalance: number): Promise { console.info('→ Balance migrated successfully'); // Go to activity list to verify transactions exist - await swipeFullScreen('up'); - await swipeFullScreen('up'); await tap('ActivityShowAll'); // All transactions (Transfer, Sent, Received = 3 items) diff --git a/test/specs/multiaddress.e2e.ts b/test/specs/multiaddress.e2e.ts index e15a357..e921b6c 100644 --- a/test/specs/multiaddress.e2e.ts +++ b/test/specs/multiaddress.e2e.ts @@ -193,8 +193,6 @@ describe('@multi_address - Multi address', () => { await tap('Close'); await sleep(1000); - await swipeFullScreen('up'); - await swipeFullScreen('up'); await tap('ActivityShort-0'); await expectTextWithin('ActivityAmount', formatSats(sendAmountSats)); const oldFee = await (await elementByIdWithin('ActivityFee', 'MoneyText')).getText(); diff --git a/test/specs/onboarding.e2e.ts b/test/specs/onboarding.e2e.ts index cd8910d..934777c 100644 --- a/test/specs/onboarding.e2e.ts +++ b/test/specs/onboarding.e2e.ts @@ -73,14 +73,7 @@ describe('@onboarding - Onboarding', () => { await handleAndroidAlert(); // Wait for wallet to be created - for (let i = 1; i <= 3; i++) { - try { - await tap('WalletOnboardingClose'); - break; - } catch { - if (i === 3) throw new Error('Tapping "WalletOnboardingClose" timeout'); - } - } + await elementById('TotalBalance').waitForDisplayed(); const seed = await getSeed(); diff --git a/test/specs/onchain.e2e.ts b/test/specs/onchain.e2e.ts index 160a6e1..2487313 100644 --- a/test/specs/onchain.e2e.ts +++ b/test/specs/onchain.e2e.ts @@ -24,6 +24,9 @@ import { acknowledgeReceivedPayment, enterAmount, formatSats, + expectTotalBalance, + expectSpendingBalance, + expectSavingsBalance, } from '../helpers/actions'; import { ciIt } from '../helpers/suite'; import { @@ -70,11 +73,11 @@ describe('@onchain - Onchain', () => { await mineBlocks(1); await electrum?.waitForSync(); - const moneyTextAfter = (await elementsById('MoneyText'))[1]; - await expect(moneyTextAfter).not.toHaveText('100 000 000'); + await expectTotalBalance(satsToReceive, { condition: 'lt' }); + await expectSavingsBalance(satsToReceive, { condition: 'lt' }); + await expectSpendingBalance(0); // review activity list - await swipeFullScreen('up'); const sentShort = 'ActivityShort-0'; const receiveShort = 'ActivityShort-1'; await elementById(sentShort).waitForDisplayed(); @@ -85,7 +88,6 @@ describe('@onchain - Onchain', () => { await expectTextWithin(receiveShort, 'Received'); await expectTextWithin(receiveShort, formatSats(satsToReceive)); - await swipeFullScreen('up'); await tap('ActivityShowAll'); const sentDetail = 'Activity-1'; const receiveDetail = 'Activity-2'; @@ -163,17 +165,14 @@ describe('@onchain - Onchain', () => { await mineBlocks(1); - const totalBalance = await elementByIdWithin('TotalBalance-primary', 'MoneyText'); - await expect(totalBalance).toHaveText('0'); + await expectTotalBalance(0); + await expectSavingsBalance(0); + await expectSpendingBalance(0); // Check Activity - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await elementById('ActivityShort-1').waitForDisplayed(); await elementById('ActivityShort-2').waitForDisplayed(); - - await swipeFullScreen('up'); - await sleep(1000); // wait for the app to settle await tap('ActivityShowAll'); // All 3 transactions should be present await elementById('Activity-1').waitForDisplayed(); @@ -296,7 +295,6 @@ describe('@onchain - Onchain', () => { await expect(totalBalanceAfter).toHaveText('0'); // review activity list - await swipeFullScreen('up'); const sentShort = 'ActivityShort-0'; const receiveShort = 'ActivityShort-1'; await elementById(sentShort).waitForDisplayed(); @@ -307,7 +305,6 @@ describe('@onchain - Onchain', () => { await expectTextWithin(receiveShort, 'Received'); await expectTextWithin(receiveShort, '100 000 000'); - await swipeFullScreen('up'); await tap('ActivityShowAll'); const sentDetail = 'Activity-1'; const receiveDetail = 'Activity-2'; diff --git a/test/specs/send.e2e.ts b/test/specs/send.e2e.ts index 768457f..08293ba 100644 --- a/test/specs/send.e2e.ts +++ b/test/specs/send.e2e.ts @@ -518,8 +518,6 @@ describe('@send - Send', () => { // sanity check activities displayed await sleep(1000); - await swipeFullScreen('up'); - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await elementById('ActivityShort-1').waitForDisplayed(); await elementById('ActivityShort-2').waitForDisplayed(); diff --git a/test/specs/settings.e2e.ts b/test/specs/settings.e2e.ts index fa02bac..6322399 100644 --- a/test/specs/settings.e2e.ts +++ b/test/specs/settings.e2e.ts @@ -493,7 +493,7 @@ describe('@settings - Settings', () => { try { await elementById('Suggestions').waitForDisplayed(); } catch { - await tap('WalletOnboardingClose'); + await swipeFullScreen('up'); await elementById('Suggestions').waitForDisplayed(); } diff --git a/test/specs/transfer.e2e.ts b/test/specs/transfer.e2e.ts index 7964099..3d99e41 100644 --- a/test/specs/transfer.e2e.ts +++ b/test/specs/transfer.e2e.ts @@ -232,8 +232,6 @@ describe('@transfer - Transfer', () => { // check activities await sleep(1000); - await swipeFullScreen('up'); - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await expectTextWithin('ActivityShort-0', 'Transfer'); await elementById('ActivityShort-1').waitForDisplayed(); @@ -334,8 +332,6 @@ describe('@transfer - Transfer', () => { const quickPayDismissed = driver.isAndroid ? await tryDismissQuickPayIntroIfVisible() : false; // check activity - await swipeFullScreen('up'); - await swipeFullScreen('up'); await elementById('ActivityShort-0').waitForDisplayed(); await expectTextWithin('ActivityShort-0', 'Transfer'); await elementById('ActivityShort-1').waitForDisplayed();