From 7830527f94e7787a401abc1ac180a7a302d68198 Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Tue, 10 Nov 2026 14:10:16 +0100 Subject: [PATCH 1/2] fix: dismiss the move to spark intro in outcome waits tapAndExpect, tapStationaryAndExpect and typeAndExpect waited for their target without the Move to Spark intro recovery that tap() has, so the intro covering home failed send_2 and send_3. --- test/helpers/outcome.ts | 49 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/test/helpers/outcome.ts b/test/helpers/outcome.ts index 12159010..8b0f1e74 100644 --- a/test/helpers/outcome.ts +++ b/test/helpers/outcome.ts @@ -6,6 +6,7 @@ import { elementByText, getAccessibleText, swipeFullScreen, + withMoveToSparkIntroRecovery, } from './actions'; export type VisibleTarget = { id: string } | { text: string }; @@ -281,7 +282,9 @@ export async function tapAndExpect(target: VisibleTarget, outcome: Outcome) { `tap ${label(target)}`, async () => { const current = element(target); - await current.waitForDisplayed({ timeout: outcome.timeout ?? 30_000 }); + await withMoveToSparkIntroRecovery(() => + current.waitForDisplayed({ timeout: outcome.timeout ?? 30_000 }) + ); await current.click(); }, outcome @@ -296,26 +299,28 @@ export async function tapStationaryAndExpect(target: VisibleTarget, outcome: Out async () => { let previous = ''; let ready: { click(): Promise } | undefined; - await browser.waitUntil( - async () => { - const last = previous; - previous = ''; - ready = undefined; - const current = await element(target); - if (!(await current.isDisplayed()) || !(await current.isEnabled())) return false; - const location = await current.getLocation(); - const size = await current.getSize(); - if (size.width <= 0 || size.height <= 0) return false; - previous = JSON.stringify({ id: current.elementId, location, size }); - if (previous !== last) return false; - ready = current; - return true; - }, - { - timeout: outcome.timeout ?? 30_000, - interval: 200, - timeoutMsg: `${label(target)} did not become enabled and stationary`, - } + await withMoveToSparkIntroRecovery(() => + browser.waitUntil( + async () => { + const last = previous; + previous = ''; + ready = undefined; + const current = await element(target); + if (!(await current.isDisplayed()) || !(await current.isEnabled())) return false; + const location = await current.getLocation(); + const size = await current.getSize(); + if (size.width <= 0 || size.height <= 0) return false; + previous = JSON.stringify({ id: current.elementId, location, size }); + if (previous !== last) return false; + ready = current; + return true; + }, + { + timeout: outcome.timeout ?? 30_000, + interval: 200, + timeoutMsg: `${label(target)} did not become enabled and stationary`, + } + ) ); if (!ready) throw new Error(`${label(target)} readiness was not established`); await ready.click(); @@ -356,7 +361,7 @@ export async function typeAndExpect( `type id:${id}`, async () => { const current = elementById(id); - await current.waitForDisplayed(); + await withMoveToSparkIntroRecovery(() => current.waitForDisplayed()); await current.clearValue(); if (verifyClear) { let emptySeen = false; From 28b00ed12982eae8a4b2ea831a85dfba16cf79ed Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Tue, 10 Nov 2026 14:49:41 +0100 Subject: [PATCH 2/2] fix: dismiss the move to spark intro before send balance reads The intro can surface on home a moment after Close, so send_2's total balance reads now run under the same recovery. --- test/specs/send.e2e.ts | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/test/specs/send.e2e.ts b/test/specs/send.e2e.ts index 5cfa2ba0..fb9fe62d 100644 --- a/test/specs/send.e2e.ts +++ b/test/specs/send.e2e.ts @@ -29,6 +29,7 @@ import { editRecipientAddress, tap, selectSendFundingSource, + withMoveToSparkIntroRecovery, } from '../helpers/actions'; import { lndConfig } from '../helpers/constants'; import { reinstallApp } from '../helpers/setup'; @@ -163,8 +164,7 @@ describe('@send - Send', () => { await confirmGateAction({ anyVisible: [{ id: 'SendSuccess' }] }); await elementById('SendSuccess').waitForDisplayed(); await tapAndExpect({ id: 'Close' }, { anyVisible: [{ id: 'TotalBalance-primary' }] }); - await expect(totalBalance).not.toHaveText('110 000'); - const amtAfterOnchain = await totalBalance.getText(); + const amtAfterOnchain = await totalBalanceChangedFrom(totalBalance, '110 000'); console.info({ amtAfterOnchain }); await expectTextWithin('ActivitySpending', '10 000'); @@ -181,8 +181,7 @@ describe('@send - Send', () => { await confirmGateAction({ anyVisible: [{ id: 'SendSuccess' }] }); await elementById('SendSuccess').waitForDisplayed(); await tapAndExpect({ id: 'Close' }, { anyVisible: [{ id: 'TotalBalance-primary' }] }); - await expect(totalBalance).not.toHaveText(amtAfterOnchain); - const amtAfterLightning = await totalBalance.getText(); + const amtAfterLightning = await totalBalanceChangedFrom(totalBalance, amtAfterOnchain); console.info({ amtAfterLightning }); await expectTextWithin('ActivitySpending', '8 000'); @@ -218,8 +217,7 @@ describe('@send - Send', () => { await confirmGateAction({ anyVisible: [{ id: 'SendSuccess' }] }); await elementById('SendSuccess').waitForDisplayed(); await tapAndExpect({ id: 'Close' }, { anyVisible: [{ id: 'TotalBalance-primary' }] }); - await expect(totalBalance).not.toHaveText(amtAfterLightning); - const amtAfterUnified = await totalBalance.getText(); + const amtAfterUnified = await totalBalanceChangedFrom(totalBalance, amtAfterLightning); console.info({ amtAfterUnified }); await expectTextWithin('ActivitySpending', '7 000'); @@ -241,8 +239,7 @@ describe('@send - Send', () => { await confirmGateAction({ anyVisible: [{ id: 'SendSuccess' }] }); await elementById('SendSuccess').waitForDisplayed(); await tapAndExpect({ id: 'Close' }, { anyVisible: [{ id: 'TotalBalance-primary' }] }); - await expect(totalBalance).not.toHaveText(amtAfterUnified); - const amtAfterUnified2 = await totalBalance.getText(); + const amtAfterUnified2 = await totalBalanceChangedFrom(totalBalance, amtAfterUnified); console.info({ amtAfterUnified2 }); await expectTextWithin('ActivitySpending', '7 000'); @@ -267,8 +264,7 @@ describe('@send - Send', () => { await confirmGateAction({ anyVisible: [{ id: 'SendSuccess' }] }); await elementById('SendSuccess').waitForDisplayed(); await tapAndExpect({ id: 'Close' }, { anyVisible: [{ id: 'TotalBalance-primary' }] }); - await expect(totalBalance).not.toHaveText(amtAfterUnified2); - const amtAfterUnified3 = await totalBalance.getText(); + const amtAfterUnified3 = await totalBalanceChangedFrom(totalBalance, amtAfterUnified2); console.info({ amtAfterUnified3 }); await expectTextWithin('ActivitySpending', '7 000'); @@ -295,8 +291,7 @@ describe('@send - Send', () => { await confirmGateAction({ anyVisible: [{ id: 'SendSuccess' }] }); await elementById('SendSuccess').waitForDisplayed(); await tapAndExpect({ id: 'Close' }, { anyVisible: [{ id: 'TotalBalance-primary' }] }); - await expect(totalBalance).not.toHaveText(amtAfterUnified3); - const amtAfterUnified4 = await totalBalance.getText(); + const amtAfterUnified4 = await totalBalanceChangedFrom(totalBalance, amtAfterUnified3); console.info({ amtAfterUnified4 }); await expectTextWithin('ActivitySpending', '6 000'); @@ -333,8 +328,7 @@ describe('@send - Send', () => { await confirmGateAction({ anyVisible: [{ id: 'SendSuccess' }] }); await elementById('SendSuccess').waitForDisplayed(); await tapAndExpect({ id: 'Close' }, { anyVisible: [{ id: 'TotalBalance-primary' }] }); - await expect(totalBalance).not.toHaveText(amtAfterUnified4); - const amtAfterUnified5 = await totalBalance.getText(); + const amtAfterUnified5 = await totalBalanceChangedFrom(totalBalance, amtAfterUnified4); console.info({ amtAfterUnified5 }); await expectTextWithin('ActivitySpending', '6 000'); @@ -353,8 +347,7 @@ describe('@send - Send', () => { await enterGateAddress(invoice7, { acceptCameraPermission: false }); await elementById('SendSuccess').waitForDisplayed(); await tapAndExpect({ id: 'Close' }, { anyVisible: [{ id: 'TotalBalance-primary' }] }); - await expect(totalBalance).not.toHaveText(amtAfterUnified5); - const amtAfterLightning2 = await totalBalance.getText(); + const amtAfterLightning2 = await totalBalanceChangedFrom(totalBalance, amtAfterUnified5); console.info({ amtAfterLightning2 }); await expectTextWithin('ActivitySpending', '5 000'); @@ -369,7 +362,9 @@ describe('@send - Send', () => { await enterGateAddress(unified7, { acceptCameraPermission: false }); await elementById('SendSuccess').waitForDisplayed(); await tapAndExpect({ id: 'Close' }, { anyVisible: [{ id: 'TotalBalance-primary' }] }); - await expect(totalBalance).not.toHaveText(amtAfterLightning2); + await withMoveToSparkIntroRecovery(async () => { + await expect(totalBalance).not.toHaveText(amtAfterLightning2); + }); await expectTextWithin('ActivitySpending', '4 000'); // send to lightning invoice w/ amount (skip quickpay for large amounts) @@ -491,3 +486,14 @@ describe('@send - Send', () => { await payMsatInvoice('500500', '501', false); }); }); + +/** Reads the total balance once it moved off `previous`; the Move to Spark intro can cover home right after Close. */ +async function totalBalanceChangedFrom( + totalBalance: Awaited>, + previous: string +): Promise { + await withMoveToSparkIntroRecovery(async () => { + await expect(totalBalance).not.toHaveText(previous); + }); + return withMoveToSparkIntroRecovery(() => totalBalance.getText()); +}