Compare commits

...
Author SHA1 Message Date
Mohamed Boudra 72b9ea1652 test(app): retry sidebar order after reload layout
Treat missing row geometry as a transient poll result so reload assertions wait for every visible sidebar item to lay out instead of failing before the matcher can retry.
2026-09-02 15:38:11 +02:00
@@ -38,12 +38,9 @@ function itemLabel(key: SidebarNavKey): string {
}[key];
}
async function rowTop(locator: Locator): Promise<number> {
async function rowTop(locator: Locator): Promise<number | null> {
const box = await locator.boundingBox();
if (!box) {
throw new Error("Expected a laid-out sidebar row to measure");
}
return box.y;
return box?.y ?? null;
}
export async function seedSidebarNavPreferences(
@@ -139,7 +136,11 @@ async function expectVerticalOrder(
const measured = await Promise.all(
keys.map(async (key) => ({ key, top: await rowTop(locate(key)) })),
);
return measured.sort((a, b) => a.top - b.top).map((entry) => entry.key);
const laidOut = measured.filter(
(entry): entry is { key: SidebarNavKey; top: number } => entry.top !== null,
);
if (laidOut.length !== keys.length) return null;
return laidOut.sort((a, b) => a.top - b.top).map((entry) => entry.key);
},
{ message: `Expected ${subject} in order`, timeout: 15_000 },
)