Skip to content

Test safety net: interaction tests for every component, visual check in CI - #210

Merged
lorant-one merged 15 commits into
previewfrom
chore/component-test-safety-net
Oct 18, 2026
Merged

lorant-one merged 15 commits into
previewfrom
chore/component-test-safety-net

Conversation

@lorant-one

Copy link
Copy Markdown
Member

Requested by Lorant · project thread

Before: about 45 exported components had no test at all, many others only a shallow one, and nothing in CI noticed when a component started to look different.

After: every component has an interaction test file (render, props, keyboard, state, axe), every export is checked to render on the client and the server without React warnings, and a new Visual check workflow screenshots every live demo on the docs site for the PR and for its base and fails when a demo whose code didn't change now looks different.

The tests found about 60 real bugs, fixed here with small changes, each with a test that fails without the fix. Highlights:

  • DatePicker lost focus after a keyboard pick, so the end date of DateRangePicker/DateRangeInput could not be picked from the keyboard.
  • Select defaulted value to "", so every Select was controlled: without value a pick never showed and multiple never kept more than one.
  • Double callbacks: DropdownWrapper (onOpenChange, onSelect), ContextMenu, EmojiPickerDropdown, Scroller (Enter/Space on native buttons), MediaUpload (picker opened twice).
  • Unreachable by keyboard: CompareImage handle (now a slider), ScrollToTop, MediaUpload drop zone, Carousel indicators and thumbnails, Scrubber ArrowUp/Down, SegmentedControl past a disabled segment.
  • Shared ids: Accordion aria-controls all pointed at the first accordion; RadialGauge gradient id.
  • Crashes: TypeFx with empty words, CodeBlock copy without clipboard, LinearGauge with one tick, MediaUpload rejected upload left the spinner forever.
  • Screen readers: Input/Textarea description never linked, CountFx read "0123456789" per digit, GlitchFx/HoloFx read text three times, closed Accordion panels and marquee copies stayed in the Tab order (now inert), missing names/states on Avatar, NavItem, HeadingNav, Swiper, EmojiPicker, UserMenu, Kbar.
  • Props ignored: User tag, Dropdown onEscape, forwarded refs on FocusTrap, Carousel, Timeline, CountdownFx, BlobFx, UserMenu; RevealFx revealed={false}; CountdownFx onComplete fired every second.
  • SEO: Meta turned http://localhost:3000 into https://http://localhost:3000; Schema prefixed absolute image URLs.

How: 100 new *.interaction.test.tsx files in packages/core/src/__tests__ plus every-export-renders.test.tsx (the suite is now 256 files, 3200 tests, about 3.5 min locally). scripts/visual/ has capture.mjs (Playwright: dark scheme, reduced motion, seeded Math.random, shifted clock, remote requests blocked; each demo keyed by a hash of its code, so prose edits don't trip it) and compare.mjs (pixelmatch; shots that differ between two captures of the same build are reported as unstable and never fail). .github/workflows/visual.yml captures base and head in parallel, caches base captures per commit, and uploads a before/after/diff report as the visual-report artifact. Intended visual changes: add the visual-change label. The lint baseline drops from 152 to 147.


Generated by Claude Code

capture.mjs screenshots each CodeBlock preview on the docs site (keyed by a
hash of its code) and the block pages in tiles; compare.mjs pairs shots by id,
ignores shots that differ between two captures of the same build, and writes
an HTML report. .github/workflows/visual.yml runs both on pull requests and
fails on changed demos unless the PR has the visual-change label.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYxmeZdGfZSDrgUsjiPUvE
Adds an interaction test file per component (render, props, keyboard, state,
axe) and a check that every exported component renders on the client and the
server without React warnings. Fixes the bugs these tests exposed: focus loss
in DatePicker range picks, Select always controlled, double callbacks in
DropdownWrapper/ContextMenu/EmojiPickerDropdown/Scroller, keyboard-unreachable
controls (CompareImage, ScrollToTop, MediaUpload, Carousel indicators), shared
ids (Accordion, RadialGauge), crashes (TypeFx, CodeBlock copy, LinearGauge),
and missing accessible names and states across ~40 components.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYxmeZdGfZSDrgUsjiPUvE
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
core-docs Ignored Ignored Preview Oct 18, 2026 5:41pm UTC

@lorant-one lorant-one self-assigned this Oct 18, 2026
…areImage, EmojiPicker and Swiper

The accessibility thread fixed the same components on preview (#207). Its
implementations win; our interaction tests now test them. Keeps one
behaviour fix from our side: no stray "undefined" class on a loading Avatar.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYxmeZdGfZSDrgUsjiPUvE
The first CI run flagged 23 shots, all noise: a countdown a second apart, a
progress demo mid-animation, a chart and images that had not loaded yet.
Date is now fixed instead of shifted, every shot is taken twice 400 ms apart
and marked animated when the two differ (compare.mjs skips those), lazy
images load eagerly, and block pages wait for network idle after scrolling.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYxmeZdGfZSDrgUsjiPUvE
- NumberInput steps land on min/max instead of doing nothing; stepping up
  from empty starts at min.
- Slider with min === max no longer renders NaN% widths.
- MediaUpload accepts the same file twice in a row and releases preview URLs.
- OTPInput fills every field from a paste and lets a digit be typed over.
- LetterFx, CountFx, TypeFx, LogoCloud, AutoScroll and MatrixFx's reveals
  show their end state under prefers-reduced-motion.
- TypeFx with loop={false} ends on the last word instead of empty text.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYxmeZdGfZSDrgUsjiPUvE
The example had no import, so the example check typed it against core's
ThemeProvider and Column and preview's docs build went red.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYxmeZdGfZSDrgUsjiPUvE

Copy link
Copy Markdown
Member Author

Docs build failed in check-examples on native/overview.mdx:119, and the failure is not caused by this PR. Preview itself is red there since #204 (see the Ship PR's CI). #204's safe-area example had no import, so after #206 the example check typed it against core's ThemeProvider/Column. dcc24d9 ports the fix into this PR by importing the example from @once-ui-system/native. Locally, check-examples now reports 0 problems.


Generated by Claude Code

BarChart, LineChart and LineBarChart drew a random id per mount, so the
server and the client disagreed and hydration logged an attribute mismatch
(found by the Stack drill). A test now fails if markup code outside the
animation effects calls Math.random.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYxmeZdGfZSDrgUsjiPUvE
The IntersectionObserver reports an edge-adjacent next slide as intersecting,
so the active dot could land on slide two while slide one was in view (caught
by the visual check). Only a slide at least half in view counts now.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYxmeZdGfZSDrgUsjiPUvE
… once

- RadialGauge: keep preview's per-instance gradient id (the merge kept both).
- DropdownWrapper: the panel's FocusTrap now moves focus on every Tab, and
  the wrapper's own Tab handler then wrapped again from the new element, so
  Tab from the last-but-one control jumped back to the first. It now leaves
  a Tab the trap already handled alone.
- Tests follow the drill's intended changes: Feedback info/success is a
  status, ToggleButton is always a button with aria-pressed, InfoTip toggles
  on Enter/Space.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYxmeZdGfZSDrgUsjiPUvE
@lorant-one
lorant-one merged commit ab3a3e5 into preview Oct 18, 2026
10 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 18, 2026
30 tasks done
lorant-one pushed a commit that referenced this pull request Oct 18, 2026
Resolves Input, Textarea, TagInput and NumberInput against #210/#232:
keeps preview's type-only imports and NumberInput's clamped stepBy, with
this branch's FieldSize and the xxs stepper layout on top.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YJHdG7ZbpQS64MtL5PVbT1
lorant-one pushed a commit that referenced this pull request Oct 18, 2026
The #210 interaction tests run against 3.0: one codemod pass over copies,
then hand fixes. Tests of components 3.0 merged test their replacement;
the effect and block tests moved to fx and blocks. #210's component fixes
are ported into the 3.0 files that replaced the 2.x ones.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YJHdG7ZbpQS64MtL5PVbT1
@lorant-one lorant-one added approved and removed visual-change labels Oct 20, 2026 — with Claude
@lorant-one
lorant-one deleted the chore/component-test-safety-net branch October 29, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants