From 5f00524da6055a14b240acd037be169d99a9da2f Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 17:22:57 +0000 Subject: [PATCH] Skip visual regression tests on macOS (darwin) Screenshot baselines are captured on Linux CI. Font rendering and anti-aliasing differ on macOS, producing false-positive diffs. Skip the entire suite on darwin with a warning message and avoid the unnecessary Storybook fetch. --- .../kilo-ui/tests/visual-regression.spec.ts | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/kilo-ui/tests/visual-regression.spec.ts b/packages/kilo-ui/tests/visual-regression.spec.ts index 42ef6eefa8e..553ce269027 100644 --- a/packages/kilo-ui/tests/visual-regression.spec.ts +++ b/packages/kilo-ui/tests/visual-regression.spec.ts @@ -1,4 +1,14 @@ import { test, expect, type Page } from "@playwright/test" +import { platform } from "node:os" + +const IS_DARWIN = platform() === "darwin" + +// Screenshot baselines are captured on Linux CI — font rendering and anti-aliasing +// differ on macOS, which causes false-positive diffs. Skip the entire suite there. +if (IS_DARWIN) { + console.warn("Visual regression tests must be run on CI, skipping on local macOS.") + test.skip() +} type Story = { id: string @@ -15,9 +25,7 @@ const STORYBOOK_URL = "http://localhost:6006" // Fetched once per worker process — cheap HTTP call to the already-running Storybook async function fetchStories(): Promise { - const res = await fetch(`${STORYBOOK_URL}/index.json`).catch(() => - fetch(`${STORYBOOK_URL}/stories.json`), - ) + const res = await fetch(`${STORYBOOK_URL}/index.json`).catch(() => fetch(`${STORYBOOK_URL}/stories.json`)) if (!res.ok) throw new Error(`Storybook index fetch failed: ${res.status} ${res.statusText}`) const data = (await res.json()) as StoriesIndex const map = data.entries ?? data.stories ?? {} @@ -53,14 +61,14 @@ const SKIP = new Set([ // Generate one test() per story so Playwright's scheduler can distribute // them freely across workers — no manual sharding needed. -const stories = (await fetchStories()).filter((s) => !SKIP.has(s.id)) +// Skip fetching stories on macOS since test.skip() above already marks the file skipped. +const stories = IS_DARWIN ? [] : (await fetchStories()).filter((s) => !SKIP.has(s.id)) for (const story of stories) { test(`${story.title} / ${story.name}`, async ({ page }) => { - await page.goto( - `/iframe.html?id=${story.id}&viewMode=story&globals=colorScheme:dark;theme:kilo`, - { waitUntil: "load" }, - ) + await page.goto(`/iframe.html?id=${story.id}&viewMode=story&globals=colorScheme:dark;theme:kilo`, { + waitUntil: "load", + }) await disableAnimations(page) // Wait for Kobalte/SolidJS to finish hydrating interactive components await page.waitForSelector("#storybook-root *", { state: "attached" })