Repository navigation
test(charts): assert the Tooltip Default story's hover tooltip in the story play guard - #12548
Conversation
The Default story of Charts/Chrome/Tooltip now has a play function. It hovers the April column through the chart's pointer layer and checks that a pointer at that point reaches the layer before and after the tooltip opens. It checks that the grouped tooltip opens with the April heading and the Revenue, Costs and Trend values of the pinned April fixture row. It then leaves the plot and checks that the tooltip closes. The story is added to the story play guard targets, so a broken assertion fails the story play guard in CI instead of passing silently.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Before | After | Change | |
|---|---|---|---|
| Job-minutes per PR update | 219 | 219 | 0 |
| Runner pool, runner-minutes a day | 71,349 | 71,349 | 0 (0%) |
| Average concurrent jobs | 49.5 | 49.5 | 0 |
| Time to green (median → this run) | — | 50.7 min | — |
| Runs a day | 326 | 326 | 0 |
Not measured (the jobs that use these keep their recent minutes above): .github/scripts/story-play-guard.js.
Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: one sentence in the pull request description needs correcting. The new play function and its story play guard entry are sound, and the guard passes the new target on this head.
- The description says the pinned tooltip text will change when
spec:AST-115is implemented, but its FR9 keepsString(value)for a series and chart that declare no format, as this story does, so please reword that sentence to say the asserted text matches the spec's default for unformatted values.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: the Default story had no play function before this change: verified.
- Claim: Modal Layering was the only chart tooltip play the guard ran: verified.
- Claim: jsdom cannot observe the layout, hit testing or native top layer this path needs: verified.
- Claim: no product behavior changes: verified; no package file changes and the story render is unchanged.
- Claim: hovering April opens the grouped tooltip with April's heading and every series value, the pointer keeps reaching the chart while it is open, and leaving closes it: verified; the guard passes on this head and a real mouse shows the same rows and close.
- Claim: the ChartTooltip record is draft: verified.
- Claim: the pinned text will change when the chart value-format spec is implemented: false; that spec keeps the plain value text for series without a format.
- Claim: the story name, id and render are unchanged: verified.
- Claim: April's values are distinct within each series: verified.
- Claim: the tooltip host appears only after the tooltip subscribes to pointer events: verified.
- Claim: the play's hover, hit-test and leave steps work as described: verified.
- Claim: the guard entry sits next to Modal Layering and raises the guard from 81 to 82 targets in the same job and step: verified.
- Claim: each of the four described one-line mutations makes the new target fail: consistent with the code, not re-run.
- Claim: the guard runs only on labelled, non-draft pull requests or main's release check, and this pull request has the label: verified.
- Claim: the guard script is outside lint scope and no changeset is needed: verified.
- File
apps/storybook/stories/charts/Tooltip.stories.tsx: clear. - File
.github/scripts/story-play-guard.js: clear.
There was a problem hiding this comment.
Approved: the description now states the chart value-format spec's default for unformatted values correctly, and the new Default play function and its story play guard entry are sound. The guard passes the new target in pr-a11y (audit and guards) on this head, and a real mouse over April shows the same rows, hit target and close that the play asserts.
Claims and files checked
Review mode: same-head; reason: none
- Changed rules (0): none.
- Claim: the Default story had no play function, so no CI check asserted its hover tooltip: verified; on the base the story has only a render and the guard lists no Default entry.
- Claim: the modal layering story was the only chart tooltip play the guard ran: verified.
- Claim: jsdom cannot observe the layout, hit testing or native top layer this path needs: verified; the tooltip takes a reduced path without native popover support.
- Claim: no product behavior changes: verified; no package file changes.
- Claim: the chart tooltip record is draft and this change settles nothing: verified.
- Claim: the asserted text is the value-format spec's default for unformatted values, and the story declares no format: verified.
- Claim: the story's export name, id and render are unchanged: verified.
- Claim: April's fixture row is pinned and each of its values differs from every other month: verified.
- Claim: the tooltip host appears only after the tooltip subscribes to the chart's pointer events: verified.
- Claim: the hover point is the centre of the April tick at mid-plot height, and the hit test reaches the chart's pointer layer before and after the tooltip opens: verified in CI and with a real mouse.
- Claim: hovering opens the grouped tooltip with April's heading and every series value in order, and leaving the plot closes it and empties the text: verified.
- Claim: the guard entry sits next to the modal layering entry and raises the guard from 81 to 82 targets in the same job and step, with no workflow change: verified.
- Claim: each of the four one-line mutations makes the new target fail with the quoted message: consistent with the code, not re-run.
- Claim: the modal layering play still passes: verified in CI.
- Claim: two unrelated search-field targets fail only locally and pass in main's release check: consistent; both pass in CI on this head.
- Claim: the story's screenshots are unchanged at rest and while hovered: not re-run; the render is unchanged, and the frame after the play matches the frame after leaving.
- Claim: the guard runs only on non-draft pull requests with the accessibility label or in main's release check, and this pull request has the label: verified.
- Claim: the guard script is outside lint scope and no changeset is needed: verified.
- Claim: the build, story tree, typecheck, formatting, changeset and clean-merge checks pass: consistent; CI's build, typecheck, lint and node test jobs pass on this head, and it merges cleanly into the current main.
- File
apps/storybook/stories/charts/Tooltip.stories.tsx: clear. - File
.github/scripts/story-play-guard.js: clear.
Maintainer impact
Nothing in CI asserts the main Charts tooltip story.
Charts/Chrome/Tooltip/Defaulthas no play function, so a regression where the grouped chart tooltip stops opening on hover, shows the wrong row, never closes, or loses the pointer to an overlay leaves every check green. The only chart tooltip play that CI runs today isModal Layering, which covers top-layer stacking inside a modal, not the plain hover path.The existing jsdom
ChartTooltiptests cannot cover this path. jsdom has no layout (so no geometry-to-index mapping), no hit testing (elementFromPoint), and no native popover top layer.Intended invariant
No product behavior changes. The guard pins the behavior the story shows today: hovering a month opens the grouped tooltip with that month's heading and every series value, a pointer at that point keeps reaching the chart's pointer layer while the tooltip is open, and leaving the plot closes it.
Authority gap: ChartTooltip's record is draft; this guards current observed behavior and settles nothing. The asserted text matches the spec's default for unformatted values (AST-115 FR9): a series without
formatValueand a chart withoutformatXValuerenderString(value)for present values, and this story declares no format.Change
apps/storybook/stories/charts/Tooltip.stories.tsx:Defaultgets a play function. The export name, story id (charts-chrome-tooltip--default) and render are unchanged.monthlyDataApril must equal{month: 'Apr', revenue: 61, costs: 38, trend: 48}. April is used because its three values differ from every other month.elementFromPointat that point is the chart's pointer layer.pointermovethere on the pointer layer. Waits for the tooltip's Layer host to match:popover-openand for its text, in order, to equal['Apr', 'Revenue', '61', 'Costs', '38', 'Trend', '48']. Then assertselementFromPointstill hits the pointer layer, which catches a hover highlight, dot or crosshair that takes the pointer.pointeroutto the document body. Waits for the host to close and the text to empty..github/scripts/story-play-guard.js: addscharts-chrome-tooltip--defaulttoTARGETS, next to the existingModal Layeringentry.This is maintenance because it only adds a test of existing behavior; no package source changes.
Evidence
All runs use the unmodified guard script in headless Chrome (Chrome Headless Shell 149.0.7827.55, the Playwright 1.61.1 build) against a production Storybook build of f64e6fd (this branch's head). Each run covers all 82 guard targets.
main,Defaulthas no assertion, so the guard never loads it. To show that the new assertion fails for real defects, each one-line mutation below was built and guarded, then reverted (none is in this PR):Defaultonly (tooltip→tooltip={showLineDots}, soModal Layeringkeeps its tooltip). The play fails at the readiness wait, because no tooltip host renders:✗ ChartTooltip (charts-chrome-tooltip--default): playFunctionThrewException — AssertionError: expected null not to be nulldispatch(...)line removed). Fails on the close check:✗ ChartTooltip (charts-chrome-tooltip--default): playFunctionThrewException — AssertionError: expected true to be falsedata[hoveredIndex]→data[hoveredIndex + 1]). Fails on the content check (Modal Layeringalso fails, as expected for a shared defect):✗ ChartTooltip (charts-chrome-tooltip--default): playFunctionThrewException — AssertionError: expected [ 'May', 'Revenue', '55', …(4) ] to deeply equal [ 'Apr', 'Revenue', '61', …(4) ]pointerEvents="none"removed from the tooltip's column-highlight rect, so the highlight drawn under the cursor takes the pointer. Fails on the hit-test check after the tooltip opens:✗ ChartTooltip (charts-chrome-tooltip--default): playFunctionThrewException — AssertionError: expected '<rect>' to be 'chart pointer layer'✓ ChartTooltip (charts-chrome-tooltip--default): play passed — hovering a month through the chart pointer layer opens the grouped tooltip with that month's heading and every series value, and leaving the plot closes it✓ ChartTooltip (charts-chrome-tooltip--modal-layering): play passed, unchanged, and it also passes in the tooltip-off, leave-handler and highlight mutations.Apr · Revenue 61 · Costs 38 · Trend 48, measured the same; open state after hovertrue, after leavingfalse.core-powersearch--near-full-token-rowand its RTL variant) fail locally with a font difference and pass on main's latest release-check (https://github.com/meta/astryx/actions/runs/44170982065). They fail the same way locally on a cleanmainbuild.Defaultscreenshots between amainbuild and a build with this change, at rest and while hovered. (Those captures ran just before the rebase onto the currentmain; no chart or story file changed in between.) The hovered tooltip showedApr, Revenue 61, Costs 38, Trend 48 in every case.pr-a11y (audit and guards), step "Run story play guard") and the same runner class. The guard loads one more story, 82 targets instead of 81. No workflow or action changes.Scope
Components: ChartTooltip
Testing
node .github/scripts/story-play-guard.js --storybook-dir apps/storybook/distagainst a production build of f64e6fd: the new target passes andModal Layeringpasses. Each of the four mutations above was built and guarded, and each one makes the new target fail.pr-a11y (audit and guards)only on a non-draft pull request labelledci:run-a11y; without the label it first runs on main's release-check. This PR carries the label.node .github/scripts/build-packages-and-storybook.mjs(packages and Storybook build)pnpm exec vitest run --project node apps/storybook/.storybook/story-tree.test.ts: 5 passed, against the built index; both tooltip ids are present.pnpm typecheckpnpm exec prettier --checkon both files, andpnpm exec eslint --max-warnings=0on the story file (the guard script is outside the ESLint scope).pnpm check:changesets: passes. No Changeset, because this changes a story and a CI script only.pnpm specs:for --diff origin/mainandpnpm review:pre --head HEAD: 0 findings, merges cleanly.