|
27 | 27 | SessionsRecordVaccinationsPage, |
28 | 28 | SessionsSearchPage, |
29 | 29 | ) |
30 | | -from mavis.test.pages.utils import ( |
31 | | - record_gillick_competence_and_self_consent, |
32 | | - schedule_school_session_if_needed, |
33 | | -) |
| 30 | +from mavis.test.pages.utils import schedule_school_session_if_needed |
34 | 31 | from mavis.test.utils import expect_alert_text |
35 | 32 |
|
36 | 33 |
|
@@ -78,57 +75,94 @@ def session_with_child_for_programme( |
78 | 75 | indirect=True, |
79 | 76 | ids=lambda v: f"{v[0]}-{v[1]}", |
80 | 77 | ) |
81 | | -def test_gillick(session_with_child_for_programme, children, schools, page): |
| 78 | +def test_gillick_competence_consent_and_vaccination( |
| 79 | + session_with_child_for_programme, children, schools, page, add_vaccine_batch |
| 80 | +): |
82 | 81 | """ |
83 | | - Test: Add and edit Gillick competence assessment for a child. |
| 82 | + Test: Record Gillick competence, child self-consent, and vaccination. |
84 | 83 |
|
85 | 84 | Steps: |
86 | | - 1. Open the session for the school and programme. |
87 | | - 2. Navigate to Gillick competence assessment for the child. |
88 | | - 3. Add a Gillick competence assessment as competent. |
89 | | - 4. Edit the assessment to mark as not competent. |
| 85 | + 1. Open the session and navigate to the child's programme tab. |
| 86 | + 2. Assess Gillick competence as competent. |
| 87 | + 3. Record child self-consent. |
| 88 | + 4. Verify Gillick competence status appears on offline sheet. |
| 89 | + 5. Set session in progress and register child as attending. |
| 90 | + 6. Add vaccine batch and record vaccination for the child. |
| 91 | + 7. Verify vaccination is recorded and appears in child record. |
90 | 92 |
|
91 | 93 | Expectations: |
92 | | - - Gillick competence status is updated and reflected for the child. |
| 94 | + - Gillick competence is recorded as competent and verified. |
| 95 | + - Child self-consent is recorded successfully. |
| 96 | + - Vaccination is recorded for the child and appears in their record. |
93 | 97 | """ |
94 | | - |
95 | | - programme, _ = session_with_child_for_programme |
| 98 | + programme, consent_option = session_with_child_for_programme |
96 | 99 | child = children[programme.group][0] |
97 | 100 | school = schools[programme.group][0] |
98 | 101 |
|
| 102 | + vaccine = programme.get_default_vaccine(consent_option) |
| 103 | + batch_name = add_vaccine_batch(vaccine) |
| 104 | + |
99 | 105 | dashboard_page = DashboardPage(page) |
100 | | - gillick_competence_page = GillickCompetencePage(page) |
101 | | - sessions_children_page = SessionsChildrenPage(page) |
102 | | - sessions_overview_page = SessionsOverviewPage(page) |
103 | | - sessions_patient_page = SessionsPatientPage(page) |
104 | | - sessions_search_page = SessionsSearchPage(page) |
| 106 | + dashboard_page.header.click_mavis() |
| 107 | + dashboard_page.click_sessions() |
| 108 | + SessionsSearchPage(page).click_session_for_programmes(school, [programme]) |
105 | 109 |
|
| 110 | + sessions_overview_page = SessionsOverviewPage(page) |
106 | 111 | sessions_overview_page.tabs.click_children_tab() |
| 112 | + |
| 113 | + sessions_children_page = SessionsChildrenPage(page) |
107 | 114 | sessions_children_page.search.search_and_click_child(child) |
| 115 | + |
| 116 | + sessions_patient_page = SessionsPatientPage(page) |
108 | 117 | sessions_patient_page.click_programme_tab(programme) |
109 | 118 | sessions_patient_page.click_assess_gillick_competence() |
| 119 | + |
| 120 | + gillick_competence_page = GillickCompetencePage(page) |
110 | 121 | gillick_competence_page.add_gillick_competence(is_competent=True) |
111 | 122 |
|
112 | | - sessions_children_page.header.click_mavis() |
| 123 | + sessions_patient_page.click_record_a_new_consent_response() |
| 124 | + |
| 125 | + nurse_consent_wizard_page = NurseConsentWizardPage(page) |
| 126 | + nurse_consent_wizard_page.select_gillick_competent_child() |
| 127 | + nurse_consent_wizard_page.record_child_given_consent(programme, consent_option) |
| 128 | + expect_alert_text(page, f"Consent recorded for {child!s}") |
| 129 | + |
| 130 | + sessions_patient_page.header.click_mavis() |
113 | 131 | dashboard_page.click_sessions() |
114 | | - sessions_search_page.click_session_for_programmes(school, [programme]) |
| 132 | + SessionsSearchPage(page).click_session_for_programmes(school, [programme]) |
115 | 133 | sessions_overview_page.verify_offline_sheet_gillick_competence( |
116 | 134 | child, competent=True |
117 | 135 | ) |
118 | 136 |
|
| 137 | + sessions_overview_page.click_set_session_in_progress_for_today() |
119 | 138 | sessions_overview_page.tabs.click_children_tab() |
120 | | - sessions_children_page.search.search_and_click_child(child) |
121 | | - sessions_patient_page.click_programme_tab(programme) |
122 | | - sessions_patient_page.click_edit_gillick_competence() |
123 | | - gillick_competence_page.edit_gillick_competence(is_competent=False) |
| 139 | + sessions_children_page.register_child_as_attending(child) |
124 | 140 |
|
125 | | - sessions_children_page.header.click_mavis() |
126 | | - dashboard_page.click_sessions() |
127 | | - sessions_search_page.click_session_for_programmes(school, [programme]) |
128 | | - sessions_overview_page.verify_offline_sheet_gillick_competence( |
129 | | - child, competent=False |
| 141 | + sessions_children_page.tabs.click_record_vaccinations_tab() |
| 142 | + sessions_record_vaccinations_page = SessionsRecordVaccinationsPage(page) |
| 143 | + sessions_record_vaccinations_page.search.search_and_click_child(child) |
| 144 | + |
| 145 | + vaccination_record = VaccinationRecord(child, programme, batch_name, consent_option) |
| 146 | + sessions_patient_page.set_up_vaccination(vaccination_record) |
| 147 | + |
| 148 | + record_vaccination_wizard_page = RecordVaccinationWizardPage(page) |
| 149 | + record_vaccination_wizard_page.record_vaccination( |
| 150 | + vaccination_record, test_recording_twice=True |
130 | 151 | ) |
131 | 152 |
|
| 153 | + record_vaccination_wizard_page.header.click_mavis() |
| 154 | + dashboard_page.click_children() |
| 155 | + |
| 156 | + children_search_page = ChildrenSearchPage(page) |
| 157 | + children_search_page.search.search_for_child_name_with_all_filters(str(child)) |
| 158 | + children_search_page.search.click_child(child) |
| 159 | + |
| 160 | + child_record_page = ChildRecordPage(page) |
| 161 | + child_record_page.click_programme(programme) |
| 162 | + |
| 163 | + child_programme_page = ChildProgrammePage(page) |
| 164 | + child_programme_page.verify_one_vaccination_appears() |
| 165 | + |
132 | 166 |
|
133 | 167 | @issue("MAV-955") |
134 | 168 | @pytest.mark.parametrize( |
@@ -274,149 +308,3 @@ def test_gillick_override_conflicting_from_parent( |
274 | 308 | sessions_patient_session_activity_page.check_session_activity_entry( |
275 | 309 | f"Consent given by {child!s} (Child (Gillick competent))", |
276 | 310 | ) |
277 | | - |
278 | | - |
279 | | -@pytest.mark.parametrize( |
280 | | - "session_with_child_for_programme", |
281 | | - programmes_and_consent_options, |
282 | | - indirect=True, |
283 | | - ids=lambda v: f"{v[0]}-{v[1]}", |
284 | | -) |
285 | | -def test_gillick_consent_and_vaccination( |
286 | | - session_with_child_for_programme, children, schools, page, add_vaccine_batch |
287 | | -): |
288 | | - """ |
289 | | - Test: Record Gillick competence, child self-consent, and vaccination. |
290 | | -
|
291 | | - Steps: |
292 | | - 1. Open the session and consent tab for the child. |
293 | | - 2. Assess Gillick competence as competent. |
294 | | - 3. Record child self-consent. |
295 | | - 4. Set session in progress and register child as attending. |
296 | | - 5. Add vaccine batch and record vaccination for the child. |
297 | | - 6. Verify vaccination is recorded and appears in child record. |
298 | | -
|
299 | | - Expectations: |
300 | | - - Gillick competence is recorded as competent. |
301 | | - - Child self-consent is recorded successfully. |
302 | | - - Vaccination is recorded for the child. |
303 | | - - Vaccination appears in the child's record. |
304 | | - """ |
305 | | - programme, consent_option = session_with_child_for_programme |
306 | | - child = children[programme.group][0] |
307 | | - school = schools[programme.group][0] |
308 | | - |
309 | | - vaccine = programme.get_default_vaccine(consent_option) |
310 | | - batch_name = add_vaccine_batch(vaccine) |
311 | | - |
312 | | - dashboard_page = DashboardPage(page) |
313 | | - dashboard_page.header.click_mavis() |
314 | | - dashboard_page.click_sessions() |
315 | | - SessionsSearchPage(page).click_session_for_programmes(school, [programme]) |
316 | | - |
317 | | - sessions_overview_page = SessionsOverviewPage(page) |
318 | | - sessions_overview_page.tabs.click_children_tab() |
319 | | - |
320 | | - sessions_children_page = SessionsChildrenPage(page) |
321 | | - sessions_children_page.search.search_and_click_child(child) |
322 | | - |
323 | | - sessions_patient_page = SessionsPatientPage(page) |
324 | | - sessions_patient_page.click_programme_tab(programme) |
325 | | - |
326 | | - record_gillick_competence_and_self_consent(page, child, programme, consent_option) |
327 | | - |
328 | | - sessions_patient_page.header.click_mavis() |
329 | | - dashboard_page.click_sessions() |
330 | | - SessionsSearchPage(page).click_session_for_programmes(school, [programme]) |
331 | | - sessions_overview_page.click_set_session_in_progress_for_today() |
332 | | - sessions_overview_page.tabs.click_children_tab() |
333 | | - sessions_children_page.register_child_as_attending(child) |
334 | | - |
335 | | - sessions_children_page.tabs.click_record_vaccinations_tab() |
336 | | - sessions_record_vaccinations_page = SessionsRecordVaccinationsPage(page) |
337 | | - sessions_record_vaccinations_page.search.search_and_click_child(child) |
338 | | - |
339 | | - vaccination_record = VaccinationRecord(child, programme, batch_name, consent_option) |
340 | | - sessions_patient_page.set_up_vaccination(vaccination_record) |
341 | | - |
342 | | - record_vaccination_wizard_page = RecordVaccinationWizardPage(page) |
343 | | - record_vaccination_wizard_page.record_vaccination( |
344 | | - vaccination_record, test_recording_twice=True |
345 | | - ) |
346 | | - |
347 | | - record_vaccination_wizard_page.header.click_mavis() |
348 | | - dashboard_page.click_children() |
349 | | - |
350 | | - children_search_page = ChildrenSearchPage(page) |
351 | | - children_search_page.search.search_for_child_name_with_all_filters(str(child)) |
352 | | - children_search_page.search.click_child(child) |
353 | | - |
354 | | - child_record_page = ChildRecordPage(page) |
355 | | - child_record_page.click_programme(programme) |
356 | | - |
357 | | - child_programme_page = ChildProgrammePage(page) |
358 | | - child_programme_page.verify_one_vaccination_appears() |
359 | | - |
360 | | - |
361 | | -@pytest.mark.parametrize( |
362 | | - "session_with_child_for_programme", |
363 | | - programmes_and_consent_options, |
364 | | - indirect=True, |
365 | | - ids=lambda v: f"{v[0]}-{v[1]}", |
366 | | -) |
367 | | -def test_gillick_consent_and_vaccination_next_day_not_possible( |
368 | | - session_with_child_for_programme, children, schools, page |
369 | | -): |
370 | | - """ |
371 | | - Test: Verify that Gillick consent given on day A cannot be used |
372 | | - to vaccinate on day B. |
373 | | -
|
374 | | - Steps: |
375 | | - 1. Open the session and consent tab for the child (day 0). |
376 | | - 2. Assess Gillick competence as competent. |
377 | | - 3. Record child self-consent. |
378 | | - 4. Create a new session for the next day (day 1). |
379 | | - 5. Set the next day's session in progress. |
380 | | - 6. Attempt to record vaccination for the child on day 1. |
381 | | -
|
382 | | - Expectations: |
383 | | - - Gillick competence is recorded as competent on day 0. |
384 | | - - Child self-consent is recorded successfully on day 0. |
385 | | - - Child cannot be found for vaccination on day 1's session. |
386 | | - - Vaccination recording fails due to consent being tied to the |
387 | | - previous day's session. |
388 | | - """ |
389 | | - programme, consent_option = session_with_child_for_programme |
390 | | - child = children[programme.group][0] |
391 | | - school = schools[programme.group][0] |
392 | | - |
393 | | - dashboard_page = DashboardPage(page) |
394 | | - dashboard_page.header.click_mavis() |
395 | | - dashboard_page.click_sessions() |
396 | | - SessionsSearchPage(page).click_session_for_programmes(school, [programme]) |
397 | | - |
398 | | - sessions_overview_page = SessionsOverviewPage(page) |
399 | | - sessions_overview_page.tabs.click_children_tab() |
400 | | - |
401 | | - sessions_children_page = SessionsChildrenPage(page) |
402 | | - sessions_children_page.search.search_and_click_child(child) |
403 | | - |
404 | | - sessions_patient_page = SessionsPatientPage(page) |
405 | | - sessions_patient_page.click_programme_tab(programme) |
406 | | - |
407 | | - record_gillick_competence_and_self_consent(page, child, programme, consent_option) |
408 | | - |
409 | | - sessions_patient_page.header.click_mavis() |
410 | | - dashboard_page.click_sessions() |
411 | | - year_group = child.year_group |
412 | | - schedule_school_session_if_needed( |
413 | | - page, school, [programme], [year_group], date_offset=1 |
414 | | - ) |
415 | | - |
416 | | - sessions_overview_page.click_set_session_in_progress_for_today() |
417 | | - |
418 | | - sessions_overview_page.tabs.click_record_vaccinations_tab() |
419 | | - sessions_record_vaccinations_page = SessionsRecordVaccinationsPage(page) |
420 | | - sessions_record_vaccinations_page.search.search_for_child_that_should_not_exist( |
421 | | - child |
422 | | - ) |
0 commit comments