Skip to content

Commit 0ff7b0e

Browse files
committed
updating subject notes
1 parent ef20095 commit 0ff7b0e

File tree

2 files changed

+292
-38
lines changed

2 files changed

+292
-38
lines changed

pages/screening_subject_search/subject_events_notes.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,27 @@ def __init__(self, page: Page):
2121
)
2222
self.subject_note_checkbox = self.page.get_by_label("Subject Note")
2323
self.kit_note_checkbox = self.page.get_by_label("Kit Note")
24+
self.note_title = self.page.get_by_label("Note Title")
2425
self.additional_care_note_type = self.page.locator("#UI_ADDITIONAL_CARE_NEED")
2526
self.notes_upto_500_char = self.page.get_by_label("Notes (up to 500 char)")
2627
self.update_notes_button = self.page.get_by_role("button", name="Update Notes")
28+
self.note_type = self.page.locator("#UI_ADDITIONAL_CARE_NEED_FILTER")
29+
self.note_status = self.page.locator(
30+
"select[name^='UI_SUPPORTING_NOTE_STATUS_']"
31+
)
2732

2833
def select_additional_care_note(self) -> None:
2934
"""Selects the 'Additional Care Needs Note' checkbox."""
3035
self.additional_care_note_checkbox.check()
3136

37+
def select_subject_note(self) -> None:
38+
"""Selects the 'subject note' checkbox."""
39+
self.subject_note_checkbox.check()
40+
41+
def select_kit_note(self) -> None:
42+
"""Selects the 'kit note' checkbox."""
43+
self.kit_note_checkbox.check()
44+
3245
def select_additional_care_note_type(self, option: str) -> None:
3346
"""Selects an option from the 'Additional Care Note Type' dropdown.
3447
@@ -48,6 +61,28 @@ def select_additional_care_note_type(self, option: str) -> None:
4861
"""
4962
self.additional_care_note_type.select_option(option)
5063

64+
def select_note_type(self, option: str) -> None:
65+
"""
66+
Selects a note type from the dropdown menu.
67+
68+
Args:
69+
option (str): The value of the option to select from the dropdown.
70+
"""
71+
self.note_type.select_option(option)
72+
73+
def select_note_status(self, option: str) -> None:
74+
"""
75+
Selects a note status from the dropdown menu.
76+
77+
Args:
78+
option (str): The value of the option to select from the dropdown.
79+
"""
80+
self.note_status.select_option(option)
81+
82+
def fill_note_title(self, title: str) -> None:
83+
"""Fills the title field with the provided text."""
84+
self.note_title.fill(title)
85+
5186
def fill_notes(self, notes: str) -> None:
5287
"""Fills the notes field with the provided text."""
5388
self.notes_upto_500_char.fill(notes)
@@ -57,6 +92,44 @@ def dismiss_dialog_and_update_notes(self) -> None:
5792
self.page.once("dialog", lambda dialog: dialog.accept())
5893
self.update_notes_button.click()
5994

95+
def dismiss_dialog_and_add_replacement_note(self) -> None:
96+
"""
97+
Dismisses the dialog and clicks the 'Add Replacement Note' button.
98+
"""
99+
self.page.once("dialog", lambda dialog: dialog.dismiss())
100+
self.page.get_by_role("button", name="Add Replacement Note").click()
101+
102+
def dismiss_dialog(self) -> None:
103+
"""
104+
Dismisses a dialog when it appears.
105+
"""
106+
self.page.once("dialog", lambda dialog: dialog.dismiss())
107+
108+
def get_title_and_note_from_row(self, row_number: int = 0) -> dict:
109+
"""
110+
Extracts title and note from a specific row's 'Notes' column using dynamic column index.
111+
"""
112+
row_count = self.table_utils.get_row_count()
113+
if row_count == 0:
114+
raise ValueError("The table is empty.")
115+
116+
# Find the 'Notes' column index (1-based)
117+
notes_col_index = self.table_utils.get_column_index("Notes")
118+
if notes_col_index == -1:
119+
raise ValueError("The 'Notes' column was not found in the table.")
120+
121+
# Locate the cell at the specific row and column
122+
cell = self.page.locator(
123+
f"{self.table_utils} > tbody > tr:nth-child({row_number + 1}) > td:nth-child({notes_col_index})"
124+
)
125+
cell_text = cell.inner_text().strip()
126+
127+
lines = cell_text.split("\n")
128+
title = lines[0].strip() if len(lines) > 0 else ""
129+
note = lines[1].strip() if len(lines) > 1 else ""
130+
131+
return {"title": title, "note": note}
132+
60133

61134
class AdditionalCareNoteTypeOptions(StrEnum):
62135
"""Enum for AdditionalCareNoteTypeOptions."""
@@ -70,3 +143,19 @@ class AdditionalCareNoteTypeOptions(StrEnum):
70143
CONTINENCE_DISABILITY = "4126"
71144
LANGUAGE = "4128"
72145
OTHER = "4127"
146+
147+
148+
class NotesOptions(StrEnum):
149+
"""Enum for NoteTypeOptions."""
150+
151+
SUBJECT_NOTE = "4111"
152+
KIT_NOTE = "308015"
153+
ADDITIONAL_CARE_NOTE = "4112"
154+
155+
156+
class NotesStatusOptions(StrEnum):
157+
"""Enum for NoteStatusOptions."""
158+
159+
ACTIVE = "4100"
160+
OBSOLETE = "4101"
161+
INVALID = "4102"

0 commit comments

Comments
 (0)