From 2f308ab1480458e44ec8bbc713416c8fd2054735 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Wed, 3 Dec 2025 10:39:37 +0100 Subject: [PATCH 1/5] add Balance toast ids and dismiss to waitForToast --- test/helpers/actions.ts | 14 ++++++++++---- test/specs/settings.e2e.ts | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts index 680779a..0140c75 100644 --- a/test/helpers/actions.ts +++ b/test/helpers/actions.ts @@ -651,9 +651,6 @@ export async function receiveOnchainFunds( await acknowledgeReceivedPayment(); await mineBlocks(rpc, blocksToMine); - // if (blocksToMine > 0) { - // await waitForToast('PaymentConfirmedToast'); - // } if (driver.isAndroid) { await dismissBackupTimedSheet(); @@ -674,6 +671,8 @@ export async function receiveOnchainFunds( } export type ToastId = + | 'BalanceUnitSwitchedToast' + | 'BalanceHiddenToast' | 'RgsUpdatedToast' | 'RgsErrorToast' | 'ElectrumErrorToast' @@ -684,10 +683,17 @@ export type ToastId = | 'TransactionUnconfirmedToast' | 'TransactionRemovedToast'; -export async function waitForToast(toastId: ToastId, { waitToDisappear = true } = {}) { +export async function waitForToast( + toastId: ToastId, + { waitToDisappear = false, dismiss = true } = {} +) { await elementById(toastId).waitForDisplayed(); if (waitToDisappear) { await elementById(toastId).waitForDisplayed({ reverse: true }); + return; + } + if (dismiss) { + await dragOnElement(toastId, 'up', 0.2); } } diff --git a/test/specs/settings.e2e.ts b/test/specs/settings.e2e.ts index 66057fe..bfe7fa2 100644 --- a/test/specs/settings.e2e.ts +++ b/test/specs/settings.e2e.ts @@ -218,6 +218,9 @@ describe('@settings - Settings', () => { await dragOnElement('TotalBalance', 'right', 0.5); } await elementById('ShowBalance').waitForDisplayed(); + if (driver.isIOS) { + await waitForToast('BalanceHiddenToast', { waitToDisappear: false, dismiss: true }); + } // Disable 'swipe to hide balance' await tap('HeaderMenu'); From a0c52a93d6094fe56f8c1db3fcd7f6b920555b98 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Wed, 3 Dec 2025 11:31:33 +0100 Subject: [PATCH 2/5] remove tapBalanceToReset in launchFreshApp --- test/helpers/setup.ts | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/test/helpers/setup.ts b/test/helpers/setup.ts index bfcbfd8..a66dca9 100644 --- a/test/helpers/setup.ts +++ b/test/helpers/setup.ts @@ -1,32 +1,13 @@ import { execSync } from 'node:child_process'; -import { elementsById, sleep, tap } from './actions'; +import { sleep } from './actions'; import { getAppId, getAppPath } from './constants'; -export async function launchFreshApp({ tryHandleAlert = true } = {}) { +export async function launchFreshApp() { const appId = getAppId(); await driver.terminateApp(appId); await driver.activateApp(appId); - // workaround to get rid of "Bitkit is running in background" alert - if (tryHandleAlert) { - await sleep(1000); - try { - await tapBalanceToReset(); - } catch { - await tapBalanceToReset(); - } - } - await sleep(500); -} - -async function tapBalanceToReset() { - await tap('TotalBalance'); - const moneyFiatSymbols = await elementsById('MoneyFiatSymbol'); - moneyFiatSymbols[0].waitForDisplayed(); - moneyFiatSymbols[1].waitForDisplayed(); - if ((await moneyFiatSymbols[1].getText()) !== '₿') { - await tap('TotalBalance'); - } + await sleep(3000); } /** From e6475a520006dd221aebab2ad7cf894a5483ffa6 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Wed, 3 Dec 2025 11:32:03 +0100 Subject: [PATCH 3/5] add BalanceUnitSwitchedToast --- test/specs/settings.e2e.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/specs/settings.e2e.ts b/test/specs/settings.e2e.ts index bfe7fa2..7f9d9d9 100644 --- a/test/specs/settings.e2e.ts +++ b/test/specs/settings.e2e.ts @@ -43,6 +43,9 @@ describe('@settings - Settings', () => { await tap('TotalBalance'); } await expect(fiatSymbol).toHaveText('$'); + if (driver.isIOS) { + await waitForToast('BalanceUnitSwitchedToast'); + } // - change settings (currency to EUR) // await tap('HeaderMenu'); @@ -132,6 +135,7 @@ describe('@settings - Settings', () => { await tap('N1'); await tap('Continue'); await tap('NavigationBack'); + await sleep(1000); await expect(await elementByIdWithin('TransactionSpeedSettings', 'Value')).toHaveText( /.*Custom/ ); @@ -245,7 +249,7 @@ describe('@settings - Settings', () => { // Restart the app await sleep(3000); - await launchFreshApp({ tryHandleAlert: driver.isAndroid }); + await launchFreshApp(); // Balance should be hidden await elementById('ShowBalance').waitForDisplayed(); }); @@ -259,6 +263,7 @@ describe('@settings - Settings', () => { await sleep(1000); await tap('ResetAndRestore'); await tap('NavigationBack'); + await sleep(1000); await tap('BackupWallet'); await sleep(1000); // animation From d30efb343689718f184162b9a5c18f5fba04ac70 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Wed, 3 Dec 2025 11:39:47 +0100 Subject: [PATCH 4/5] disable check for iOS (bitkit-ios/issues/260) --- test/specs/settings.e2e.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/specs/settings.e2e.ts b/test/specs/settings.e2e.ts index 7f9d9d9..7bf14f2 100644 --- a/test/specs/settings.e2e.ts +++ b/test/specs/settings.e2e.ts @@ -251,7 +251,10 @@ describe('@settings - Settings', () => { await sleep(3000); await launchFreshApp(); // Balance should be hidden - await elementById('ShowBalance').waitForDisplayed(); + // https://github.com/synonymdev/bitkit-ios/issues/260 + if (driver.isAndroid) { + await elementById('ShowBalance').waitForDisplayed(); + } }); }); From 2b69f8b8586e7faf54bd08a777b02c24c5e2b4ed Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Wed, 3 Dec 2025 12:59:07 +0100 Subject: [PATCH 5/5] stability --- test/specs/settings.e2e.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/specs/settings.e2e.ts b/test/specs/settings.e2e.ts index 7bf14f2..c7fd800 100644 --- a/test/specs/settings.e2e.ts +++ b/test/specs/settings.e2e.ts @@ -125,6 +125,7 @@ describe('@settings - Settings', () => { // switch to Fast await tap('TransactionSpeedSettings'); await tap('fast'); + await sleep(1000); await expect(await elementByIdWithin('TransactionSpeedSettings', 'Value')).toHaveText( /.*Fast/ ); @@ -143,6 +144,7 @@ describe('@settings - Settings', () => { // switch back to Normal await tap('TransactionSpeedSettings'); await tap('normal'); + await sleep(1000); await expect(await elementByIdWithin('TransactionSpeedSettings', 'Value')).toHaveText( /.*Normal/ ); @@ -265,6 +267,7 @@ describe('@settings - Settings', () => { await tap('BackupSettings'); await sleep(1000); await tap('ResetAndRestore'); + await sleep(1000); await tap('NavigationBack'); await sleep(1000); await tap('BackupWallet');