Skip to content

test(ui-checkbox): use the vitest-browser API in the toggle variant tests - #2689

Merged
balzss merged 1 commit into
masterfrom
fix/ui-checkbox-toggle-variant-tests
Aug 17, 2026
Merged

test(ui-checkbox): use the vitest-browser API in the toggle variant tests#2689
balzss merged 1 commit into
masterfrom
fix/ui-checkbox-toggle-variant-tests

Conversation

@balzss

@balzss balzss commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Convert the toggle variant tests to the vitest-browser API — page.getByRole().element() / .query() and expect.element instead of screen.* and waitFor. This is what fails build:types: screen isn't imported, so it resolves to the DOM global window.screen and tsc reports Property 'getByRole' does not exist on type 'Screen'.
  • await the renderCheckbox calls — render returns Promise<RenderResult>, so the queries were running before React had committed.
  • Pass { 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-pressed behaviour 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). master has been red since — and so is every open PR, because PR checks build the merge ref.

Test Plan

  • No manual verification needed; the three tests now actually run in CI for the first time.
  • Worth a separate look: branch protection on master has strict: true but required_status_checks.contexts: [], so "require branches to be up to date" never engages and this can recur.

Fixes INSTUI-5158

🤖 Generated with Claude Code

…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>
@balzss balzss self-assigned this Aug 17, 2026
@balzss
balzss requested review from joyenjoyer and matyasf August 17, 2026 10:16
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-17 10:50 UTC

@github-actions

Copy link
Copy Markdown
Contributor

Visual regression report

⚠️ Changes detected.

Status Count
Unchanged 0
Changed 1
New 96
Removed 32

📊 View full report

Diff images (33)

alert.png — baseline no longer produced

avatar.png — baseline no longer produced

badge.png — baseline no longer produced

billboard.png — baseline no longer produced

breadcrumb.png — baseline no longer produced

button-and-derivatives.png — baseline no longer produced

byline.png — baseline no longer produced

calendar.png — baseline no longer produced

checkbox.png — baseline no longer produced

checkboxgroup.png — baseline no longer produced

colorpicker.png — baseline no longer produced

contextview.png — baseline no longer produced

custom-and-lucide-icons.png — baseline no longer produced

dateinput-dateinput2.png — baseline no longer produced

datetimeinput.png — baseline no longer produced

diff-demo.png — 6324 pixels differ

drilldown.png — baseline no longer produced

filedrop.png — baseline no longer produced

form-errors.png — baseline no longer produced

heading.png — baseline no longer produced

img.png — baseline no longer produced

link.png — baseline no longer produced

menu.png — baseline no longer produced

metric-pill-tag-timeselect-text.png — baseline no longer produced

options.png — baseline no longer produced

pagination.png — baseline no longer produced

progressbar.png — baseline no longer produced

select-simpleselect.png — baseline no longer produced

table.png — baseline no longer produced

tabs.png — baseline no longer produced

tooltip.png — baseline no longer produced

treebrowser.png — baseline no longer produced

view.png — baseline no longer produced

Baselines come from the visual-baselines branch. They refresh on every merge to master.

github-actions Bot pushed a commit that referenced this pull request Aug 17, 2026
@balzss
balzss merged commit 699c6be into master Aug 17, 2026
10 of 11 checks passed
@balzss
balzss deleted the fix/ui-checkbox-toggle-variant-tests branch August 17, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants