From d3be9cd710d3b0dfcdf8573628058794dd810cdb Mon Sep 17 00:00:00 2001 From: seiler Date: Fri, 23 Oct 2026 21:08:19 +0000 Subject: [PATCH] test(desktop): sample content gutters in one browser frame Poll a single DOM snapshot for both content edges so sidebar width transitions cannot mix rectangles from different frames. Preserve the existing half-pixel gutter tolerance. Co-authored-by: Codex Signed-off-by: seiler --- desktop/tests/e2e/community-rail.spec.ts | 31 ++++++++++++++---------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/desktop/tests/e2e/community-rail.spec.ts b/desktop/tests/e2e/community-rail.spec.ts index 8412c134e2..dc733ed234 100644 --- a/desktop/tests/e2e/community-rail.spec.ts +++ b/desktop/tests/e2e/community-rail.spec.ts @@ -30,19 +30,24 @@ async function expectContentSurfaceHorizontalGutters( page: import("@playwright/test").Page, expectedLeftGutter = 1, ) { - const [mainInsetBox, contentBox] = await Promise.all([ - page.locator("[data-buzz-glass-inset]").boundingBox(), - page.locator("[data-buzz-content-surface]").first().boundingBox(), - ]); - expect(mainInsetBox).not.toBeNull(); - expect(contentBox).not.toBeNull(); - const leftGutter = (contentBox?.x ?? 0) - (mainInsetBox?.x ?? 0); - const rightGutter = - (mainInsetBox?.x ?? 0) + - (mainInsetBox?.width ?? 0) - - ((contentBox?.x ?? 0) + (contentBox?.width ?? 0)); - expect(Math.abs(leftGutter - expectedLeftGutter)).toBeLessThan(0.5); - expect(Math.abs(rightGutter - 8)).toBeLessThan(0.5); + // Read both edges in one browser frame while the sidebar width transitions. + await expect + .poll(() => + page.locator("[data-buzz-glass-inset]").evaluate((mainInset) => { + const content = mainInset.querySelector("[data-buzz-content-surface]"); + if (!content) return null; + const mainInsetBox = mainInset.getBoundingClientRect(); + const contentBox = content.getBoundingClientRect(); + return { + left: contentBox.left - mainInsetBox.left, + right: mainInsetBox.right - contentBox.right, + }; + }), + ) + .toEqual({ + left: expect.closeTo(expectedLeftGutter, 0), + right: expect.closeTo(8, 0), + }); } async function seedCommunities(