Skip to content

Commit d066e7e

Browse files
author
Saqib
committed
Phase 21: Fix locator double-wrapping in MyDashboardPage
Remove redundant (By.XPATH, ...) wrapper from MyDashboardLocators references. MyDashboardLocators already defines locators as tuples (By.XPATH, "xpath"), so wrapping them again creates invalid nested tuples that cause Selenium errors. Fixed in methods: - is_loaded() - goto_my_dashboard() - click_datasets_sidebar() - click_add_new_dataset() - click_usecases_card() - click_profile_card()
1 parent 514e027 commit d066e7e

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

pages/provider/my_dashboard_page.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,35 @@ def load(self):
2828

2929
def is_loaded(self, timeout: int = 10) -> bool:
3030
"""
31-
Verify that at least the My Dashboard card is visible (this is the first screen you see
31+
Verify that at least the "My Dashboard" card is visible (this is the first screen you see
3232
after login). We do *not* yet assume we are inside the Datasets panel.
3333
Tests should call `is_loaded()` right after obtaining a MyDashboardPage
3434
to ensure that the login redirect finished.
3535
"""
3636
self.wait_with_timeout(timeout).until(
37-
EC.visibility_of_element_located(
38-
(By.XPATH, MyDashboardLocators.CARD_MY_DASHBOARD)
39-
),
37+
EC.visibility_of_element_located(MyDashboardLocators.CARD_MY_DASHBOARD),
4038
message="Timed out waiting for the 'My Dashboard' card to appear on the Provider landing page"
4139
)
4240
return True
4341

4442
def goto_my_dashboard(self) -> "MyDashboardPage":
4543
"""
46-
Click the big My Dashboard c ard on /dashboard. This reveals the sidebar menu.
44+
Click the big "My Dashboard" c ard on /dashboard. This reveals the sidebar menu.
4745
Returns self (so tests can chain further calls).
4846
"""
4947
self.wait_with_timeout(10).until(
50-
EC.element_to_be_clickable((By.XPATH, MyDashboardLocators.CARD_MY_DASHBOARD)),
48+
EC.element_to_be_clickable(MyDashboardLocators.CARD_MY_DASHBOARD),
5149
message="Timed out waiting for the 'My Dashboard' card to be clickable"
5250
).click()
5351
return self
5452

5553
def click_datasets_sidebar(self) -> "MyDashboardPage":
5654
"""
57-
Once the sidebar appears, click Datasets so that the Drafts/Published table loads.
55+
Once the sidebar appears, click "Datasets" so that the Drafts/Published table loads.
5856
Returns self (so tests can chain).
5957
"""
6058
self.wait_with_timeout(10).until(
61-
EC.element_to_be_clickable((By.XPATH, MyDashboardLocators.SIDEBAR_DATASETS)),
59+
EC.element_to_be_clickable(MyDashboardLocators.SIDEBAR_DATASETS),
6260
message="Timed out waiting for the 'Datasets' link in sidebar to be clickable"
6361
).click()
6462
return self
@@ -83,21 +81,21 @@ def click_add_new_dataset(self) -> CreateDatasetPage:
8381
try:
8482
# If "My Dashboard" card is still visible, click it once.
8583
self.wait_with_timeout(3).until(
86-
EC.element_to_be_clickable((By.XPATH, MyDashboardLocators.CARD_MY_DASHBOARD))
84+
EC.element_to_be_clickable(MyDashboardLocators.CARD_MY_DASHBOARD)
8785
).click()
8886
except TimeoutException:
8987
# If it's not there, maybe they already clicked it. Either way—proceed.
9088
pass
9189

9290
# Step C: Wait for the "Drafts" tab to appear. This ensures the Datasets panel is fully rendered.
9391
self.wait_with_timeout(10).until(
94-
EC.visibility_of_element_located((By.XPATH, MyDashboardLocators.DRAFTS_TAB)),
92+
EC.visibility_of_element_located(MyDashboardLocators.DRAFTS_TAB),
9593
message="Timed out waiting for the 'Drafts' tab to appear"
9694
)
9795

9896
# Step D: Now wait for "Add New Dataset" button to be clickable:
9997
btn = self.wait_with_timeout(10).until(
100-
EC.element_to_be_clickable((By.XPATH, MyDashboardLocators.ADD_NEW_DATASET_BTN)),
98+
EC.element_to_be_clickable(MyDashboardLocators.ADD_NEW_DATASET_BTN),
10199
message="Timed out waiting for the 'Add New Dataset' button to become clickable"
102100
)
103101

@@ -136,14 +134,14 @@ def click_add_new_dataset(self) -> CreateDatasetPage:
136134

137135
def click_usecases_card(self):
138136
self.wait_with_timeout(10).until(
139-
EC.element_to_be_clickable((By.XPATH, MyDashboardLocators.USECASES_NAV_LINK)),
137+
EC.element_to_be_clickable(MyDashboardLocators.USECASES_NAV_LINK),
140138
message="Timed out waiting for the 'Usecases' card to be clickable"
141139
).click()
142140
return UseCasesListPage(self.driver)
143141

144142
def click_profile_card(self):
145143
self.wait_with_timeout(10).until(
146-
EC.element_to_be_clickable((By.XPATH, MyDashboardLocators.PROFILE_NAV_LINK)),
144+
EC.element_to_be_clickable(MyDashboardLocators.PROFILE_NAV_LINK),
147145
message="Timed out waiting for the 'Profile' card to be clickable"
148146
).click()
149147
return UpdateProfilePage(self.driver)

0 commit comments

Comments
 (0)