Skip to content

Commit ef20095

Browse files
committed
resolving format issues
1 parent 371f40e commit ef20095

File tree

2 files changed

+66
-38
lines changed

2 files changed

+66
-38
lines changed

pages/screening_subject_search/subject_events_notes.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@ class SubjectEventsNotes(BasePage):
1212
def __init__(self, page: Page):
1313
super().__init__(page)
1414
self.page = page
15-
self.table_utils = TableUtils (page, "#displayRS") # Initialize TableUtils for the table with id="displayRS"
15+
self.table_utils = TableUtils(
16+
page, "#displayRS"
17+
) # Initialize TableUtils for the table with id="displayRS"
1618
# Subject Events Notes - page filters
17-
self.additional_care_note_checkbox = self.page.get_by_label("Additional Care Needs Note")
18-
self.subject_note_checkbox = self.page.get_by_label(
19-
"Subject Note"
20-
)
21-
self.kit_note_checkbox = self.page.get_by_label(
22-
"Kit Note"
23-
)
24-
self.additional_care_note_type=self.page.locator("#UI_ADDITIONAL_CARE_NEED")
25-
self.notes_upto_500_char = self.page.get_by_label(
26-
"Notes (up to 500 char)"
19+
self.additional_care_note_checkbox = self.page.get_by_label(
20+
"Additional Care Needs Note"
2721
)
22+
self.subject_note_checkbox = self.page.get_by_label("Subject Note")
23+
self.kit_note_checkbox = self.page.get_by_label("Kit Note")
24+
self.additional_care_note_type = self.page.locator("#UI_ADDITIONAL_CARE_NEED")
25+
self.notes_upto_500_char = self.page.get_by_label("Notes (up to 500 char)")
2826
self.update_notes_button = self.page.get_by_role("button", name="Update Notes")
2927

3028
def select_additional_care_note(self) -> None:
@@ -48,26 +46,27 @@ def select_additional_care_note_type(self, option: str) -> None:
4846
- AdditionalCareNoteTypeOptions.LANGUAGE
4947
- AdditionalCareNoteTypeOptions.OTHER
5048
"""
51-
self.additional_care_note_type.select_option(option)
49+
self.additional_care_note_type.select_option(option)
5250

5351
def fill_notes(self, notes: str) -> None:
5452
"""Fills the notes field with the provided text."""
55-
self.notes_upto_500_char.fill(notes)
53+
self.notes_upto_500_char.fill(notes)
5654

5755
def dismiss_dialog_and_update_notes(self) -> None:
5856
"""Clicks the 'Update Notes' button and handles the dialog by clicking 'OK'."""
5957
self.page.once("dialog", lambda dialog: dialog.accept())
6058
self.update_notes_button.click()
6159

60+
6261
class AdditionalCareNoteTypeOptions(StrEnum):
6362
"""Enum for AdditionalCareNoteTypeOptions."""
6463

6564
LEARNING_DISABILITY = "4120"
6665
SIGHT_DISABILITY = "4121"
6766
HEARING_DISABILITY = "4122"
6867
MOBILITY_DISABILITY = "4123"
69-
MANUAL_DEXTERITY= "4124"
68+
MANUAL_DEXTERITY = "4124"
7069
SPEECH_DISABILITY = "4125"
7170
CONTINENCE_DISABILITY = "4126"
72-
LANGUAGE= "4128"
73-
OTHER= "4127"
71+
LANGUAGE = "4128"
72+
OTHER = "4127"

tests/regression/notes/test_additional_care_notes_regression.py

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
import logging
22
import pytest
3-
from playwright.sync_api import Page,expect
3+
from playwright.sync_api import Page, expect
44
from pages import screening_subject_search
55
from pages.logout.log_out_page import LogoutPage
66
from pages.base_page import BasePage
77
from pages.screening_subject_search import subject_screening_search_page
88
from 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+
)
1219
from 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

1626
def 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())
2637
def 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

Comments
 (0)