Skip to content

Commit b073fdb

Browse files
author
Saqib
committed
Phase 26: Fix all failed smoke tests
Fixed 6 failing tests by addressing missing waits and credentials: 1. **test_prv_001_login**: Added test_credentials fixture parameter - Error: TypeError 'NoneType' not iterable (email was None) - Fix: Pass email/password from test_credentials fixture 2. **test_prv_003, 004, 007, 008** (UseCase tests): Added wait after clicking "Add New UseCase" - Error: TimeoutException "Could not find UseCase summary textarea" - Fix: Wait for summary textarea to load in click_add_new_usecase() 3. **test_prv_009_org_edit_profile**: Added wait after clicking Profile link - Error: TimeoutException on profile page load - Fix: Wait for "My Profile" heading to load Additional improvements: - Added waits in click_usecases_card() for both MyDashboard and Organizations pages - Added waits in click_profile_card() for both MyDashboard and Organizations pages - Ensures all navigation methods wait for target pages to fully load before returning
1 parent 41327a8 commit b073fdb

7 files changed

Lines changed: 61 additions & 3 deletions
59.7 KB
Loading

pages/provider/my_dashboard_page.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,33 @@ def click_add_new_dataset(self) -> CreateDatasetPage:
133133
return CreateDatasetPage(self.driver)
134134

135135
def click_usecases_card(self):
136+
from locators.provider.usecases_list_page_locators import UseCaseListPageLocators
137+
136138
self.wait_with_timeout(10).until(
137139
EC.element_to_be_clickable(MyDashboardLocators.USECASES_NAV_LINK),
138140
message="Timed out waiting for the 'Usecases' card to be clickable"
139141
).click()
142+
143+
# Wait for the UseCases page to load by checking for the "Add New UseCase" button
144+
self.wait_with_timeout(10).until(
145+
EC.visibility_of_element_located(UseCaseListPageLocators.ADD_NEW_USECASE_BUTTON),
146+
message="Timed out waiting for UseCases page to load"
147+
)
148+
140149
return UseCasesListPage(self.driver)
141150

142151
def click_profile_card(self):
152+
from locators.provider.update_profile_locators import UpdateProfilePageLocators
153+
143154
self.wait_with_timeout(10).until(
144155
EC.element_to_be_clickable(MyDashboardLocators.PROFILE_NAV_LINK),
145156
message="Timed out waiting for the 'Profile' card to be clickable"
146157
).click()
158+
159+
# Wait for the profile page to load by checking for the "My Profile" heading
160+
self.wait_with_timeout(10).until(
161+
EC.visibility_of_element_located(UpdateProfilePageLocators.My_Profile_HEADING),
162+
message="Timed out waiting for Profile page to load"
163+
)
164+
147165
return UpdateProfilePage(self.driver)

pages/provider/organizations_page.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,19 @@ def click_usecases_card(self):
116116
Returns a UseCasesListPage instance.
117117
"""
118118
from pages.provider.usecases_list_page import UseCasesListPage
119+
from locators.provider.usecases_list_page_locators import UseCaseListPageLocators
119120

120121
self.wait_with_timeout(10).until(
121122
EC.element_to_be_clickable(OrgLocators.USECASES_NAV_LINK),
122123
message="Timed out waiting for the 'UseCases' link to be clickable"
123124
).click()
124125

126+
# Wait for the UseCases page to load by checking for the "Add New UseCase" button
127+
self.wait_with_timeout(10).until(
128+
EC.visibility_of_element_located(UseCaseListPageLocators.ADD_NEW_USECASE_BUTTON),
129+
message="Timed out waiting for UseCases page to load"
130+
)
131+
125132
return UseCasesListPage(self.driver)
126133

127134
def click_profile_card(self):
@@ -134,10 +141,17 @@ def click_profile_card(self):
134141
Returns an UpdateProfilePage instance.
135142
"""
136143
from pages.provider.update_profile_page import UpdateProfilePage
144+
from locators.provider.update_profile_locators import UpdateProfilePageLocators
137145

138146
self.wait_with_timeout(10).until(
139147
EC.element_to_be_clickable(OrgLocators.PROFILE_NAV_LINK),
140148
message="Timed out waiting for the 'Profile' link to be clickable"
141149
).click()
142150

151+
# Wait for the profile page to load by checking for the "My Profile" heading
152+
self.wait_with_timeout(10).until(
153+
EC.visibility_of_element_located(UpdateProfilePageLocators.My_Profile_HEADING),
154+
message="Timed out waiting for Profile page to load"
155+
)
156+
143157
return UpdateProfilePage(self.driver)

pages/provider/usecases_list_page.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from pages.base_page import BasePage
66
from pages.provider.create_usecase_page import CreateUsecasePage
77
from locators.provider.usecases_list_page_locators import UseCaseListPageLocators
8+
from locators.provider.create_usecase_locators import CreateUsecaseLocators
89

910

1011
class UseCasesListPage(BasePage):
@@ -18,6 +19,19 @@ def is_loaded(self):
1819
)
1920

2021
def click_add_new_usecase(self):
22+
"""
23+
Click the "Add New UseCase" button and wait for the create usecase form to load.
24+
25+
Returns:
26+
CreateUsecasePage instance after the form has loaded
27+
"""
2128
self.driver.find_element(*UseCaseListPageLocators.ADD_NEW_USECASE_BUTTON).click()
29+
30+
# Wait for the UseCase creation form to load by checking for the summary textarea
31+
self.wait_with_timeout(10).until(
32+
EC.visibility_of_element_located(CreateUsecaseLocators.USECASE_SUMMARY_INPUT),
33+
message="Timed out waiting for UseCase creation form to load"
34+
)
35+
2236
return CreateUsecasePage(self.driver)
2337

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
_state_,district,_date,year,month,avg_smlvl_at15cm,_agency_name
2+
Madhya Pradesh,Vidisha,2023-01-04T10:07:33Z,2023,1,22.4790934997,NRSC VIC MODEL
3+
Madhya Pradesh,Vidisha,2023-01-08T10:07:33Z,2023,1,22.3545937778,NRSC VIC MODEL
4+
Madhya Pradesh,Vidisha,2023-01-10T10:07:33Z,2023,1,22.2889593178,NRSC VIC MODEL
5+
Madhya Pradesh,Vidisha,2023-01-11T10:07:33Z,2023,1,22.2922401219,NRSC VIC MODEL
6+
Madhya Pradesh,Vidisha,2023-01-15T10:07:33Z,2023,1,22.167213275,NRSC VIC MODEL
7+
Madhya Pradesh,Vidisha,2023-01-18T10:07:33Z,2023,1,22.0865192788,NRSC VIC MODEL
8+
Madhya Pradesh,Vidisha,2023-01-19T10:07:33Z,2023,1,22.0589074178,NRSC VIC MODEL
9+
Madhya Pradesh,Vidisha,2023-01-23T10:07:33Z,2023,1,21.9648621457,NRSC VIC MODEL
10+
Madhya Pradesh,Vidisha,2023-02-03T10:05:28Z,2023,2,25.7675515718,NRSC VIC MODEL
11+
Madhya Pradesh,Vidisha,2023-01-01T10:07:33Z,2023,1,22.5548504826,NRSC VIC MODEL

tests/provider/smoke/test_prv_001_login.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@
1111

1212

1313
@pytest.mark.smoke
14-
def test_prv_001_login_smoke(driver, base_url):
14+
def test_prv_001_login_smoke(driver, base_url, test_credentials):
1515
# Step 0: ensure a clean session
1616
driver.delete_all_cookies()
1717
home = HomePage(driver, base_url)
1818
home.load()
1919

2020
# Step 1: click LOGIN / SIGN UP and expect a LoginPage
21-
prov_home = home.go_to_login(flow="provider")
21+
email, password = test_credentials
22+
prov_home = home.go_to_login(flow="provider", email=email, password=password)
2223
# Assert that go_to_login actually returned a ProviderHomePage
2324
assert isinstance(prov_home, ProviderHomePage), "Did not land on ProviderHomePage"
2425

2526
# Optionally, verify some element on ProviderHomePage is visible:
2627
WebDriverWait(driver, 5).until(
27-
EC.visibility_of_element_located((By.XPATH, ProviderHomepageLocators.HEADER))
28+
EC.visibility_of_element_located(ProviderHomepageLocators.HEADER)
2829
)
2930
assert prov_home.is_header_visible()

0 commit comments

Comments
 (0)