From 6c985769beb689aa2b95c4a5955a3383d2c015a9 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 2 Oct 2026 10:10:33 +0100 Subject: [PATCH] test(app): tolerate footer icon subpixel rounding (#5898) Chromium bounding boxes differ by millionths of a pixel for equal-width footer buttons. Allow less than 0.01px in width and grouped-gap comparisons while preserving alignment and Help/Settings separation checks. --- packages/app/e2e/support/helpers/sidebar-nav-settings.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/app/e2e/support/helpers/sidebar-nav-settings.ts b/packages/app/e2e/support/helpers/sidebar-nav-settings.ts index c3ed13ea67..a8c64f712e 100644 --- a/packages/app/e2e/support/helpers/sidebar-nav-settings.ts +++ b/packages/app/e2e/support/helpers/sidebar-nav-settings.ts @@ -225,6 +225,9 @@ const FOOTER_ICON_TEST_IDS = [ "sidebar-settings", ]; +// Browser layout boxes include floating-point rounding, even for whole-pixel styles. +const FOOTER_GEOMETRY_TOLERANCE = 0.01; + /** * One line of same-size icons: Add project, Usage and Hosts together on the left, Help and * Settings together at the end. @@ -240,10 +243,12 @@ export async function expectFooterIconRow(page: Page): Promise { const [first] = boxes; for (const box of boxes) { expect(Math.abs(box.y + box.height / 2 - first!.y - first!.height / 2)).toBeLessThan(2); - expect(box.width).toBe(first!.width); + expect(Math.abs(box.width - first!.width)).toBeLessThan(FOOTER_GEOMETRY_TOLERANCE); } const gaps = boxes.slice(1).map((box, index) => box.x - (boxes[index]!.x + boxes[index]!.width)); - expect(gaps).toEqual([0, 0, expect.any(Number), 0]); + for (const index of [0, 1, 3]) { + expect(Math.abs(gaps[index]!)).toBeLessThan(FOOTER_GEOMETRY_TOLERANCE); + } expect(gaps[2]).toBeGreaterThan(first!.width); }