fix: replace blind sleep in TomSelect helper with adaptive Capybara wait#2704
Open
mroderick wants to merge 2 commits into
Open
fix: replace blind sleep in TomSelect helper with adaptive Capybara wait#2704mroderick wants to merge 2 commits into
mroderick wants to merge 2 commits into
Conversation
The select_from_tom_select helper used a blind sleep 0.5 between typing the first 3 characters and the remaining ones. In CI under resource contention, the 300ms TomSelect debounce + AJAX fetch could exceed this fixed wait, causing the dropdown never to appear. Replace the sleep with an adaptive Capybara have_css wait (15s timeout) for the .ts-dropdown .option to appear after the initial search trigger. This gives slow CI environments enough time while fast environments don't waste a fixed wait.
…p spec The sleep 0.5 between typing 'Ja' and 'ne' was doing nothing — TomSelect's shouldLoad requires >= 3 characters, so no AJAX fires on the initial 2-char input. The real wait is for the AJAX response after the full query is typed. Bumped all TomSelect-related waits from 5s to 15s for consistency with the shared select_from_tom_select helper, reducing flake risk under CI load.
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.
Problem
Two timing issues in TomSelect test interactions were producing CI flakes:
select_from_tom_selecthelper — used a blindsleep 0.5between typing the first 3 chars (triggeringshouldLoad+ AJAX) and the remaining chars. Under CI resource contention, the 300ms debounce + AJAX could exceed 0.5s. Observed on PR fix: move EventHelper from app/helpers to app/models/concerns #2702 (group 5, seed 64177):tom_select_member_lookup_spec.rb— samesleep 0.5between 2-char and remainder sends (but this sleep was doing nothing:shouldLoadrequires >=3 chars, so the 2-char first send never triggers AJAX). Also had tightwait: 5waits for AJAX-driven.ts-dropdown .option.Fix
Helper (
select_from_tom_select): Replacesleep 0.5with an adaptivehave_csswait (15s) for the dropdown to render after the initial 3-char search. Addedtext:matcher on the second dropdown wait to confirm refined search results are rendered.Spec (
tom_select_member_lookup_spec.rb): Remove the deadsleep 0.5. Bump all TomSelect-related waits from 5s to 15s for consistency with the helper.Verification
make test): 1106 examples, 0 failures