Skip to content

Commit 8209e42

Browse files
committed
updating notes test
1 parent 80eb1b9 commit 8209e42

File tree

4 files changed

+195
-261
lines changed

4 files changed

+195
-261
lines changed

tests/regression/notes/test_additional_care_notes.py

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -423,18 +423,13 @@ def test_update_existing_additional_care_note(
423423

424424

425425
def test_remove_existing_additional_care_note(
426-
page: Page,
427-
note_type_name: str = "Additional Care Note",
428-
note_type_value: int = 4112,
429-
note_status=4100,
430-
) -> None:
426+
page: Page, general_properties: dict) -> None:
431427
"""
432428
Test to verify if an existing Additional Care note can be removed for a subject with one Additional Care note.
433429
"""
434430
logging.info(
435431
"Starting test: Verify if an existing Additional Care note can be removed for a subject with one Additional Care note"
436432
)
437-
logging.info("Logging in as 'Team Leader at BCS01'.")
438433
# user login
439434
logging.info("Logging in as 'Team Leader at BCS01'.")
440435
UserTools.user_login(page, "Team Leader at BCS01")
@@ -444,22 +439,19 @@ def test_remove_existing_additional_care_note(
444439
BasePage(page).go_to_screening_subject_search_page()
445440

446441
# Search for the subject by NHS Number.")
447-
subjects_df = get_subjects_by_note_count(note_type_value, note_status, 1)
442+
subjects_df = get_subjects_by_note_count(general_properties["additional_care_note_type_value"], general_properties["note_status_active"], 1)
448443
nhs_no = subjects_df["subject_nhs_number"].iloc[0]
449444
SubjectScreeningPage(page).fill_nhs_number(nhs_no)
450445
SubjectScreeningPage(page).select_search_area_option("07")
451446
SubjectScreeningPage(page).click_search_button()
452447
# Verify subject has additional care notes present
453-
logging.info("Verified: Aadditional care notes are present for the subject.")
454-
# logging.info("Verifying that additional care notes are present for the subject.")
455448
logging.info(
456449
f"Verifying that the Additional Care Note is visible for the subject with NHS Number: {nhs_no}."
457450
)
458-
SubjectScreeningSummaryPage(page).verify_additional_care_note_visible()
459-
logging.info(
460-
f"Clicking on the 'Additional Care Note' link for the subject with NHS Number: {nhs_no}."
451+
SubjectScreeningSummaryPage(page).verify_note_link_not_present(
452+
general_properties["additional_care_note_name"]
461453
)
462-
454+
463455
SubjectScreeningSummaryPage(page).click_subjects_events_notes()
464456
SubjectEventsNotes(page).select_note_type(NotesOptions.ADDITIONAL_CARE_NOTE)
465457
logging.info(
@@ -474,15 +466,11 @@ def test_remove_existing_additional_care_note(
474466
screening_subject_id = int(subjects_df["screening_subject_id"].iloc[0])
475467
logging.info(f"Screening Subject ID retrieved: {screening_subject_id}")
476468
type_id = int(subjects_df["type_id"].iloc[0])
477-
# type_id = 4112 # Type ID for Additional Care Notes
478-
# note_status = 4100 # Status ID for Active Notes
479-
notes_df = get_supporting_notes(screening_subject_id, type_id, note_status)
480-
# Filter the DataFrame to only include rows where type_id == 4112
481-
filtered_notes_df = notes_df[notes_df["type_id"] == note_type_value]
482-
# Verify that the filtered DataFrame is empty
483-
if not filtered_notes_df.empty:
469+
notes_df = get_supporting_notes(screening_subject_id, type_id,general_properties["note_status_active"])
470+
# Verify that the DataFrame is not empty
471+
if not notes_df.empty:
484472
pytest.fail(
485-
f"Subject has Additional Care Notes. Expected none, but found: {filtered_notes_df}"
473+
f"Subject has Additional Care Notes. Expected none, but found: {notes_df}"
486474
)
487475

488476
logging.info(
@@ -491,11 +479,7 @@ def test_remove_existing_additional_care_note(
491479

492480

493481
def test_remove_existing_additional_care_note_for_subject_with_multiple_notes(
494-
page: Page,
495-
note_type_name: str = "Additional Care Note",
496-
note_type_value: int = 4112,
497-
note_status=4100,
498-
note_status_obsolete=4101,
482+
page: Page, general_properties: dict
499483
) -> None:
500484
"""
501485
Test to verify if an existing Additional Care note can be removed for a subject with multiple Additional Care notes.
@@ -512,10 +496,10 @@ def test_remove_existing_additional_care_note_for_subject_with_multiple_notes(
512496
BasePage(page).go_to_screening_subject_search_page()
513497

514498
# Get a subject with multiple additional care notes
515-
subjects_df = get_subjects_with_multiple_notes(note_type_value)
499+
subjects_df = get_subjects_with_multiple_notes(general_properties["additional_care_note_type_value"])
516500
if subjects_df.empty:
517501
logging.info(
518-
"No subjects found with multiple Additional Care Notes. Skipping test."
502+
"No subjects found with multiple Additional Care Notes."
519503
)
520504
pytest.fail("No subjects found with multiple Additional Care Notes.")
521505
nhs_no = subjects_df["subject_nhs_number"].iloc[0]
@@ -546,7 +530,7 @@ def test_remove_existing_additional_care_note_for_subject_with_multiple_notes(
546530
logging.info(f"Screening Subject ID retrieved: {screening_subject_id}")
547531

548532
# Get the notes from the database
549-
notes_df = get_supporting_notes(screening_subject_id, note_type_value, note_status)
533+
notes_df = get_supporting_notes(screening_subject_id, general_properties["additional_care_note_type_value"],general_properties["note_status_active"])
550534
# Loop through the list of active notes and check if the removed note is still present
551535
logging.info(
552536
"Looping through active notes to verify the removed note is not present."
@@ -573,7 +557,7 @@ def test_remove_existing_additional_care_note_for_subject_with_multiple_notes(
573557

574558
# Get the notes from the database
575559
notes_df = get_supporting_notes(
576-
screening_subject_id, note_type_value, note_status_obsolete
560+
screening_subject_id, general_properties["additional_care_note_type_value"],general_properties["note_status_obsolete"]
577561
)
578562
# Verify that the removed note is present among obsolete notes
579563
logging.info("Verifying that the removed note is present among obsolete notes.")

tests/regression/notes/test_episode_notes.py

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -150,83 +150,6 @@ def test_add_a_episode_note_for_a_subject_without_a_note(
150150
f"Title and note matched the provided values. Title: '{note_title}', Note: '{note_text}'."
151151
)
152152

153-
154-
def test_add_episode_note_for_subject_with_existing_note(
155-
page: Page, general_properties: dict
156-
) -> None:
157-
"""
158-
Test to add an additional episode note for a subject who already has an existing note.
159-
"""
160-
# User login
161-
logging.info(
162-
"Starting test: Add an additional episode note for a subject who already has a note."
163-
)
164-
logging.info("Logging in as 'Team Leader at BCS01'.")
165-
UserTools.user_login(page, "Team Leader at BCS01")
166-
167-
# Navigate to the Screening Subject Search Page
168-
logging.info("Navigating to the Screening Subject Search Page.")
169-
BasePage(page).go_to_screening_subject_search_page()
170-
171-
# Get a subject with existing additional episode notes
172-
subjects_df = get_subjects_by_note_count(
173-
general_properties["episode_note_type_value"],
174-
general_properties["note_status_active"],
175-
1,
176-
)
177-
nhs_no = subjects_df["subject_nhs_number"].iloc[0]
178-
logging.info(f"Searching for subject with NHS Number: {nhs_no}")
179-
SubjectScreeningPage(page).fill_nhs_number(nhs_no)
180-
SubjectScreeningPage(page).select_search_area_option("07")
181-
SubjectScreeningPage(page).click_search_button()
182-
# Click on the Episode link
183-
SubjectScreeningSummaryPage(page).click_list_episodes()
184-
logging.info("Clicked on the list Episode link.")
185-
186-
# Select the first link from the table
187-
TableUtils(page, "#displayRS").click_first_link_in_column("View Events")
188-
logging.info("Selected the first events link from the table.")
189-
190-
logging.info("Selected the radio button for Episode Note.")
191-
note_title = "Episode Note - Follow-up required title2"
192-
# Set the note type for verification
193-
note_text = "Episode Note - Follow-up required2"
194-
SubjectEventsNotes(page).fill_note_title(note_title)
195-
# Set the note type for verification
196-
logging.info(f"Filling in notes: '{note_text}'.")
197-
SubjectEventsNotes(page).fill_notes(note_text)
198-
# Accept dialog and update notes
199-
logging.info("Accepting dialog and clicking 'Update Notes'.")
200-
SubjectEventsNotes(page).accept_dialog_and_update_notes()
201-
# Get supporting notes for the subject from DB
202-
logging.info(
203-
"Retrieving supporting notes for the subject with NHS Number: {nhs_no}."
204-
)
205-
screening_subject_id = int(subjects_df["screening_subject_id"].iloc[0])
206-
logging.info(f"Screening Subject ID retrieved: {screening_subject_id}")
207-
type_id = int(subjects_df["type_id"].iloc[0])
208-
note_status = int(
209-
subjects_df["note_status"].iloc[0]
210-
) # Get the note status from the DataFrame
211-
notes_df = get_supporting_notes(screening_subject_id, type_id, note_status)
212-
213-
# Verify title and note match the provided values
214-
logging.info(
215-
f"Verifying that the title and note match the provided values for type_id: {type_id}."
216-
)
217-
assert (
218-
notes_df["title"].iloc[0].strip() == note_title
219-
), f"Title does not match. Expected: '{note_title}', Found: '{notes_df['title'].iloc[0].strip()}'."
220-
assert (
221-
notes_df["note"].iloc[0].strip() == note_text
222-
), f"Note does not match. Expected: '{note_text}', Found: '{notes_df['note'].iloc[0].strip()}'."
223-
224-
logging.info(
225-
f"Verification successful:Episode note added for the subject with NHS Number: {nhs_no}. "
226-
f"Title and note matched the provided values. Title: '{note_title}', Note: '{note_text}'."
227-
)
228-
229-
230153
def test_identify_subject_with_episode_note(
231154
page: Page, general_properties: dict
232155
) -> None:

tests/regression/notes/test_kit_notes.py

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -151,83 +151,6 @@ def test_add_a_kit_note_for_a_subject_without_a_note(
151151
f"Title and note matched the provided values. Title: '{note_title}', Note: '{note_text}'."
152152
)
153153

154-
155-
def test_add_kit_note_for_subject_with_existing_note(
156-
page: Page, general_properties: dict
157-
) -> None:
158-
"""
159-
Test to add an additional kit note for a subject who already has an existing note.
160-
"""
161-
# User login
162-
logging.info(
163-
"Starting test: Add an additional kit note for a subject who already has a note."
164-
)
165-
logging.info("Logging in as 'Team Leader at BCS01'.")
166-
UserTools.user_login(page, "Team Leader at BCS01")
167-
168-
# Navigate to the Screening Subject Search Page
169-
logging.info("Navigating to the Screening Subject Search Page.")
170-
BasePage(page).go_to_screening_subject_search_page()
171-
172-
# Get a subject with existing additional care notes
173-
subjects_df = get_subjects_by_note_count(
174-
general_properties["kit_note_type_value"],
175-
general_properties["note_status_active"],
176-
1,
177-
)
178-
nhs_no = subjects_df["subject_nhs_number"].iloc[0]
179-
logging.info(f"Searching for subject with NHS Number: {nhs_no}")
180-
SubjectScreeningPage(page).fill_nhs_number(nhs_no)
181-
SubjectScreeningPage(page).select_search_area_option("07")
182-
SubjectScreeningPage(page).click_search_button()
183-
# Navigate to Subject Events & Notes
184-
logging.info("Navigating to 'Subject Events & Notes' for the selected subject.")
185-
SubjectScreeningSummaryPage(page).click_subjects_events_notes()
186-
187-
# add an Additional kit Note if the subject already has one
188-
logging.info("Selecting 'kit Note'.")
189-
SubjectEventsNotes(page).select_kit_note()
190-
# Set the note title
191-
note_title = "kit Note - General observation title2"
192-
logging.info(f"Filling in notes: '{note_title}'.")
193-
SubjectEventsNotes(page).fill_note_title(note_title)
194-
# Set the note type for verification
195-
note_text = "kit Note - General observation2"
196-
logging.info(f"Filling in notes: '{note_text}'.")
197-
SubjectEventsNotes(page).fill_notes(note_text)
198-
# Dismiss dialog and update notes
199-
logging.info("Accepting dialog and clicking 'Update Notes'.")
200-
SubjectEventsNotes(page).accept_dialog_and_update_notes()
201-
202-
# Get supporting notes for the subject from DB
203-
logging.info(
204-
"Retrieving supporting notes for the subject with NHS Number: {nhs_no}."
205-
)
206-
screening_subject_id = int(subjects_df["screening_subject_id"].iloc[0])
207-
logging.info(f"Screening Subject ID retrieved: {screening_subject_id}")
208-
type_id = int(subjects_df["type_id"].iloc[0])
209-
note_status = int(
210-
subjects_df["note_status"].iloc[0]
211-
) # Get the note status from the DataFrame
212-
notes_df = get_supporting_notes(screening_subject_id, type_id, note_status)
213-
214-
# Verify title and note match the provided values
215-
logging.info(
216-
f"Verifying that the title and note match the provided values for type_id: {type_id}."
217-
)
218-
assert (
219-
notes_df["title"].iloc[0].strip() == note_title
220-
), f"Title does not match. Expected: '{note_title}', Found: '{notes_df['title'].iloc[0].strip()}'."
221-
assert (
222-
notes_df["note"].iloc[0].strip() == note_text
223-
), f"Note does not match. Expected: '{note_text}', Found: '{notes_df['note'].iloc[0].strip()}'."
224-
225-
logging.info(
226-
f"Verification successful:kit note added for the subject with NHS Number: {nhs_no}. "
227-
f"Title and note matched the provided values. Title: '{note_title}', Note: '{note_text}'."
228-
)
229-
230-
231154
def test_identify_subject_with_kit_note(page: Page, general_properties: dict) -> None:
232155
"""
233156
Test to identify if a subject has a kit note.

0 commit comments

Comments
 (0)