@@ -47,13 +47,18 @@ class pg_sessions:
4747 LNK_CONTINUE = "Continue"
4848 LNK_CONSENT_FORM = "View parental consent form (opens in new tab)"
4949 BTN_CHECK_CONSENT_RESPONSES = "Check consent responses"
50- LNK_GIVE_GILLICK_CONSENT = "Give your assessment "
50+ LNK_ASSESS_GILLICK_COMPETENT = "Assess Gillick competence "
5151 RDO_YES_GILLICK_COMPETENT = "Yes, they are Gillick competent"
5252 RDO_NO_GILLICK_COMPETENT = "No"
53- TXT_GILLICK_ASSESSMENT_DETAILS = "CF" # "Details of your assessment "
53+ TXT_GILLICK_ASSESSMENT_DETAILS = "Assessment notes (optional) "
5454 BTN_SAVE_CHANGES = "Save changes"
5555 LBL_ACTIVITY_LOG_ENTRY = f"Triaged decision: Safe to vaccinate"
5656 BTN_GET_CONSENT_RESPONSES = "Get consent response"
57+ BTN_COMPLETE_GILLICK_ASSESSMENT = "Complete your assessment"
58+ LBL_CHILD_COMPETENT = "Child assessed as Gillick competent"
59+ LBL_CHILD_NOT_COMPETENT = "Child assessed as not Gillick competent"
60+ LNK_EDIT_GILLICK_COMPETENCE = "Edit Gillick competence"
61+ BTN_UPDATE_GILLICK_ASSESSMENT = "Update your assessment"
5762
5863 def __get_display_formatted_date (self , date_to_format : str ) -> str :
5964 _parsed_date = datetime .strptime (date_to_format , "%Y%m%d" )
@@ -121,24 +126,77 @@ def click_save_triage(self):
121126 def click_check_consent_responses (self ):
122127 self .po .perform_action (locator = self .BTN_CHECK_CONSENT_RESPONSES , action = actions .CLICK_LINK )
123128
124- def click_give_gillick_consent (self ):
125- self .po .perform_action (locator = self .LNK_GIVE_GILLICK_CONSENT , action = actions .CLICK_LINK )
129+ def click_assess_gillick_competent (self ):
130+ self .po .perform_action (locator = self .LNK_ASSESS_GILLICK_COMPETENT , action = actions .CLICK_LINK )
126131
127- def __set_gillick_consent (self , is_competent : bool , competency_details : str ) -> None :
128- _expected_text = f"Gillick assessment Are they Gillick competent?Yes, they are Gillick competent Details of your assessment{ competency_details } "
129- self .po .perform_action (locator = self .LNK_GIVE_GILLICK_CONSENT , action = actions .CLICK_BUTTON )
132+ def click_edit_gillick_competence (self ):
133+ self .po .perform_action (locator = self .LNK_EDIT_GILLICK_COMPETENCE , action = actions .CLICK_LINK )
134+
135+ def add_gillick_competence (self , is_competent : bool , competence_details : str ) -> None :
136+ self .__set_gillick_consent (is_add = True , is_competent = is_competent , competence_details = competence_details )
137+
138+ def edit_gillick_competence (self , is_competent : bool , competence_details : str ) -> None :
139+ self .__set_gillick_consent (is_add = False , is_competent = is_competent , competence_details = competence_details )
140+
141+ def __set_gillick_consent (self , is_add : bool , is_competent : bool , competence_details : str ) -> None :
130142 if is_competent :
131- self .po .perform_action (locator = self .RDO_YES_GILLICK_COMPETENT , action = actions .RADIO_BUTTON_SELECT )
143+ self .po .perform_action (
144+ locator = "get_by_role('group', name='The child knows which vaccination they will have').get_by_label('Yes').check()" ,
145+ action = actions .CHAIN_LOCATOR_ACTION ,
146+ )
147+ self .po .perform_action (
148+ locator = "get_by_role('group', name='The child knows which disease').get_by_label('Yes').check()" ,
149+ action = actions .CHAIN_LOCATOR_ACTION ,
150+ )
151+ self .po .perform_action (
152+ locator = "get_by_role('group', name='The child knows what could').get_by_label('Yes').check()" ,
153+ action = actions .CHAIN_LOCATOR_ACTION ,
154+ )
155+ self .po .perform_action (
156+ locator = "get_by_role('group', name='The child knows how the').get_by_label('Yes').check()" ,
157+ action = actions .CHAIN_LOCATOR_ACTION ,
158+ )
159+ self .po .perform_action (
160+ locator = "get_by_role('group', name='The child knows which side').get_by_label('Yes').check()" ,
161+ action = actions .CHAIN_LOCATOR_ACTION ,
162+ )
132163 else :
133- self .po .perform_action (locator = self .RDO_NO_GILLICK_COMPETENT , action = actions .RADIO_BUTTON_SELECT )
134- self .po .perform_action (locator = self .BTN_CONTINUE , action = actions .CLICK_BUTTON )
135- if is_competent :
136164 self .po .perform_action (
137- locator = self .TXT_GILLICK_ASSESSMENT_DETAILS , action = actions .FILL , value = competency_details
165+ locator = "get_by_role('group', name='The child knows which vaccination they will have').get_by_label('No').check()" ,
166+ action = actions .CHAIN_LOCATOR_ACTION ,
138167 )
139- self .po .perform_action (locator = self .BTN_CONTINUE , action = actions .CLICK_BUTTON )
140- self .po .perform_action (locator = self .BTN_SAVE_CHANGES , action = actions .CLICK_BUTTON )
141- self .po .verify (locator = self .LBL_MAIN , property = object_properties .TEXT , value = _expected_text , exact = False )
168+ self .po .perform_action (
169+ locator = "get_by_role('group', name='The child knows which disease').get_by_label('No').check()" ,
170+ action = actions .CHAIN_LOCATOR_ACTION ,
171+ )
172+ self .po .perform_action (
173+ locator = "get_by_role('group', name='The child knows what could').get_by_label('No').check()" ,
174+ action = actions .CHAIN_LOCATOR_ACTION ,
175+ )
176+ self .po .perform_action (
177+ locator = "get_by_role('group', name='The child knows how the').get_by_label('No').check()" ,
178+ action = actions .CHAIN_LOCATOR_ACTION ,
179+ )
180+ self .po .perform_action (
181+ locator = "get_by_role('group', name='The child knows which side').get_by_label('No').check()" ,
182+ action = actions .CHAIN_LOCATOR_ACTION ,
183+ )
184+ self .po .perform_action (
185+ locator = self .TXT_GILLICK_ASSESSMENT_DETAILS , action = actions .FILL , value = competence_details
186+ )
187+ if is_add :
188+ self .po .perform_action (locator = self .BTN_COMPLETE_GILLICK_ASSESSMENT , action = actions .CLICK_BUTTON )
189+ else :
190+ self .po .perform_action (locator = self .BTN_UPDATE_GILLICK_ASSESSMENT , action = actions .CLICK_BUTTON )
191+ if is_competent :
192+ self .po .verify (
193+ locator = self .LBL_MAIN , property = object_properties .TEXT , value = self .LBL_CHILD_COMPETENT , exact = False
194+ )
195+ else :
196+ self .po .verify (
197+ locator = self .LBL_MAIN , property = object_properties .TEXT , value = self .LBL_CHILD_NOT_COMPETENT , exact = False
198+ )
199+ self .po .verify (locator = self .LBL_MAIN , property = object_properties .TEXT , value = competence_details , exact = False )
142200
143201 def schedule_session (self , future_date : str , expect_error : bool = False ):
144202 _day = future_date [- 2 :]
@@ -189,6 +247,14 @@ def verify_scheduled_date(self, message: str):
189247 def click_get_consent_responses (self ):
190248 self .po .perform_action (locator = self .BTN_GET_CONSENT_RESPONSES , action = actions .CLICK_BUTTON )
191249
250+ def upload_valid_class_list (self , file_paths : str ):
251+ _input_file_path , _ = self .tdo .split_file_paths (file_paths = file_paths )
252+ self .click_scheduled ()
253+ self .click_school1 ()
254+ self .click_import_class_list ()
255+ self .choose_file_child_records (file_path = _input_file_path )
256+ self .click_continue ()
257+
192258 def update_triage_outcome_positive (self , file_paths ):
193259 _input_file_path , _ = self .tdo .split_file_paths (file_paths = file_paths )
194260 self .click_scheduled ()
@@ -218,8 +284,8 @@ def update_triage_outcome_positive(self, file_paths):
218284 self .click_activity_log ()
219285 self .verify_activity_log_entry ()
220286
221- def schedule_a_valid_session (self ):
222- _future_date = get_future_date (offset_days = 10 )
287+ def schedule_a_valid_session (self , for_today : bool = False ):
288+ _future_date = get_future_date (offset_days = 0 ) if for_today else get_future_date ( offset_days = 10 )
223289 _expected_message = f"Session dates { self .__get_display_formatted_date (date_to_format = _future_date )} "
224290 self .click_unscheduled ()
225291 self .click_school1 ()
@@ -258,10 +324,12 @@ def upload_invalid_class_list_records(self, file_paths: str):
258324 self .click_continue ()
259325 self .verify_upload_output (file_path = _output_file_path )
260326
261- def set_gillick_competency_for_student (self ):
327+ def set_gillick_competence_for_student (self ):
262328 self .click_today ()
263329 self .click_school1 ()
264330 self .click_check_consent_responses ()
265331 self .click_child_full_name ()
266- self .click_give_gillick_consent ()
267- self .__set_gillick_consent (is_competent = True , competency_details = "Gillick competent" )
332+ self .click_assess_gillick_competent ()
333+ self .add_gillick_competence (is_competent = True , competence_details = "Gillick competent" )
334+ self .click_edit_gillick_competence ()
335+ self .edit_gillick_competence (is_competent = False , competence_details = "Not Gillick competent" )
0 commit comments