11import logging
22import pytest
3- from playwright .sync_api import Page ,expect
3+ from playwright .sync_api import Page , expect
44from pages import screening_subject_search
55from pages .logout .log_out_page import LogoutPage
66from pages .base_page import BasePage
77from pages .screening_subject_search import subject_screening_search_page
88from pages .screening_subject_search import subject_screening_summary_page
9- from pages .screening_subject_search .subject_screening_search_page import (SubjectScreeningPage )
10- from pages .screening_subject_search .subject_screening_summary_page import (SubjectScreeningSummaryPage )
11- from pages .screening_subject_search .subject_events_notes import SubjectEventsNotes , AdditionalCareNoteTypeOptions
9+ from pages .screening_subject_search .subject_screening_search_page import (
10+ SubjectScreeningPage ,
11+ )
12+ from pages .screening_subject_search .subject_screening_summary_page import (
13+ SubjectScreeningSummaryPage ,
14+ )
15+ from pages .screening_subject_search .subject_events_notes import (
16+ SubjectEventsNotes ,
17+ AdditionalCareNoteTypeOptions ,
18+ )
1219from utils .user_tools import UserTools
13- from utils .oracle .oracle_specific_functions import get_subjects_by_note_count ,get_supporting_notes
20+ from utils .oracle .oracle_specific_functions import (
21+ get_subjects_by_note_count ,
22+ get_supporting_notes ,
23+ )
1424
1525
1626def note_types_order ():
@@ -21,6 +31,7 @@ def note_types_order():
2131 ("Kit Note" , 308015 ),
2232 ]
2333
34+
2435@pytest .mark .wip
2536@pytest .mark .parametrize ("note_type_name, note_type_value" , note_types_order ())
2637def test_subject_does_not_have_a_note (
@@ -56,12 +67,16 @@ def test_subject_does_not_have_a_note(
5667 SubjectScreeningSummaryPage (page ).verify_note_link_not_present (note_type_name )
5768
5869
59- def test_add_a_additional_care_note_for_a_subject_without_a_note (page : Page , smokescreen_properties : dict ) -> None :
70+ def test_add_a_additional_care_note_for_a_subject_without_a_note (
71+ page : Page , smokescreen_properties : dict
72+ ) -> None :
6073 """
6174 Test to add an additional care note for a subject without an existing note.
6275 """
6376 # User login
64- logging .info ("Starting test: Add an additional care note for a subject without a note." )
77+ logging .info (
78+ "Starting test: Add an additional care note for a subject without a note."
79+ )
6580 logging .info ("Logging in as 'Team Leader at BCS01'." )
6681 UserTools .user_login (page , "Team Leader at BCS01" )
6782
@@ -88,7 +103,9 @@ def test_add_a_additional_care_note_for_a_subject_without_a_note(page: Page, smo
88103 # Select Additional Care Note Type
89104 note_type = "Additional Care Need - Learning disability"
90105 logging .info (f"Selecting Additional Care Note Type: '{ note_type } '." )
91- SubjectEventsNotes (page ).select_additional_care_note_type (AdditionalCareNoteTypeOptions .LEARNING_DISABILITY )
106+ SubjectEventsNotes (page ).select_additional_care_note_type (
107+ AdditionalCareNoteTypeOptions .LEARNING_DISABILITY
108+ )
92109
93110 # Fill Notes
94111 note_text = "adding additional care need notes"
@@ -104,7 +121,9 @@ def test_add_a_additional_care_note_for_a_subject_without_a_note(page: Page, smo
104121 BasePage (page ).click_back_button ()
105122
106123 # Get supporting notes for the subject
107- logging .info ("Retrieving supporting notes for the subject with NHS Number: {nhs_no}." )
124+ logging .info (
125+ "Retrieving supporting notes for the subject with NHS Number: {nhs_no}."
126+ )
108127 screening_subject_id = int (subjects_df ["screening_subject_id" ].iloc [0 ])
109128 logging .info (f"Screening Subject ID retrieved: { screening_subject_id } " )
110129 type_id = int (subjects_df ["type_id" ].iloc [0 ])
@@ -114,17 +133,24 @@ def test_add_a_additional_care_note_for_a_subject_without_a_note(page: Page, smo
114133
115134 # Verify title and note match the provided values
116135 logging .info (
117- f"Verifying that the title and note match the provided values for type_id: { type_id } ." )
118- assert (filtered_notes_df ["title" ].iloc [0 ].strip () == note_type ), f"Title does not match. Expected: '{ note_type } ', Found: '{ filtered_notes_df ['title' ].iloc [0 ].strip ()} '."
119- assert (filtered_notes_df ["note" ].iloc [0 ].strip () == note_text ), f"Note does not match. Expected: '{ note_text } ', Found: '{ filtered_notes_df ['note' ].iloc [0 ].strip ()} '."
136+ f"Verifying that the title and note match the provided values for type_id: { type_id } ."
137+ )
138+ assert (
139+ filtered_notes_df ["title" ].iloc [0 ].strip () == note_type
140+ ), f"Title does not match. Expected: '{ note_type } ', Found: '{ filtered_notes_df ['title' ].iloc [0 ].strip ()} '."
141+ assert (
142+ filtered_notes_df ["note" ].iloc [0 ].strip () == note_text
143+ ), f"Note does not match. Expected: '{ note_text } ', Found: '{ filtered_notes_df ['note' ].iloc [0 ].strip ()} '."
120144
121145 logging .info (
122146 f"Verification successful: Additional care note added for the subject with NHS Number: { nhs_no } . "
123147 f"Title and note matched the provided values. Title: '{ note_type } ', Note: '{ note_text } '."
124148 )
125149
126150
127- def test_add_additional_care_note_for_subject_with_existing_note (page : Page , smokescreen_properties : dict ) -> None :
151+ def test_add_additional_care_note_for_subject_with_existing_note (
152+ page : Page , smokescreen_properties : dict
153+ ) -> None :
128154 """
129155 Test to add an additional care note for a subject who already has an existing note.
130156 """
@@ -140,7 +166,7 @@ def test_add_additional_care_note_for_subject_with_existing_note(page: Page, smo
140166 BasePage (page ).go_to_screening_subject_search_page ()
141167
142168 # Get a subject with existing additional care notes
143- subjects_df = get_subjects_by_note_count (4112 ,1 )
169+ subjects_df = get_subjects_by_note_count (4112 , 1 )
144170 nhs_no = subjects_df ["subject_nhs_number" ].iloc [0 ]
145171 logging .info (f"Searching for subject with NHS Number: { nhs_no } " )
146172 SubjectScreeningPage (page ).fill_nhs_number (nhs_no )
@@ -197,10 +223,12 @@ def test_add_additional_care_note_for_subject_with_existing_note(page: Page, smo
197223 )
198224
199225
200- def test_identify_subject_with_additional_care_note (page : Page , smokescreen_properties : dict ) -> None :
226+ def test_identify_subject_with_additional_care_note (
227+ page : Page , smokescreen_properties : dict
228+ ) -> None :
229+ """
230+ Test to identify if a subject has an Additional Care note.
201231 """
202- Test to identify if a subject has an Additional Care note.
203- """
204232 logging .info ("Starting test: Verify subject has an additional care note." )
205233 logging .info ("Logging in as 'ScreeningAssistant at BCS02'." )
206234 # user login
@@ -212,7 +240,7 @@ def test_identify_subject_with_additional_care_note(page: Page, smokescreen_prop
212240 BasePage (page ).go_to_screening_subject_search_page ()
213241
214242 # Search for the subject by NHS Number.")
215- subjects_df = get_subjects_by_note_count (4112 ,1 )
243+ subjects_df = get_subjects_by_note_count (4112 , 1 )
216244 nhs_no = subjects_df ["subject_nhs_number" ].iloc [0 ]
217245 SubjectScreeningPage (page ).fill_nhs_number (nhs_no )
218246 SubjectScreeningPage (page ).select_search_area_option ("07" )
@@ -223,7 +251,9 @@ def test_identify_subject_with_additional_care_note(page: Page, smokescreen_prop
223251 SubjectScreeningSummaryPage (page ).verify_additional_care_note_visible ()
224252
225253
226- def test_view_active_additional_care_note (page : Page , smokescreen_properties : dict ) -> None :
254+ def test_view_active_additional_care_note (
255+ page : Page , smokescreen_properties : dict
256+ ) -> None :
227257 """
228258 Test to verify if an active Additional Care note is visible for a subject.
229259 """
@@ -238,7 +268,7 @@ def test_view_active_additional_care_note(page: Page, smokescreen_properties: di
238268 BasePage (page ).go_to_screening_subject_search_page ()
239269
240270 # Search for the subject by NHS Number.")
241- subjects_df = get_subjects_by_note_count (4112 ,1 )
271+ subjects_df = get_subjects_by_note_count (4112 , 1 )
242272 nhs_no = subjects_df ["subject_nhs_number" ].iloc [0 ]
243273 SubjectScreeningPage (page ).fill_nhs_number (nhs_no )
244274 SubjectScreeningPage (page ).select_search_area_option ("07" )
@@ -265,5 +295,4 @@ def test_view_active_additional_care_note(page: Page, smokescreen_properties: di
265295 notes_df = get_supporting_notes (screening_subject_id , type_id )
266296 # Filter the DataFrame to only include rows where type_id == 4112
267297 filtered_notes_df = notes_df [notes_df ["type_id" ] == type_id ]
268- # Verify title and note match the UI values
269-
298+ # Verify title and note match the UI values
0 commit comments