Skip to content

Commit 19f826b

Browse files
Merge pull request #35 from NHSDigital:20241126
RAV refuse
2 parents 6040ff9 + 5b4b0e9 commit 19f826b

File tree

3 files changed

+82
-15
lines changed

3 files changed

+82
-15
lines changed

pages/pg_parental_consent.py

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class pg_parental_consent:
4141
TXT_ADDRESS_POSTCODE = "Postcode"
4242
RDO_YES = "Yes"
4343
RDO_NO = "No"
44-
TXT_DETAILS = "Give details"
44+
TXT_GIVE_DETAILS = "Give details"
4545
BTN_CONFIRM = "Confirm"
4646
LBL_SCHOOL_NAME = "school-name"
4747
RDO_VACCINE_ALREADY_RECEIVED = "Vaccine already received"
@@ -54,6 +54,8 @@ class pg_parental_consent:
5454
RDO_NO_THEY_DO_NOT_AGREE = "No, they do not agree"
5555
RDO_NO_RESPONSE = "No response"
5656
RDO_YES_SAFE_TO_VACCINATE = "Yes, it’s safe to vaccinate"
57+
LBL_CONSENT_RECORDED = "Consent recorded for CF"
58+
LBL_MAIN = "main"
5759

5860
def click_start_now(self):
5961
self.po.perform_action(locator=self.BTN_START_NOW, action=actions.CLICK_BUTTON)
@@ -132,31 +134,31 @@ def select_severe_allergies(self, allergy_details: str = data_values.EMPTY) -> N
132134
self.po.perform_action(locator=self.RDO_NO, action=actions.RADIO_BUTTON_SELECT)
133135
else:
134136
self.po.perform_action(locator=self.RDO_YES, action=actions.RADIO_BUTTON_SELECT)
135-
self.po.perform_action(locator=self.TXT_DETAILS, action=actions.FILL, value=allergy_details)
137+
self.po.perform_action(locator=self.TXT_GIVE_DETAILS, action=actions.FILL, value=allergy_details)
136138
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
137139

138140
def select_medical_condition(self, medical_condition_details: str = data_values.EMPTY) -> None:
139141
if medical_condition_details == data_values.EMPTY:
140142
self.po.perform_action(locator=self.RDO_NO, action=actions.RADIO_BUTTON_SELECT)
141143
else:
142144
self.po.perform_action(locator=self.RDO_YES, action=actions.RADIO_BUTTON_SELECT)
143-
self.po.perform_action(locator=self.TXT_DETAILS, action=actions.FILL, value=medical_condition_details)
145+
self.po.perform_action(locator=self.TXT_GIVE_DETAILS, action=actions.FILL, value=medical_condition_details)
144146
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
145147

146148
def select_severe_reaction(self, reaction_details: str = data_values.EMPTY) -> None:
147149
if reaction_details == data_values.EMPTY:
148150
self.po.perform_action(locator=self.RDO_NO, action=actions.RADIO_BUTTON_SELECT)
149151
else:
150152
self.po.perform_action(locator=self.RDO_YES, action=actions.RADIO_BUTTON_SELECT)
151-
self.po.perform_action(locator=self.TXT_DETAILS, action=actions.FILL, value=reaction_details)
153+
self.po.perform_action(locator=self.TXT_GIVE_DETAILS, action=actions.FILL, value=reaction_details)
152154
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
153155

154156
def select_extra_support(self, extra_support_details: str = data_values.EMPTY) -> None:
155157
if extra_support_details == data_values.EMPTY:
156158
self.po.perform_action(locator=self.RDO_NO, action=actions.RADIO_BUTTON_SELECT)
157159
else:
158160
self.po.perform_action(locator=self.RDO_YES, action=actions.RADIO_BUTTON_SELECT)
159-
self.po.perform_action(locator=self.TXT_DETAILS, action=actions.FILL, value=extra_support_details)
161+
self.po.perform_action(locator=self.TXT_GIVE_DETAILS, action=actions.FILL, value=extra_support_details)
160162
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
161163

162164
def click_confirm_details(self) -> None:
@@ -170,23 +172,23 @@ def select_consent_not_given_reason(self, reason: str, reason_details: str) -> N
170172
case "vaccine already received":
171173
self.po.perform_action(locator=self.RDO_VACCINE_ALREADY_RECEIVED, action=actions.RADIO_BUTTON_SELECT)
172174
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
173-
self.po.perform_action(locator=self.TXT_DETAILS, action=actions.FILL, value=reason_details)
175+
self.po.perform_action(locator=self.TXT_GIVE_DETAILS, action=actions.FILL, value=reason_details)
174176
case "vaccine will be given elsewhere":
175177
self.po.perform_action(
176178
locator=self.RDO_VACCINE_WILL_BE_GIVEN_ELSEWHERE, action=actions.RADIO_BUTTON_SELECT
177179
)
178180
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
179-
self.po.perform_action(locator=self.TXT_DETAILS, action=actions.FILL, value=reason_details)
181+
self.po.perform_action(locator=self.TXT_GIVE_DETAILS, action=actions.FILL, value=reason_details)
180182
case "medical reasons":
181183
self.po.perform_action(locator=self.RDO_VACCINE_MEDICAL_REASONS, action=actions.RADIO_BUTTON_SELECT)
182184
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
183-
self.po.perform_action(locator=self.TXT_DETAILS, action=actions.FILL, value=reason_details)
185+
self.po.perform_action(locator=self.TXT_GIVE_DETAILS, action=actions.FILL, value=reason_details)
184186
case "personal choice":
185187
self.po.perform_action(locator=self.RDO_PERSONAL_CHOICE, action=actions.RADIO_BUTTON_SELECT)
186188
case _: # Other
187189
self.po.perform_action(locator=self.RDO_OTHER, action=actions.RADIO_BUTTON_SELECT)
188190
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
189-
self.po.perform_action(locator=self.TXT_DETAILS, action=actions.FILL, value=reason_details)
191+
self.po.perform_action(locator=self.TXT_GIVE_DETAILS, action=actions.FILL, value=reason_details)
190192
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
191193

192194
def service_give_consent(self):
@@ -222,3 +224,21 @@ def service_give_consent(self):
222224
self.po.perform_action(locator=self.RDO_YES_SAFE_TO_VACCINATE, action=actions.RADIO_BUTTON_SELECT)
223225
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
224226
self.po.perform_action(locator=self.BTN_CONFIRM, action=actions.CLICK_BUTTON)
227+
228+
def service_refuse_consent(self):
229+
self.po.perform_action(locator="Parent1 (Dad)", action=actions.RADIO_BUTTON_SELECT)
230+
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
231+
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON) # Parent contact details page
232+
self.po.perform_action(locator=self.RDO_ONLINE, action=actions.RADIO_BUTTON_SELECT)
233+
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
234+
self.po.perform_action(locator=self.RDO_NO_THEY_DO_NOT_AGREE, action=actions.RADIO_BUTTON_SELECT)
235+
# self.po.perform_action(locator=self.RDO_NO_RESPONSE , action=actions.RADIO_BUTTON_SELECT)
236+
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
237+
self.po.perform_action(locator=self.RDO_VACCINE_ALREADY_RECEIVED, action=actions.RADIO_BUTTON_SELECT)
238+
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
239+
self.po.perform_action(locator=self.TXT_GIVE_DETAILS, action=actions.FILL, value="Given elsewhere")
240+
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
241+
self.po.perform_action(locator=self.BTN_CONFIRM, action=actions.CLICK_BUTTON)
242+
self.po.verify(
243+
locator=self.LBL_MAIN, property=object_properties.TEXT, value=self.LBL_CONSENT_RECORDED, exact=False
244+
)

pages/pg_sessions.py

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
from pickle import TRUE
23

34
from playwright.sync_api import expect
45

@@ -52,14 +53,16 @@ class pg_sessions:
5253
RDO_NO_GILLICK_COMPETENT = "No"
5354
TXT_GILLICK_ASSESSMENT_DETAILS = "Assessment notes (optional)"
5455
BTN_SAVE_CHANGES = "Save changes"
55-
LBL_ACTIVITY_LOG_ENTRY = f"Triaged decision: Safe to vaccinate"
56+
LBL_ACTIVITY_LOG_ENTRY_CONSENT_GIVEN = "Triaged decision: Safe to vaccinate"
57+
LBL_ACTIVITY_LOG_ENTRY_CONSENT_REFUSED = "Consent refused by Parent1 (Dad)"
5658
BTN_GET_CONSENT_RESPONSES = "Get consent response"
5759
BTN_COMPLETE_GILLICK_ASSESSMENT = "Complete your assessment"
5860
LBL_CHILD_COMPETENT = "Child assessed as Gillick competent"
5961
LBL_CHILD_NOT_COMPETENT = "Child assessed as not Gillick competent"
6062
LNK_EDIT_GILLICK_COMPETENCE = "Edit Gillick competence"
6163
BTN_UPDATE_GILLICK_ASSESSMENT = "Update your assessment"
6264
LNK_CONSENT_FORM = "View parental consent form ("
65+
LNK_COULD_NOT_VACCINATE = "Could not vaccinate"
6366

6467
def __get_display_formatted_date(self, date_to_format: str) -> str:
6568
_parsed_date = datetime.strptime(date_to_format, "%Y%m%d")
@@ -133,6 +136,9 @@ def click_assess_gillick_competent(self):
133136
def click_edit_gillick_competence(self):
134137
self.po.perform_action(locator=self.LNK_EDIT_GILLICK_COMPETENCE, action=actions.CLICK_LINK)
135138

139+
def click_could_not_vaccinate(self):
140+
self.po.perform_action(locator=self.LNK_COULD_NOT_VACCINATE, action=actions.CLICK_LINK)
141+
136142
def add_gillick_competence(self, is_competent: bool, competence_details: str) -> None:
137143
self.__set_gillick_consent(is_add=True, is_competent=is_competent, competence_details=competence_details)
138144

@@ -236,10 +242,21 @@ def verify_triage_updated(self):
236242
exact=False,
237243
)
238244

239-
def verify_activity_log_entry(self):
240-
self.po.verify(
241-
locator=self.LBL_MAIN, property=object_properties.TEXT, value=self.LBL_ACTIVITY_LOG_ENTRY, exact=False
242-
)
245+
def verify_activity_log_entry(self, consent_given: bool):
246+
if consent_given:
247+
self.po.verify(
248+
locator=self.LBL_MAIN,
249+
property=object_properties.TEXT,
250+
value=self.LBL_ACTIVITY_LOG_ENTRY_CONSENT_GIVEN,
251+
exact=False,
252+
)
253+
else:
254+
self.po.verify(
255+
locator=self.LBL_MAIN,
256+
property=object_properties.TEXT,
257+
value=self.LBL_ACTIVITY_LOG_ENTRY_CONSENT_REFUSED,
258+
exact=False,
259+
)
243260

244261
def verify_scheduled_date(self, message: str):
245262
self.po.verify(locator=self.LBL_MAIN, property=object_properties.TEXT, value=message, exact=False)
@@ -283,7 +300,32 @@ def update_triage_outcome_positive(self, file_paths):
283300
self.verify_triage_updated()
284301
self.click_child_full_name()
285302
self.click_activity_log()
286-
self.verify_activity_log_entry()
303+
self.verify_activity_log_entry(consent_given=True)
304+
305+
def update_triage_outcome_consent_refused(self, file_paths):
306+
_input_file_path, _ = self.tdo.split_file_paths(file_paths=file_paths)
307+
self.click_scheduled()
308+
self.click_school1()
309+
self.click_import_class_list()
310+
self.choose_file_child_records(file_path=_input_file_path)
311+
self.click_continue()
312+
self.dashboard_page.go_to_dashboard()
313+
self.dashboard_page.click_sessions()
314+
self.click_scheduled()
315+
self.click_school1()
316+
self.click_check_consent_responses()
317+
self.click_child_full_name()
318+
self.click_get_consent_responses()
319+
self.consent_page.service_refuse_consent()
320+
self.dashboard_page.go_to_dashboard()
321+
self.dashboard_page.click_sessions()
322+
self.click_scheduled()
323+
self.click_school1()
324+
self.click_record_vaccinations()
325+
self.click_could_not_vaccinate()
326+
self.click_child_full_name()
327+
self.click_activity_log()
328+
self.verify_activity_log_entry(consent_given=False)
287329

288330
def schedule_a_valid_session(self, for_today: bool = False):
289331
_future_date = get_offset_date(offset_days=0) if for_today else get_offset_date(offset_days=10)

tests/test_07_record_a_vaccine_using_ui.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ def test_setup(self, start_mavis: None):
2626
@pytest.mark.order(701)
2727
def test_reg_rav_triage_positive(self, test_setup):
2828
self.sessions_page.update_triage_outcome_positive(file_paths=test_data_file_paths.COHORTS_POSITIVE)
29+
30+
@pytest.mark.rav
31+
@pytest.mark.order(702)
32+
def test_reg_rav_triage_consent_refused(self, test_setup):
33+
self.sessions_page.update_triage_outcome_consent_refused(file_paths=test_data_file_paths.COHORTS_POSITIVE)

0 commit comments

Comments
 (0)