Fix: Flaky tests in CI#2610
Merged
olleolleolle merged 1 commit intocodebar:masterfrom May 7, 2026
Merged
Conversation
Fix two flaky tests that were failing intermittently in CI:
1. spec/features/listing_coaches_spec.rb:2
- Changed to use a workshop with a date in the current year (beginning_of_year + 1.month)
instead of the default future date to ensure the coach is counted for the current year query
- Added 5 second wait to the expectation for page load timing
2. spec/features/admin/manage_workshop_attendances_spec.rb:25
- Added explicit wait for '.cancel_attendance' element to be present
before attempting to click it
- This ensures the element is rendered before interaction
These changes make the tests more robust in parallel CI execution where
timing and database state can vary between test runs.
olleolleolle
approved these changes
May 7, 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.
This PR fixes two flaky tests that were failing intermittently in CI parallel test execution.
Fixed Tests
1.
spec/features/listing_coaches_spec.rb:2- "I can see the most active coaches"Problem: The test was using the default workshop fabricator which creates a workshop 2 days in the future. In parallel CI execution with database timing issues, this could cause the coach to not appear in the query results for the current year.
Fix:
Time.zone.today.beginning_of_year + 1.month) to ensure it's counted in the current year query2.
spec/features/admin/manage_workshop_attendances_spec.rb:25- "can remove a member from the attendee list"Problem: The test was immediately trying to find and click the
.cancel_attendanceelement after visiting the page. In CI with parallel execution, the element might not be rendered yet when Capybara tries to interact with it.Fix:
.cancel_attendanceelement to be present before attempting to click itChanges
spec/features/listing_coaches_spec.rb: Use current year date, add waitspec/features/admin/manage_workshop_attendances_spec.rb: Add wait for elementVerification
Both tests pass consistently locally and should be more reliable in CI parallel execution.