Skip to content

Commit 8da2c63

Browse files
author
Saqib
committed
Phase 27: Add delays and increase timeouts for form loading
Fixed persistent timeout issues by adding explicit delays and increasing timeout values: 1. **click_add_new_usecase()**: - Wait for button to be clickable before clicking - Add 2-second delay after click for modal/form to appear - Increase timeout from 10s to 15s 2. **click_profile_card()** (both MyDashboard and Organizations): - Add 2-second delay after clicking profile link - Increase timeout from 10s to 15s 3. **select_geography()**: - Add 1-second delay after clicking dropdown toggle - Add 0.5-second delay after selection - Increase timeout from 10s to 15s - Use wait_with_timeout() instead of self.wait for consistency These changes accommodate slower page transitions and element rendering times.
1 parent 4ad0686 commit 8da2c63

4 files changed

Lines changed: 34 additions & 6 deletions

File tree

pages/provider/create_dataset_page.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,24 @@ def select_tags(self, items: list[str]):
7676
return self
7777

7878
def select_geography(self, value: str):
79-
toggle = self.wait.until(EC.element_to_be_clickable(
79+
import time
80+
81+
toggle = self.wait_with_timeout(10).until(EC.element_to_be_clickable(
8082
(By.XPATH, CreateDatasetLocators.GEOGRAPHY_CONTAINER)
8183
))
8284
toggle.click()
83-
opt = self.wait.until(EC.element_to_be_clickable(
85+
86+
# Give dropdown time to appear
87+
time.sleep(1)
88+
89+
opt = self.wait_with_timeout(15).until(EC.element_to_be_clickable(
8490
(By.XPATH, CreateDatasetLocators.GEO_OPTION.format(value=value))
8591
))
8692
opt.click()
93+
94+
# Give time for selection to register
95+
time.sleep(0.5)
96+
8797
ActionChains(self.driver).send_keys(Keys.ESCAPE).perform()
8898
return self
8999

pages/provider/my_dashboard_page.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,18 @@ def click_usecases_card(self):
150150

151151
def click_profile_card(self):
152152
from locators.provider.update_profile_locators import UpdateProfilePageLocators
153+
import time
153154

154155
self.wait_with_timeout(10).until(
155156
EC.element_to_be_clickable(MyDashboardLocators.PROFILE_NAV_LINK),
156157
message="Timed out waiting for the 'Profile' card to be clickable"
157158
).click()
158159

160+
# Give the profile page time to load
161+
time.sleep(2)
162+
159163
# Wait for the profile page to load by checking for the "My Profile" heading
160-
self.wait_with_timeout(10).until(
164+
self.wait_with_timeout(15).until(
161165
EC.visibility_of_element_located(UpdateProfilePageLocators.My_Profile_HEADING),
162166
message="Timed out waiting for Profile page to load"
163167
)

pages/provider/organizations_page.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,18 @@ def click_profile_card(self):
142142
"""
143143
from pages.provider.update_profile_page import UpdateProfilePage
144144
from locators.provider.update_profile_locators import UpdateProfilePageLocators
145+
import time
145146

146147
self.wait_with_timeout(10).until(
147148
EC.element_to_be_clickable(OrgLocators.PROFILE_NAV_LINK),
148149
message="Timed out waiting for the 'Profile' link to be clickable"
149150
).click()
150151

152+
# Give the profile page time to load
153+
time.sleep(2)
154+
151155
# Wait for the profile page to load by checking for the "My Profile" heading
152-
self.wait_with_timeout(10).until(
156+
self.wait_with_timeout(15).until(
153157
EC.visibility_of_element_located(UpdateProfilePageLocators.My_Profile_HEADING),
154158
message="Timed out waiting for Profile page to load"
155159
)

pages/provider/usecases_list_page.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,20 @@ def click_add_new_usecase(self):
2525
Returns:
2626
CreateUsecasePage instance after the form has loaded
2727
"""
28-
self.driver.find_element(*UseCaseListPageLocators.ADD_NEW_USECASE_BUTTON).click()
28+
import time
29+
30+
# Wait for the button to be clickable before clicking
31+
button = self.wait_with_timeout(10).until(
32+
EC.element_to_be_clickable(UseCaseListPageLocators.ADD_NEW_USECASE_BUTTON),
33+
message="Timed out waiting for 'Add New UseCase' button to be clickable"
34+
)
35+
button.click()
36+
37+
# Give the modal/form time to appear
38+
time.sleep(2)
2939

3040
# Wait for the UseCase creation form to load by checking for the summary textarea
31-
self.wait_with_timeout(10).until(
41+
self.wait_with_timeout(15).until(
3242
EC.visibility_of_element_located(CreateUsecaseLocators.USECASE_SUMMARY_INPUT),
3343
message="Timed out waiting for UseCase creation form to load"
3444
)

0 commit comments

Comments
 (0)