@@ -20,6 +20,9 @@ def before(self):
2020 self .appointment = AppointmentFactory (screening_episode = self .screening_episode )
2121
2222 def test_recording_a_mammogram_without_capturing_medical_information (self ):
23+ """
24+ I can record a mammogram without entering any relevant medical information.
25+ """
2326 self .given_i_am_on_the_start_screening_page ()
2427 self .then_i_should_see_the_demographic_banner ()
2528 self .and_i_should_see_the_participant_details ()
@@ -28,9 +31,30 @@ def test_recording_a_mammogram_without_capturing_medical_information(self):
2831 self .then_i_should_be_on_the_medical_information_page ()
2932 self .and_i_should_be_prompted_to_ask_about_relevant_medical_information ()
3033
31- self .when_the_participant_shares_no_relevant_medical_information ()
34+ self .when_i_mark_that_the_participant_shared_no_medical_information ()
3235 self .then_the_screen_should_show_that_it_is_awaiting_images_from_the_PACS ()
3336
37+ def test_filling_out_forms_incorrectly (self ):
38+ """
39+ At each step in the flow, when I fill out the forms incorrectly,
40+ then I should see the errors so I can fix them.
41+ """
42+ self .given_i_am_on_the_start_screening_page ()
43+ self .when_i_submit_the_form ()
44+ self .then_i_am_prompted_to_answer_can_the_screening_go_ahead ()
45+
46+ self .when_i_check_the_participants_identity_and_confirm_the_last_mammogram_date ()
47+ self .then_i_should_be_on_the_medical_information_page ()
48+
49+ self .when_i_submit_the_form ()
50+ self .then_i_am_prompted_to_answer_has_the_participant_shared_medical_info ()
51+
52+ self .when_i_mark_that_the_participant_shared_medical_information ()
53+ self .then_i_should_be_on_the_record_medical_information_page ()
54+
55+ self .when_i_submit_the_form ()
56+ self .then_i_am_prompted_to_confirm_whether_imaging_can_go_ahead ()
57+
3458 def given_i_am_on_the_start_screening_page (self ):
3559 self .page .goto (
3660 self .live_server_url
@@ -54,27 +78,62 @@ def when_i_check_the_participants_identity_and_confirm_the_last_mammogram_date(
5478 self .page .get_by_label ("Yes, go to medical information" ).check ()
5579 self .page .get_by_role ("button" , name = "Continue" ).click ()
5680
81+ def when_i_submit_the_form (self ):
82+ self .page .get_by_role ("button" , name = "Continue" ).click ()
83+
5784 def then_i_should_be_on_the_medical_information_page (self ):
5885 path = reverse (
5986 "record_a_mammogram:ask_for_medical_information" ,
6087 kwargs = {"id" : self .appointment .pk },
6188 )
6289 expect (self .page ).to_have_url (re .compile (path ))
6390
91+ def then_i_should_be_on_the_record_medical_information_page (self ):
92+ path = reverse (
93+ "record_a_mammogram:record_medical_information" ,
94+ kwargs = {"id" : self .appointment .pk },
95+ )
96+ expect (self .page ).to_have_url (re .compile (path ))
97+
6498 def and_i_should_be_prompted_to_ask_about_relevant_medical_information (self ):
6599 expect (
66100 self .page .get_by_text (
67101 "Has the participant shared any relevant medical information?"
68102 )
69103 ).to_be_visible ()
70104
71- def when_the_participant_shares_no_relevant_medical_information (self ):
105+ def when_i_mark_that_the_participant_shared_no_medical_information (self ):
72106 self .page .get_by_label ("No - proceed to imaging" ).check ()
73107 self .page .get_by_role ("button" , name = "Continue" ).click ()
74108
109+ def when_i_mark_that_the_participant_shared_medical_information (self ):
110+ self .page .get_by_label ("Yes" ).check ()
111+ self .page .get_by_role ("button" , name = "Continue" ).click ()
112+
75113 def then_the_screen_should_show_that_it_is_awaiting_images_from_the_PACS (self ):
76114 path = reverse (
77115 "record_a_mammogram:awaiting_images" ,
78116 kwargs = {"id" : self .appointment .pk },
79117 )
80118 expect (self .page ).to_have_url (re .compile (path ))
119+
120+ def then_i_am_prompted_to_answer_can_the_screening_go_ahead (self ):
121+ self .expect_validation_error (
122+ error_text = "This field is required." ,
123+ fieldset_legend = "Can the appointment go ahead?" ,
124+ field_label = "Yes, go to medical information" ,
125+ )
126+
127+ def then_i_am_prompted_to_answer_has_the_participant_shared_medical_info (self ):
128+ self .expect_validation_error (
129+ error_text = "This field is required." ,
130+ fieldset_legend = "Has the participant shared any relevant medical information?" ,
131+ field_label = "Yes" ,
132+ )
133+
134+ def then_i_am_prompted_to_confirm_whether_imaging_can_go_ahead (self ):
135+ self .expect_validation_error (
136+ error_text = "This field is required." ,
137+ fieldset_legend = "Can imaging go ahead?" ,
138+ field_label = "Yes, mark incomplete sections as ‘none’ or ‘no’" ,
139+ )
0 commit comments