From e171960c7a6a2056b0ca07f5386012290eb893cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 1 Jun 2026 19:05:16 +0200 Subject: [PATCH] fix: normalize maestro loading ellipsis --- .../__tests__/runtime-assertions.test.ts | 27 +++++++++++++++++++ src/compat/maestro/runtime-assertions.ts | 4 +-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/compat/maestro/__tests__/runtime-assertions.test.ts b/src/compat/maestro/__tests__/runtime-assertions.test.ts index 4b0aee3d7..01a4356fc 100644 --- a/src/compat/maestro/__tests__/runtime-assertions.test.ts +++ b/src/compat/maestro/__tests__/runtime-assertions.test.ts @@ -158,6 +158,33 @@ test('invokeMaestroAssertVisible uses snapshot resolution for short iOS assertio assert.deepEqual(calls, [['snapshot', []]]); }); +test('invokeMaestroAssertVisible treats an elapsed ellipsis loading gate as already past loading', async () => { + vi.spyOn(Date, 'now').mockReturnValueOnce(0).mockReturnValueOnce(0).mockReturnValueOnce(250); + + const response = await invokeMaestroAssertVisible({ + baseReq: { + token: 't', + session: 's', + flags: { + platform: 'ios', + maestro: { allowAlreadyPastLoading: true }, + }, + }, + positionals: ['label="Loading…" || text="Loading…" || id="Loading…"', '1000'], + invoke: async (): Promise => ({ + ok: true, + data: snapshot([node('Dashboard')]), + }), + }); + + assert.equal(response.ok, true); + if (response.ok) { + assert.ok(response.data); + assert.equal(response.data.alreadyPastLoading, true); + assert.equal(response.data.waitedMs, 250); + } +}); + test('invokeMaestroAssertVisible dismisses React Native overlays during snapshot assertions', async () => { const calls: Array<[string, string[] | undefined]> = []; let snapshots = 0; diff --git a/src/compat/maestro/runtime-assertions.ts b/src/compat/maestro/runtime-assertions.ts index 5e63b2d44..25c795e77 100644 --- a/src/compat/maestro/runtime-assertions.ts +++ b/src/compat/maestro/runtime-assertions.ts @@ -373,12 +373,12 @@ function normalizeLoadingText(value: string | null | undefined): string { value ?.trim() .toLowerCase() - .replace(/\.\.\./g, '...') ?? '' + .replace(/\u2026/g, '...') ?? '' ); } function isLoadingText(value: string): boolean { - return value === 'loading' || value === 'loading...' || value === 'loading…'; + return value === 'loading' || value === 'loading...'; } function visibleAssertionResponse(