@@ -43,9 +43,16 @@ def when_i_submit_the_form(self):
4343 self .page .get_by_role ("button" , name = "Continue" ).click ()
4444
4545 def then_i_should_see_validation_errors (self ):
46- expect (
47- self .page .locator ("#stopped_reasons-error" )
48- ).to_have_text (re .compile ("A reason for why this appointment cannot continue must be provided" ))
46+ self .expect_validation_error (
47+ id = "stopped_reasons-error" ,
48+ fieldset_legend = "Why has this appointment been stopped?" ,
49+ error_text = "A reason for why this appointment cannot continue must be provided" ,
50+ )
51+ self .expect_validation_error (
52+ id = "decision-error" ,
53+ fieldset_legend = "Does the appointment need to be rescheduled?" ,
54+ error_text = "Select whether the participant needs to be invited for another appointment"
55+ )
4956
5057 def when_i_select_a_reason_for_the_appointment_being_stopped (self ):
5158 self .page .get_by_label ("Failed identity check" ).check ()
@@ -58,9 +65,11 @@ def and_i_choose_to_add_the_participant_to_the_reinvite_list(self):
5865 expect (self .page .get_by_label ("Yes, add participant to reinvite list" )).to_be_checked ()
5966
6067 def then_i_see_an_error_for_other_details (self ):
61- expect (
62- self .page .locator ("#other_details-error" )
63- ).to_have_text (re .compile ("Explain why this appointment cannot proceed" ))
68+ self .expect_validation_error (
69+ id = "other_details-error" ,
70+ fieldset_legend = "Why has this appointment been stopped?" ,
71+ error_text = "Explain why this appointment cannot proceed" ,
72+ )
6473
6574 def when_i_fill_in_other_details (self ):
6675 self .page .locator ("#other_details" ).fill ("Explain other choice" )
@@ -72,4 +81,4 @@ def then_i_see_the_clinics_page(self):
7281
7382 def and_the_appointment_is_updated (self ):
7483 self .appointment .refresh_from_db ()
75- self .assertEqual (self .appointment .status , Appointment .Status .ATTENDED_NOT_SCREENED )
84+ self .assertEqual (self .appointment .status , Appointment .Status .ATTENDED_NOT_SCREENED )
0 commit comments