|
8 | 8 | Programme, |
9 | 9 | ) |
10 | 10 | from mavis.test.data import ClassFileMapping |
| 11 | +from mavis.test.data_models import VaccinationRecord |
11 | 12 | from mavis.test.pages import ( |
| 13 | + ChildProgrammePage, |
| 14 | + ChildRecordPage, |
| 15 | + ChildrenSearchPage, |
12 | 16 | DashboardPage, |
13 | 17 | GillickCompetencePage, |
14 | 18 | ImportRecordsWizardPage, |
15 | 19 | NurseConsentWizardPage, |
| 20 | + RecordVaccinationWizardPage, |
16 | 21 | SchoolChildrenPage, |
17 | 22 | SchoolsSearchPage, |
18 | 23 | SessionsChildrenPage, |
19 | 24 | SessionsOverviewPage, |
20 | 25 | SessionsPatientPage, |
21 | 26 | SessionsPatientSessionActivityPage, |
| 27 | + SessionsRecordVaccinationsPage, |
22 | 28 | SessionsSearchPage, |
23 | 29 | ) |
24 | 30 | from mavis.test.pages.utils import schedule_school_session_if_needed |
@@ -69,57 +75,94 @@ def session_with_child_for_programme( |
69 | 75 | indirect=True, |
70 | 76 | ids=lambda v: f"{v[0]}-{v[1]}", |
71 | 77 | ) |
72 | | -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 | +): |
73 | 81 | """ |
74 | | - Test: Add and edit Gillick competence assessment for a child. |
| 82 | + Test: Record Gillick competence, child self-consent, and vaccination. |
75 | 83 |
|
76 | 84 | Steps: |
77 | | - 1. Open the session for the school and programme. |
78 | | - 2. Navigate to Gillick competence assessment for the child. |
79 | | - 3. Add a Gillick competence assessment as competent. |
80 | | - 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. |
81 | 92 |
|
82 | 93 | Expectations: |
83 | | - - 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. |
84 | 97 | """ |
85 | | - |
86 | | - programme, _ = session_with_child_for_programme |
| 98 | + programme, consent_option = session_with_child_for_programme |
87 | 99 | child = children[programme.group][0] |
88 | 100 | school = schools[programme.group][0] |
89 | 101 |
|
| 102 | + vaccine = programme.get_default_vaccine(consent_option) |
| 103 | + batch_name = add_vaccine_batch(vaccine) |
| 104 | + |
90 | 105 | dashboard_page = DashboardPage(page) |
91 | | - gillick_competence_page = GillickCompetencePage(page) |
92 | | - sessions_children_page = SessionsChildrenPage(page) |
93 | | - sessions_overview_page = SessionsOverviewPage(page) |
94 | | - sessions_patient_page = SessionsPatientPage(page) |
95 | | - 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]) |
96 | 109 |
|
| 110 | + sessions_overview_page = SessionsOverviewPage(page) |
97 | 111 | sessions_overview_page.tabs.click_children_tab() |
| 112 | + |
| 113 | + sessions_children_page = SessionsChildrenPage(page) |
98 | 114 | sessions_children_page.search.search_and_click_child(child) |
| 115 | + |
| 116 | + sessions_patient_page = SessionsPatientPage(page) |
99 | 117 | sessions_patient_page.click_programme_tab(programme) |
100 | 118 | sessions_patient_page.click_assess_gillick_competence() |
| 119 | + |
| 120 | + gillick_competence_page = GillickCompetencePage(page) |
101 | 121 | gillick_competence_page.add_gillick_competence(is_competent=True) |
102 | 122 |
|
103 | | - 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() |
104 | 131 | dashboard_page.click_sessions() |
105 | | - sessions_search_page.click_session_for_programmes(school, [programme]) |
| 132 | + SessionsSearchPage(page).click_session_for_programmes(school, [programme]) |
106 | 133 | sessions_overview_page.verify_offline_sheet_gillick_competence( |
107 | 134 | child, competent=True |
108 | 135 | ) |
109 | 136 |
|
| 137 | + sessions_overview_page.click_set_session_in_progress_for_today() |
110 | 138 | sessions_overview_page.tabs.click_children_tab() |
111 | | - sessions_children_page.search.search_and_click_child(child) |
112 | | - sessions_patient_page.click_programme_tab(programme) |
113 | | - sessions_patient_page.click_edit_gillick_competence() |
114 | | - gillick_competence_page.edit_gillick_competence(is_competent=False) |
| 139 | + sessions_children_page.register_child_as_attending(child) |
115 | 140 |
|
116 | | - sessions_children_page.header.click_mavis() |
117 | | - dashboard_page.click_sessions() |
118 | | - sessions_search_page.click_session_for_programmes(school, [programme]) |
119 | | - sessions_overview_page.verify_offline_sheet_gillick_competence( |
120 | | - 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 |
121 | 151 | ) |
122 | 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 | + |
123 | 166 |
|
124 | 167 | @issue("MAV-955") |
125 | 168 | @pytest.mark.parametrize( |
|
0 commit comments