From 2979b5c4ef72cb10d3bf8b4d5a772e6b6183c7ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 2 Oct 2026 21:33:31 +0200 Subject: [PATCH] test(e2e): measure the lab review rows once the dialog has stopped widening The review stage widens the sheet and the row grid re-flows from the container width; on a slow runner the 560 px case measured a half-laid-out row and failed on the first attempt. The spec now waits until the surface keeps its width across two frames before it measures. --- e2e/dialog-horizontal-overflow.spec.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/e2e/dialog-horizontal-overflow.spec.ts b/e2e/dialog-horizontal-overflow.spec.ts index 6f9ebbe21..3dbbbde62 100644 --- a/e2e/dialog-horizontal-overflow.spec.ts +++ b/e2e/dialog-horizontal-overflow.spec.ts @@ -428,6 +428,28 @@ test.describe("lab-scan review dialog uses the width it is given", () => { await expect(rows).toHaveCount(REVIEW_ROWS.length); const label = `scan review @${vp.label}`; + // The sheet widens from the picking stage to the review stage and the + // row grid re-flows from the container width it is given. Measuring in + // the middle of that sees a half-laid-out row, so wait until the + // surface has kept the same width across two frames. + await expect + .poll( + async () => { + const before = (await surface.boundingBox())!.width; + await page.evaluate( + () => + new Promise((resolve) => + requestAnimationFrame(() => + requestAnimationFrame(() => resolve()), + ), + ), + ); + const after = (await surface.boundingBox())!.width; + return Math.abs(after - before); + }, + { message: `${label}: dialog width settles` }, + ) + .toBeLessThan(0.5); await expectNoSidewaysScroll(page, label); await expectControlsInsideBox(page, label);