From 8f3752ecb9a5239ae767bde03dde73c45eb7e6b3 Mon Sep 17 00:00:00 2001 From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 00:36:12 +0000 Subject: [PATCH] test(app): wait for a label filter row to be laid out before measuring it (#9922) The workspace-labels journey measured the Urgent filter row right after opening the label filter page. While the page is still coming in, the row has no box yet, and the measuring helper threw inside expect.poll, which ends the poll instead of retrying it. An element with no box now counts as not settled, and the helper returns the box it settled on instead of measuring a second time. Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- .../app/e2e/browser/workspace-labels.spec.ts | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/app/e2e/browser/workspace-labels.spec.ts b/packages/app/e2e/browser/workspace-labels.spec.ts index 71dcc755a..6712d1fd4 100644 --- a/packages/app/e2e/browser/workspace-labels.spec.ts +++ b/packages/app/e2e/browser/workspace-labels.spec.ts @@ -73,35 +73,36 @@ function labelRow(page: import("@playwright/test").Page, name: string) { return page.getByTestId(`workspace-label-picker-row-${name}`); } -async function box(locator: import("@playwright/test").Locator) { - const measured = await locator.boundingBox(); - if (!measured) throw new Error("expected a visible element to measure"); - return measured; -} - async function size(locator: import("@playwright/test").Locator) { - await settled(locator); - const { width, height } = await box(locator); + const { width, height } = await settled(locator); return { width, height }; } /** - * Waits until an element stops moving. + * Waits until an element is on screen and stops moving, and returns where it settled. * * The flyout scales in and the sidebar behind it re-lays out as the filter changes, so a rail * measured mid-animation is not a rail — and a measurement built from two `boundingBox()` calls - * would take its two halves from two different frames. + * would take its two halves from two different frames. A row that has not been laid out yet has + * no box at all; that is not settled either, so the poll keeps waiting instead of failing. */ async function settled(locator: import("@playwright/test").Locator) { - let previous = ""; + const last: { box: Awaited>; key: string | null } = { + box: null, + key: null, + }; await expect .poll(async () => { - const current = JSON.stringify(await box(locator)); - const stable = current === previous; - previous = current; + const current = await locator.boundingBox(); + const key = current ? JSON.stringify(current) : null; + const stable = key !== null && key === last.key; + last.box = current; + last.key = key; return stable; }) .toBe(true); + if (!last.box) throw new Error("a settled element has a box"); + return last.box; } async function expectAssigned(