Summary
Several GUI component tests use @testing-library/react's fireEvent to simulate user interactions on sliders, buttons, and toggles. fireEvent fires a single DOM event and skips the browser's natural event sequence. userEvent simulates real user behaviour — pointerdown, pointermove, pointerup, focus, etc. — which catches more bugs and matches how Score Studio is actually used.
What to change
In packages/gui/tests/ and any *.test.tsx files:
// Before
fireEvent.change(slider, { target: { value: '0.8' } })
// After
import userEvent from '@testing-library/user-event'
const user = userEvent.setup()
await user.pointer([
{ target: slider, keys: '[MouseLeft>]', coords: { x: 100 } },
{ coords: { x: 200 } },
{ keys: '[/MouseLeft]' },
])
For button/toggle interactions:
// Before
fireEvent.click(muteButton)
// After
await user.click(muteButton)
Scope
Run this to find all fireEvent usages in GUI tests:
grep -rn "fireEvent" packages/gui/tests/
Replace each one with the appropriate userEvent equivalent. Each component can be a separate commit.
Notes
@testing-library/user-event is already installed — check packages/gui/package.json
- Tests that use
fireEvent.change on <input type="range"> (sliders) are the highest priority — slider drag behaviour is the most likely place real bugs hide
- Must not reduce test coverage — all existing assertions should still pass
Good first issue — mechanical change with a clear target list, improves test accuracy, no new features.
Summary
Several GUI component tests use
@testing-library/react'sfireEventto simulate user interactions on sliders, buttons, and toggles.fireEventfires a single DOM event and skips the browser's natural event sequence.userEventsimulates real user behaviour — pointerdown, pointermove, pointerup, focus, etc. — which catches more bugs and matches how Score Studio is actually used.What to change
In
packages/gui/tests/and any*.test.tsxfiles:For button/toggle interactions:
Scope
Run this to find all
fireEventusages in GUI tests:grep -rn "fireEvent" packages/gui/tests/Replace each one with the appropriate
userEventequivalent. Each component can be a separate commit.Notes
@testing-library/user-eventis already installed — checkpackages/gui/package.jsonfireEvent.changeon<input type="range">(sliders) are the highest priority — slider drag behaviour is the most likely place real bugs hideGood first issue — mechanical change with a clear target list, improves test accuracy, no new features.