Skip to content

Commit a2c5504

Browse files
committed
Removed 'else' from if statement on click function.
Fixed failing test: test_operational_reports_screening_practitioner_appointments
1 parent 40e563f commit a2c5504

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

pages/base_page.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, page: Page):
3737
self.organisations_page = self.page.get_by_role("link", name="Organisations")
3838
self.reports_page = self.page.get_by_role("link", name="Reports")
3939
self.screening_practitioner_appointments_page = self.page.get_by_role(
40-
"link", name="Screening Practitioner"
40+
"link", name="Screening Practitioner Appointments"
4141
)
4242
self.screening_subject_search_page = self.page.get_by_role(
4343
"link", name="Screening Subject Search"
@@ -156,17 +156,16 @@ def click(self, locator: Locator) -> None:
156156
if alerts_table.is_visible():
157157
alerts_table.wait_for(state="attached")
158158
alerts_table.wait_for(state="visible")
159-
else:
160-
try:
161-
self.page.wait_for_load_state("load")
162-
self.page.wait_for_load_state("domcontentloaded")
163-
self.page.wait_for_load_state("networkidle")
164-
locator.wait_for(state="attached")
165-
locator.wait_for(state="visible")
166-
locator.click()
167-
168-
except Exception as locatorClickError:
169-
logging.warning(
170-
f"Failed to click element with error: {locatorClickError}, trying again..."
171-
)
172-
locator.click()
159+
try:
160+
self.page.wait_for_load_state("load")
161+
self.page.wait_for_load_state("domcontentloaded")
162+
self.page.wait_for_load_state("networkidle")
163+
locator.wait_for(state="attached")
164+
locator.wait_for(state="visible")
165+
locator.click()
166+
167+
except Exception as locatorClickError:
168+
logging.warning(
169+
f"Failed to click element with error: {locatorClickError}, trying again..."
170+
)
171+
locator.click()

0 commit comments

Comments
 (0)