Race Condition Check: spec/system/case_court_reports/index_spec.rb#6757
Merged
compwron merged 2 commits intorubyforgood:mainfrom Mar 9, 2026
Merged
Conversation
Remove ActiveRecord precondition/postcondition checks and the wait_for_report_attachment polling helper from the court report generation test. Use Capybara's built-in wait/retry to assert button state, download icon, and spinner visibility instead. This eliminates race conditions on CI where the DB check could execute before the browser action completed.
The test no longer verifies ActiveStorage attachment directly, so rename from "generates and attaches" to "generates a report and opens the download link" to match what is actually asserted.
1e43e16 to
d4bd23c
Compare
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.
Resolves #6700
Summary
attached?,reload,wait_for_report_attachment) with page-based Capybara checks in the "generates and attaches a report on success" test. The button re-enabling, download icon visibility, and spinner state serve as reliable page-level signals that the report was generated successfully.wait_for_report_attachmenthelper method (only used in this one test). The two remaining helpers (open_court_report_modal,open_case_select2_dropdown) are unchanged.All other tests in the file already used
expect(page)exclusively — no changes needed.Test plan
bundle exec rspec spec/system/case_court_reports/index_spec.rbpasses with 0 failuresreload,attached?, orwait_for_report_attachmentcalls remain in the spec