Skip to content

Commit 8022f08

Browse files
committed
fix: flaky tests in CI
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.
1 parent b381129 commit 8022f08

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

spec/features/admin/manage_workshop_attendances_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
scenario 'can remove a member from the attendee list' do
2626
visit admin_workshop_path(workshop)
27+
expect(page).to have_css('.cancel_attendance', wait: 5)
2728
find('.cancel_attendance').click
2829

2930
expect(page).to have_content('0 are attending as students')

spec/features/listing_coaches_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
RSpec.feature 'when visiting the coaches page', type: :feature do
22
scenario 'I can see the most active coaches' do
3-
coach = Fabricate(:attended_coach).member
3+
# Use a past workshop date in the current year to ensure the coach is counted
4+
workshop = Fabricate(:workshop, date_and_time: Time.zone.today.beginning_of_year + 1.month)
5+
coach = Fabricate(:attended_coach, workshop: workshop).member
46
visit coaches_path
5-
expect(page).to have_content coach.name
7+
expect(page).to have_content(coach.name, wait: 5)
68
end
79

810
scenario 'I can see the top coaches by year' do

0 commit comments

Comments
 (0)