Skip to content

Commit 5cd6e23

Browse files
committed
Added letter library tests
1 parent 237b847 commit 5cd6e23

File tree

4 files changed

+426
-76
lines changed

4 files changed

+426
-76
lines changed

pages/communication_production/letter_library_index_page.py

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def define_supplementary_letter(
9393
priority_id: str = "12016",
9494
signatory: str = "signatory",
9595
job_title: str = "job title",
96-
paragraph_text: str = "body text"
96+
paragraph_text: str = "body text",
9797
) -> None:
9898
"""
9999
Fills out the form to define a supplementary letter and confirms save via modal.
@@ -118,3 +118,50 @@ def define_supplementary_letter(
118118
self.page.get_by_role("button", name="Save").click()
119119

120120

121+
class LetterDefinitionDetailPage(BasePage):
122+
"""Page object for the Letter Definition detail view"""
123+
124+
def __init__(self, page: Page):
125+
super().__init__(page)
126+
self.page = page
127+
128+
# Locators for each letter definition setting
129+
self.definition_table = self.page.locator("table#displayRS")
130+
self.current_version_label = self.page.get_by_text(
131+
"Current Version", exact=True
132+
)
133+
134+
def assert_definition_setting(self, field_name: str, expected_value: str) -> None:
135+
"""
136+
Asserts that a specific letter setting matches the expected value.
137+
138+
Args:
139+
field_name (str): The label text (e.g., "Description")
140+
expected_value (str): The expected value shown beside the label
141+
"""
142+
label_cell = self.page.locator(f"td.screenTableLabelCell", has_text=field_name)
143+
assert (
144+
label_cell.count() > 0
145+
), f"[ASSERTION FAILED] Field label '{field_name}' not found"
146+
147+
# The label is always followed by its corresponding input/value cell
148+
value_cell = label_cell.nth(0).locator("xpath=following-sibling::td[1]")
149+
actual_value = value_cell.inner_text().strip()
150+
151+
assert (
152+
actual_value == expected_value
153+
), f"[ASSERTION FAILED] For field '{field_name}', expected '{expected_value}', got '{actual_value}'"
154+
155+
def has_current_version(self) -> bool:
156+
"""
157+
Checks whether a version row exists with 'Current' as the type.
158+
159+
Returns:
160+
bool: True if a current version row is present, False otherwise
161+
"""
162+
version_table = self.page.locator("table#displayRS")
163+
current_row = version_table.locator("tr").filter(
164+
has=self.page.locator("td", has_text="Current")
165+
).first
166+
167+
return current_row.count() > 0

tests/regression/communications_production/test_basic_manage_archived_batch_functionality.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _login_as(user_role: str):
2929

3030
return _login_as
3131

32-
@pytest.mark.wip
32+
3333
@pytest.mark.letters_tests
3434
@pytest.mark.regression
3535
def test_reprint_and_archive_letter_batch(select_user) -> None:
@@ -89,7 +89,6 @@ def test_reprint_and_archive_letter_batch(select_user) -> None:
8989
manage_archived_page.confirm_archived_message_visible()
9090

9191

92-
@pytest.mark.wip
9392
@pytest.mark.letters_tests
9493
@pytest.mark.regression
9594
def test_check_that_s1_has_supplementary_batches(select_user) -> None:

0 commit comments

Comments
 (0)