Skip to content

Commit d8786d1

Browse files
Adding more scenarios and ifxing subject selection query builder for temporary addresses
1 parent 4e3e67e commit d8786d1

File tree

5 files changed

+340
-43
lines changed

5 files changed

+340
-43
lines changed

pages/base_page.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,20 +249,24 @@ def safe_accept_dialog(self, locator: Locator) -> None:
249249
except Exception as e:
250250
logging.error(f"Click failed: {e}")
251251

252-
253252
def assert_dialog_text(self, expected_text: str) -> None:
254253
"""
255254
Asserts that a dialog appears and contains the expected text.
256255
If no dialog appears, logs an error.
257256
Args:
258257
expected_text (str): The text that should be present in the dialog.
259258
"""
259+
self._dialog_assertion_error = None
260260

261-
def handle_dialog(dialog):
261+
def handle_dialog(dialog: Dialog):
262+
logging.info(f"Dialog appeared with message: {dialog.message}")
262263
actual_text = dialog.message
263-
assert (
264-
actual_text == expected_text
265-
), f"Expected '{expected_text}', but got '{actual_text}'"
264+
try:
265+
assert (
266+
actual_text == expected_text
267+
), f"Expected '{expected_text}', but got '{actual_text}'"
268+
except AssertionError as e:
269+
self._dialog_assertion_error = e
266270
dialog.dismiss() # Dismiss dialog
267271

268272
self.page.once("dialog", handle_dialog)

pages/screening_subject_search/subject_demographic_page.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,10 @@ def update_temporary_address(self, dict: dict) -> None:
143143
Expected keys: 'valid_from', 'valid_to', 'address_line_1',
144144
'address_line_2', 'address_line_3', 'address_line_4', 'address_line_5'.
145145
"""
146-
if not dict:
147-
raise ValueError("The 'dict' argument cannot be None or empty")
148-
149146
# Click the link to show the temporary address fields
150-
self.click(self.temporary_address_show_link)
147+
if self.temporary_address_show_link.is_visible():
148+
# If the link is visible, click it to show the temporary address fields
149+
self.click(self.temporary_address_show_link)
151150

152151
# Update the valid from date
153152
if "valid_from" in dict:

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ markers =
3939
vpn_required: for tests that require a VPN connection
4040
regression: tests that are part of the regression test suite
4141
call_and_recall: tests that are part of the call and recall test suite
42+
subject_tests: tests that are part of the subject tests suite
43+
subject_search: tests that are part of the subject search test suite

0 commit comments

Comments
 (0)