Skip to content

Commit e40259f

Browse files
committed
fix(selenium): update loading indicator ID in wait condition for Selenium tests
1 parent 8c8e68f commit e40259f

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

modules/core/js_modules/utils/loaders.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function showLoaderToast(text = 'Loading...') {
22
const uniqueId = Math.random().toString(36).substring(7);
33
const toastHTML = `
4-
<div class="position-fixed bottom-0 start-0 p-3" style="z-index: 9999">
4+
<div id="loading_indicator" class="position-fixed bottom-0 start-0 p-3" style="z-index: 9999">
55
<div class="toast bg-primary text-white" id="${uniqueId}" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
66
<div class="toast-body">
77
<div class="d-flex align-items-center">

tests/selenium/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def wait_for_navigation_to_complete(self, timeout=30):
169169
try:
170170
# Wait for any loading indicators to disappear
171171
WebDriverWait(self.driver, 5).until_not(
172-
lambda driver: len(driver.find_elements(By.CLASS_NAME, "loading_icon")) > 0
172+
lambda driver: len(driver.find_elements(By.ID, "loading_indicator")) > 0
173173
)
174174
except:
175175
# Loading icon might not be present, continue

tests/selenium/pages.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def search(self):
2222
# More flexible text matching for search page
2323
content_title = self.by_class('content_title')
2424
title_text = content_title.text.strip()
25+
print(f"MESSAGES FOUND: '{title_text}'")
2526
assert 'Search' in title_text or 'search' in title_text.lower(), f"Expected 'Search' in title, got: '{title_text}'"
2627

2728
def sent(self):
@@ -87,16 +88,9 @@ def flagged(self):
8788
self.wait_with_folder_list()
8889
self.safari_workaround()
8990
self.wait_for_navigation_to_complete()
90-
# Look for mailbox_list_title inside content_title
91-
try:
92-
mailbox_title = self.by_class('mailbox_list_title')
93-
title_text = mailbox_title.text.strip()
94-
assert 'Flagged' in title_text, f"Expected 'Flagged' in mailbox title, got: '{title_text}'"
95-
except:
96-
# Fallback: check content_title for flagged-related text
97-
content_title = self.by_class('content_title')
98-
title_text = content_title.text.strip()
99-
assert 'Flagged' in title_text, f"Expected 'Flagged' in content title, got: '{title_text}'"
91+
mailbox_title = self.by_class('mailbox_list_title')
92+
title_text = mailbox_title.text.strip()
93+
assert 'Flagged' in title_text, f"Expected 'Flagged' in mailbox title, got: '{title_text}'"
10094

10195
def contacts(self):
10296
if not self.mod_active('contacts'):
@@ -138,7 +132,7 @@ def calendar(self):
138132
# Try calendar_content_title first, then fallback to content_title
139133
try:
140134
calendar_title = self.by_class('calendar_content_title')
141-
title_text = calendar_title.text.strip()
135+
title_text = calendar_title.text
142136
assert 'Calendar' in title_text, f"Expected 'Calendar' in calendar title, got: '{title_text}'"
143137
except:
144138
# Fallback: check content_title for calendar-related text

tests/selenium/servers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@ def server_stmp_and_imap_add(self):
4040
next_button = WebDriverWait(self.driver, 10).until(
4141
EC.element_to_be_clickable((By.ID, "step_config_action_next"))
4242
)
43-
next_button.click()
43+
# Scroll to the button and wait for any animations/overlays to finish
44+
self.driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center'});", next_button)
45+
sleep(0.5) # Wait for smooth scroll to complete
46+
47+
# Try multiple click methods for better reliability
48+
try:
49+
next_button.click()
50+
except Exception as e:
51+
print(f"Normal click failed: {e}. Trying JavaScript click...")
52+
self.driver.execute_script("arguments[0].click();", next_button)
4453
# show step two
4554
WebDriverWait(self.driver, 10).until(
4655
EC.visibility_of_element_located((By.XPATH, '//h2[text()="Step 2"]'))

0 commit comments

Comments
 (0)