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
27 changes: 27 additions & 0 deletions src/compat/maestro/__tests__/runtime-assertions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<DaemonResponse> => ({
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;
Expand Down
4 changes: 2 additions & 2 deletions src/compat/maestro/runtime-assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading