Skip to content

fix: TomSelect test helper flake — use JS value-set instead of send_keys - #2752

Merged
mroderick merged 2 commits into
masterfrom
fix/tomselect-flake-2
Jul 28, 2026
Merged

fix: TomSelect test helper flake — use JS value-set instead of send_keys#2752
mroderick merged 2 commits into
masterfrom
fix/tomselect-flake-2

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

What

Replace send_keys with JS value-set + dispatchEvent('input') in the TomSelect test helper. Bypasses the keystroke synthesis pipeline that can race with TomSelect's 300ms loadThrottle debounce timer under CPU contention in parallel CI.

Why

select_from_tom_select intermittently times out waiting for .ts-dropdown .option in headless CI (observed in PR #2750, Group 1, seed 55042). The existing focus fix (PR #2741) reduced but didn't eliminate the flake.

Root cause: send_keys dispatches 3 rapid keystrokes, each resetting TomSelect's internal setTimeout(300) for the load callback. The debounce timer can starve when parallel test processes contend for CPU, and the AJAX search never fires.

Fix: set input.value and dispatch new Event('input', {bubbles: true}) via execute_script. No focus dependency, no rapid-keystroke race, just one direct mutation that TomSelect's onInput handler processes synchronously.

Verification

  • 120/120 passes of all TomSelect feature tests (managing_meeting_invitations_spec.rb + meeting_spec.rb) in 10 sequential runs
  • RuboCop clean

@mroderick
mroderick marked this pull request as ready for review July 28, 2026 16:03
@mroderick
mroderick merged commit b83ba84 into master Jul 28, 2026
10 checks passed
@mroderick
mroderick deleted the fix/tomselect-flake-2 branch July 28, 2026 16:03
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.

1 participant