Skip to content

test(gui): replace fireEvent with userEvent in all slider and interactive component tests (t296) #131

@bwyard

Description

@bwyard

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions