Skip to content

test(vibe-tests): guest fixture token pairs meet contrast without a browser - #8889

Merged
cixzhang merged 1 commit into
mainfrom
test/guest-token-contrast
Oct 30, 2026
Merged

cixzhang merged 1 commit into
mainfrom
test/guest-token-contrast

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Who this helps: contributors who change the enterprise fixture's guest palette. A text-on-surface pair that drops below 4.5:1 now fails in the Node unit suite in seconds. Before, the only place it failed was the Playwright step, which renders the fixture in a browser.

What changes

  • New internal/vibe-tests/src/guest-token-contrast.test.mjs reads the guest token block ([data-guest-design-system]) from the fixture's index.css. It computes WCAG contrast for each pair the browser check measures:
    • guest callout body and heading, dialog body (at its 75% opacity), dialog callout, menu item, menu item hover, destructive action.
  • A guard keeps the pair table in step with CONTRAST_PROBES in fixture-browser.mjs: a new browser probe without a pair fails.
  • The browser step (fixtures:contrast) is unchanged. It still owns what only rendering shows: the cascade resolving these values at every boundary.

Line count

+117 / −0, net +117. It's net positive because it's a new unit test with nothing to delete: the browser check stays as the cascade check. CI cost goes down, not up, because a palette regression now fails in the unit suite before any browser job runs.

Testing

  • vitest run --project node internal/vibe-tests/src/guest-token-contrast.test.mjs: 8 pass.
  • Failing first: with the guest --subtle set to #8b5cf6, 4 pairs fail (both callouts, the dialog callout, menu hover). Restoring it passes.

…rowser

The guest subtree of the enterprise fixture redefines generic token names.
Each text-on-surface pair that fixtures:contrast measures in a real browser
is now checked in the unit suite from the token values in the fixture's CSS,
so a palette change that drops a pair below 4.5:1 fails without Playwright.
The browser check keeps what only rendering shows: the cascade resolving
those values at every boundary.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 29, 2026 12:59am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 29, 2026
@astracat-bot

astracat-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 29, 2026, 2:47 AM UTC

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge: the new unit test checks the same seven guest pairs as fixtures:contrast, its ratios match what the browser step measures in light and dark mode, and the documented --subtle: #8b5cf6 edit fails the four pairs that use it. One optional wording fix for the description: fixture-contrast runs alongside test-node in CI rather than after it, so the gain is fast, browserless feedback rather than lower CI cost.

[Automated review]

@cixzhang cixzhang closed this Oct 30, 2026
@cixzhang cixzhang reopened this Oct 30, 2026
@cixzhang cixzhang closed this Oct 30, 2026
@cixzhang cixzhang reopened this Oct 30, 2026
@cixzhang
cixzhang merged commit 856df77 into main Oct 30, 2026
52 checks passed

This branch was successfully deployed

1 active deployment
Preview — 5a3ef9fd Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant