test(ui-checkbox): use the vitest-browser API in the toggle variant tests - #2689
Merged
Conversation
…ests
The `toggle` variant tests were written against @testing-library/react and merged after
the repo moved to vitest-browser, so tsc failed with 5 errors and took down `build:types`,
which fails the whole `bootstrap` step:
Property 'getByRole' does not exist on type 'Screen'
Cannot find name 'waitFor'
`screen` is never imported, so it resolved to the DOM global `window.screen`.
Switch to `page.getByRole().element()` / `.query()` and `expect.element`, await `render`
(it returns a promise), and pass `{ force: true }` to the click: the label covers the real
input and Playwright does real hit-testing, so the click timed out after 15s. That matches
the five other click sites in this file.
The component behaviour is unchanged and correct; these three assertions had never run.
INSTUI-5158
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Contributor
Visual regression report
Diff images (33)alert.png — baseline no longer producedavatar.png — baseline no longer producedbadge.png — baseline no longer producedbillboard.png — baseline no longer producedbreadcrumb.png — baseline no longer producedbutton-and-derivatives.png — baseline no longer producedbyline.png — baseline no longer producedcalendar.png — baseline no longer producedcheckbox.png — baseline no longer producedcheckboxgroup.png — baseline no longer producedcolorpicker.png — baseline no longer producedcontextview.png — baseline no longer producedcustom-and-lucide-icons.png — baseline no longer produceddateinput-dateinput2.png — baseline no longer produceddatetimeinput.png — baseline no longer produceddiff-demo.png — 6324 pixels differdrilldown.png — baseline no longer producedfiledrop.png — baseline no longer producedform-errors.png — baseline no longer producedheading.png — baseline no longer producedimg.png — baseline no longer producedlink.png — baseline no longer producedmenu.png — baseline no longer producedmetric-pill-tag-timeselect-text.png — baseline no longer producedoptions.png — baseline no longer producedpagination.png — baseline no longer producedprogressbar.png — baseline no longer producedselect-simpleselect.png — baseline no longer producedtable.png — baseline no longer producedtabs.png — baseline no longer producedtooltip.png — baseline no longer producedtreebrowser.png — baseline no longer producedview.png — baseline no longer producedBaselines come from the |
joyenjoyer
approved these changes
Aug 17, 2026
matyasf
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
togglevariant tests to the vitest-browser API —page.getByRole().element()/.query()andexpect.elementinstead ofscreen.*andwaitFor. This is what failsbuild:types:screenisn't imported, so it resolves to the DOM globalwindow.screenand tsc reportsProperty 'getByRole' does not exist on type 'Screen'.awaittherenderCheckboxcalls —renderreturnsPromise<RenderResult>, so the queries were running before React had committed.{ force: true }to the click. The<label>visually covers the real<input>and Playwright does genuine hit-testing, so the click timed out after 15s. Matches the five other click sites in this file.Test-only; no component code touched. The
role="button"/aria-pressedbehaviour added in #2673 is correct and unchanged — those three assertions had simply never executed, since the job died at typecheck.Context: #2673 opened 2026-07-31 and merged 2026-08-14, after the vitest-browser conversion landed on 2026-08-07. GitHub only re-runs PR checks when the head moves, not when the base does, so it merged on two-week-old green checks (its job list still shows
Cypress component tests, a job that no longer exists).masterhas been red since — and so is every open PR, because PR checks build the merge ref.Test Plan
masterhasstrict: truebutrequired_status_checks.contexts: [], so "require branches to be up to date" never engages and this can recur.Fixes INSTUI-5158
🤖 Generated with Claude Code