Skip to content

Commit

Permalink
Fix flaky manage attendance feature test (#2774)
Browse files Browse the repository at this point in the history
Instead of picking the last patient (which doesn't have a guaranteed
order) we can pick the patient that will be left on the page, i.e. the
patient that's missing attendance information.

This has been extracted from #2771.

Example failures:

-
https://github.com/nhsuk/manage-vaccinations-in-schools/actions/runs/12389409160/attempts/2
-
https://github.com/nhsuk/manage-vaccinations-in-schools/actions/runs/12389403286/attempts/2
  • Loading branch information
thomasleese authored Dec 18, 2024
2 parents edd43dd + c28cdd5 commit fb3d7be
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spec/features/manage_attendance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ def when_i_register_a_patient_as_absent
end

def when_i_go_to_a_patient
click_link @session.reload.patients.last.full_name
click_link PatientSession
.where
.missing(:session_attendances)
.find_by(session: @session)
.patient
.full_name
end

def then_the_patient_is_not_registered_yet
Expand Down

0 comments on commit fb3d7be

Please sign in to comment.