|
3 | 3 | describe "MMR/MMRV" do |
4 | 4 | around { |example| travel_to(Date.new(2025, 7, 1)) { example.run } } |
5 | 5 |
|
6 | | - scenario "record a patient born after January 2020 as already had their 1st MMR dose outside the school session" do |
7 | | - given_an_mmr_programme_with_a_session |
8 | | - and_a_patient_is_in_the_session_born_after_january_2020 |
9 | | - and_the_patient_doesnt_need_triage |
10 | | - and_the_patient_has_not_had_a_first_dose |
11 | | - |
12 | | - when_i_go_the_session |
13 | | - then_i_see_one_patient_needing_consent |
14 | | - and_i_click_on_the_patient |
15 | | - then_i_see_the_patient_needs_consent |
16 | | - |
17 | | - when_i_click_record_as_already_had_first_dose |
18 | | - when_i_click_back |
19 | | - then_i_see_the_patient_session_page |
20 | | - |
21 | | - when_i_click_record_as_already_had_first_dose |
22 | | - then_i_see_the_did_you_have_mmr_or_mmrv_page |
23 | | - |
24 | | - when_i_choose_mmr_and_continue |
25 | | - then_i_see_the_mmr_date_page |
26 | | - |
27 | | - when_i_fill_in_the_date_and_continue |
28 | | - then_i_see_the_confirmation_page |
29 | | - and_the_confirmation_summary_is_not_displayed_as_a_warning |
30 | | - |
31 | | - when_i_confirm_the_details |
32 | | - then_i_see_the_patient_is_already_vaccinated |
33 | | - and_i_see_that_the_vaccinator_is_unknown |
34 | | - and_i_see_that_the_location_is_unknown |
35 | | - and_i_see_that_the_reporter_is_set |
36 | | - expect(page).to have_content("LocationUnknown") |
37 | | - and_had_been_vaccinated_with_mmr |
38 | | - and_the_dose_number_is_first |
39 | | - and_the_performed_at_date_only_is_set |
40 | | - and_the_consent_requests_are_sent |
41 | | - then_the_parent_doesnt_receive_a_consent_request |
42 | | - end |
43 | | - |
44 | | - scenario "record a patient born before January 2020 as already had their 1st MMR dose outside the school session" do |
45 | | - given_an_mmr_programme_with_a_session |
46 | | - and_a_patient_is_in_the_session_born_before_january_2020 |
47 | | - and_the_patient_doesnt_need_triage |
48 | | - and_the_patient_has_not_had_a_first_dose |
49 | | - |
50 | | - when_i_go_the_session |
51 | | - then_i_see_one_patient_needing_consent |
52 | | - and_i_click_on_the_patient |
53 | | - then_i_see_the_patient_needs_consent |
54 | | - |
55 | | - when_i_click_record_as_already_had_first_dose |
56 | | - then_i_see_the_mmr_date_instead_of_the_mmr_or_mmrv_page |
57 | | - end |
58 | | - |
59 | | - scenario "record a patient born after January 2020 as already had their 2nd MMRV dose outside the school session" do |
60 | | - given_an_mmr_programme_with_a_session |
61 | | - and_a_patient_is_in_the_session_born_after_january_2020 |
62 | | - and_the_patient_doesnt_need_triage |
63 | | - and_the_patient_already_has_first_dose |
64 | | - |
65 | | - when_i_go_the_session |
66 | | - then_i_see_one_patient_needing_consent |
67 | | - and_i_click_on_the_patient |
68 | | - then_i_see_the_patient_needs_consent |
69 | | - |
70 | | - when_i_click_record_as_already_had_second_dose |
71 | | - then_i_see_the_did_you_have_mmr_or_mmrv_page |
72 | | - |
73 | | - when_i_choose_mmrv_and_continue |
74 | | - then_i_see_the_mmrv_date_page |
75 | | - |
76 | | - when_i_fill_in_the_date_and_time_and_continue |
77 | | - then_i_see_the_confirmation_page |
78 | | - and_the_confirmation_summary_is_not_displayed_as_a_warning |
79 | | - |
80 | | - when_i_confirm_the_details |
81 | | - then_i_see_the_patient_is_already_vaccinated |
82 | | - and_i_see_that_the_vaccinator_is_unknown |
83 | | - and_i_see_that_the_location_is_unknown |
84 | | - and_i_see_that_the_reporter_is_set |
85 | | - and_had_been_vaccinated_with_mmrv |
86 | | - and_the_dose_number_is_second |
87 | | - and_the_performed_at_date_and_time_are_set |
88 | | - and_the_consent_requests_are_sent |
89 | | - then_the_parent_doesnt_receive_a_consent_request |
| 6 | + context "when `already_vaccinated` feature flag is NOT enabled" do |
| 7 | + scenario "record a patient born after January 2020 as already had their 1st MMR dose" do |
| 8 | + given_an_mmr_programme_with_a_session |
| 9 | + and_a_patient_is_in_the_session_born_after_january_2020 |
| 10 | + and_the_patient_doesnt_need_triage |
| 11 | + and_the_patient_has_not_had_a_first_dose |
| 12 | + |
| 13 | + when_i_go_the_session |
| 14 | + then_i_see_one_patient_needing_consent |
| 15 | + and_i_click_on_the_patient |
| 16 | + then_i_see_the_patient_needs_consent |
| 17 | + |
| 18 | + when_i_click_record_as_already_vaccinated |
| 19 | + when_i_click_back |
| 20 | + then_i_see_the_patient_session_page |
| 21 | + |
| 22 | + when_i_click_record_as_already_vaccinated |
| 23 | + then_i_see_the_confirmation_page |
| 24 | + end |
| 25 | + end |
| 26 | + |
| 27 | + context "when `already_vaccinated` feature flag is enabled" do |
| 28 | + before { Flipper.enable(:already_vaccinated) } |
| 29 | + |
| 30 | + scenario "record a patient born after January 2020 as already had their 1st MMR dose outside the school session" do |
| 31 | + given_an_mmr_programme_with_a_session |
| 32 | + and_a_patient_is_in_the_session_born_after_january_2020 |
| 33 | + and_the_patient_doesnt_need_triage |
| 34 | + and_the_patient_has_not_had_a_first_dose |
| 35 | + |
| 36 | + when_i_go_the_session |
| 37 | + then_i_see_one_patient_needing_consent |
| 38 | + and_i_click_on_the_patient |
| 39 | + then_i_see_the_patient_needs_consent |
| 40 | + |
| 41 | + when_i_click_record_as_already_had_first_dose |
| 42 | + when_i_click_back |
| 43 | + then_i_see_the_patient_session_page |
| 44 | + |
| 45 | + when_i_click_record_as_already_had_first_dose |
| 46 | + then_i_see_the_did_you_have_mmr_or_mmrv_page |
| 47 | + |
| 48 | + when_i_choose_mmr_and_continue |
| 49 | + then_i_see_the_mmr_date_page |
| 50 | + |
| 51 | + when_i_fill_in_the_date_and_time_and_continue |
| 52 | + then_i_see_the_confirmation_page |
| 53 | + and_the_confirmation_summary_is_not_displayed_as_a_warning |
| 54 | + |
| 55 | + when_i_confirm_the_details |
| 56 | + then_i_see_the_patient_is_already_vaccinated |
| 57 | + and_i_see_that_the_vaccinator_is_unknown |
| 58 | + and_i_see_that_the_location_is_unknown |
| 59 | + and_i_see_that_the_reporter_is_set |
| 60 | + expect(page).to have_content("LocationUnknown") |
| 61 | + and_had_been_vaccinated_with_mmr |
| 62 | + and_the_dose_number_is_first |
| 63 | + and_the_consent_requests_are_sent |
| 64 | + then_the_parent_doesnt_receive_a_consent_request |
| 65 | + end |
| 66 | + |
| 67 | + scenario "record a patient born before January 2020 as already had their 1st MMR dose outside the school session" do |
| 68 | + given_an_mmr_programme_with_a_session |
| 69 | + and_a_patient_is_in_the_session_born_before_january_2020 |
| 70 | + and_the_patient_doesnt_need_triage |
| 71 | + and_the_patient_has_not_had_a_first_dose |
| 72 | + |
| 73 | + when_i_go_the_session |
| 74 | + then_i_see_one_patient_needing_consent |
| 75 | + and_i_click_on_the_patient |
| 76 | + then_i_see_the_patient_needs_consent |
| 77 | + |
| 78 | + when_i_click_record_as_already_had_first_dose |
| 79 | + then_i_see_the_mmr_date_instead_of_the_mmr_or_mmrv_page |
| 80 | + end |
| 81 | + |
| 82 | + scenario "record a patient born after January 2020 as already had their 2nd MMRV dose outside the school session" do |
| 83 | + given_an_mmr_programme_with_a_session |
| 84 | + and_a_patient_is_in_the_session_born_after_january_2020 |
| 85 | + and_the_patient_doesnt_need_triage |
| 86 | + and_the_patient_already_has_first_dose |
| 87 | + |
| 88 | + when_i_go_the_session |
| 89 | + then_i_see_one_patient_needing_consent |
| 90 | + and_i_click_on_the_patient |
| 91 | + then_i_see_the_patient_needs_consent |
| 92 | + |
| 93 | + when_i_click_record_as_already_had_second_dose |
| 94 | + then_i_see_the_did_you_have_mmr_or_mmrv_page |
| 95 | + |
| 96 | + when_i_choose_mmrv_and_continue |
| 97 | + then_i_see_the_mmrv_date_page |
| 98 | + |
| 99 | + when_i_fill_in_the_date_and_continue |
| 100 | + then_i_see_the_confirmation_page |
| 101 | + and_the_confirmation_summary_is_not_displayed_as_a_warning |
| 102 | + |
| 103 | + when_i_confirm_the_details |
| 104 | + then_i_see_the_patient_is_already_vaccinated |
| 105 | + and_i_see_that_the_vaccinator_is_unknown |
| 106 | + and_i_see_that_the_location_is_unknown |
| 107 | + and_i_see_that_the_reporter_is_set |
| 108 | + and_had_been_vaccinated_with_mmrv |
| 109 | + and_the_dose_number_is_second |
| 110 | + and_the_consent_requests_are_sent |
| 111 | + then_the_parent_doesnt_receive_a_consent_request |
| 112 | + end |
90 | 113 | end |
91 | 114 |
|
92 | 115 | def given_an_mmr_programme_with_a_session(clinic: false) |
@@ -169,6 +192,10 @@ def then_i_see_the_patient_needs_consent |
169 | 192 | expect(page).to have_content("No response") |
170 | 193 | end |
171 | 194 |
|
| 195 | + def when_i_click_record_as_already_vaccinated |
| 196 | + click_on "Record as already vaccinated" |
| 197 | + end |
| 198 | + |
172 | 199 | def when_i_click_record_as_already_had_first_dose |
173 | 200 | click_on "Record 1st dose as already given" |
174 | 201 | end |
@@ -294,12 +321,16 @@ def and_the_dose_number_is_second |
294 | 321 | end |
295 | 322 |
|
296 | 323 | def and_the_performed_at_date_and_time_are_set |
297 | | - expect(page).to have_content("Date#{@vaccination_date.strftime('%-d %B %Y')}") |
| 324 | + expect(page).to have_content( |
| 325 | + "Date#{@vaccination_date.strftime("%-d %B %Y")}" |
| 326 | + ) |
298 | 327 | expect(page).to have_content("Time12:30") |
299 | 328 | end |
300 | 329 |
|
301 | 330 | def and_the_performed_at_date_only_is_set |
302 | | - expect(page).to have_content("Date#{@vaccination_date.strftime('%-d %B %Y')}") |
| 331 | + expect(page).to have_content( |
| 332 | + "Date#{@vaccination_date.strftime("%-d %B %Y")}" |
| 333 | + ) |
303 | 334 | end |
304 | 335 |
|
305 | 336 | def and_the_consent_requests_are_sent |
|
0 commit comments