From ccb60c3a7ef5d1de53aad246cc9cd6e64598ffce Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 08:47:45 +0000 Subject: [PATCH] fix(ci): robustify visual overlay tests - Add init script to pre-set disclaimer state, avoiding race conditions - Scroll sidebar toggle and footer buttons into view before assertions - Wait for layout stabilization after sidebar expansion Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- _redirects | 2 +- tests/visual/overlay-layers.spec.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/_redirects b/_redirects index f8243379..7797f7c6 100644 --- a/_redirects +++ b/_redirects @@ -1 +1 @@ -/* /index.html 200 \ No newline at end of file +/* /index.html 200 diff --git a/tests/visual/overlay-layers.spec.ts b/tests/visual/overlay-layers.spec.ts index 5382c050..0043aa24 100644 --- a/tests/visual/overlay-layers.spec.ts +++ b/tests/visual/overlay-layers.spec.ts @@ -41,6 +41,9 @@ test.describe("overlay layering tokens", () => { test("mobile sidebar shares desktop rail behavior", async ({ page }) => { await page.setViewportSize({ width: 390, height: 844 }); + await page.addInitScript(() => { + window.localStorage.setItem("hasSeenDisclaimer", "true"); + }); await page.goto("/index.html", { waitUntil: "networkidle" }); await dismissDisclaimerModal(page); @@ -53,6 +56,7 @@ test.describe("overlay layering tokens", () => { await expect(page.locator("#mobileMenuBtn")).toHaveCount(0); const collapseToggle = page.locator("#sidebarCollapseToggle"); + await collapseToggle.scrollIntoViewIfNeeded(); await expect(collapseToggle).toBeVisible(); const initialLayout = await page.evaluate(() => { @@ -149,6 +153,9 @@ test.describe("overlay layering tokens", () => { } }); + // Wait for scroll to settle and layout to stabilize + await page.waitForTimeout(500); + const expandedLayout = await page.evaluate(() => { const sidebar = document.getElementById("sidebar"); const app = document.getElementById("app"); @@ -218,6 +225,7 @@ test.describe("overlay layering tokens", () => { expect(Math.abs(expandedLayout.marginLeft - expandedLayout.expectedMargin)).toBeLessThan(0.5); const footerButton = page.locator("#footerDropdownButton"); + await footerButton.scrollIntoViewIfNeeded(); await expect(footerButton).toBeVisible(); await footerButton.click(); await expect(footerButton).toHaveAttribute("aria-expanded", "true");