Fix flaky add-all-chapters feature spec - #2863
Merged
Merged
Conversation
The spec asserted the Chosen dropdown closed after clicking "Add to all". Chosen's input_focus handler schedules container_mousedown 50ms after a focus event on the search field while the dropdown is inactive, which re-opens the dropdown after the spec's chosen:close. In CI this left the dropdown open past the 5s Capybara wait and the negative CSS assertion failed (run 34354614220, Group 5). The dropdown re-opened with all chapters already selected, and the Save button sits below the dropdown, so the assertion was not needed for the interaction. Replace it with a positive assertion that all chapters render as selected choices, which is the outcome the scenario tests.
mroderick
marked this pull request as ready for review
September 9, 2026 14:48
KimberleyCook
approved these changes
Sep 9, 2026
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.
Summary
Fixes a flaky JavaScript feature spec.
spec/features/admin/manage_event_spec.rb("adding all chapters to an event with one click") asserted that the Chosen dropdown closes after clicking "Add to all". That assertion races with Chosen's focus handling and failed in CI (run 34354614220, Group 5), then passed on re-run of the identical commit.The re-open comes from Chosen's own
input_focushandler: for multiple selects it schedulescontainer_mousedown()50ms after a focus event on the search field while the dropdown is inactive. That re-opens the dropdown after the add-all click handler'schosen:close, and nothing closes it again. All chapters were already selected at that point, and the Save button sits below the dropdown, so the close assertion guarded nothing the scenario depends on.have_no_cssdropdown-closed assertion with a positive one: all chapters render as selected choicesFailure from CI
Note the found match shows all four chapters already selected while the dropdown was open.