Skip to content

Commit e609de5

Browse files
author
Saqib
committed
Phase 27 continuation: UseCase creation improvements
Updates from earlier debugging session: 1. Updated locators for Quill rich text editor: - Changed summary field from textarea to contenteditable div - Now correctly targets Quill editor with ql-editor class 2. Toast notification handling: - Made toast waiting non-blocking in multiple methods - Wrapped wait_for_invisibility in try-except blocks - Prevents timeouts when toasts don't auto-dismiss - Reduced timeout from 5s to 3s 3. Navigation timing improvements: - Added delays and scroll-into-view for navigation - Increased timeouts for form loading
1 parent 42ccc75 commit e609de5

2 files changed

Lines changed: 38 additions & 14 deletions

File tree

locators/provider/create_usecase_locators.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class CreateUsecaseLocators:
1313

1414
USECASE_NAME_INPUT = (By.XPATH, "//div[@class=' pl-2']//button[@type='button']")
1515
USECASE_SUMMARY_LABEL = (By.XPATH, "//label[normalize-space()='Summary *']")
16-
USECASE_SUMMARY_INPUT = (By.XPATH, "//textarea[@name='summary']")
16+
# Rich text editor (Quill) - uses contenteditable div, not textarea
17+
USECASE_SUMMARY_INPUT = (By.XPATH, "//div[contains(@class, 'ql-editor') and @contenteditable='true']")
1718

1819
PLATFORM_URL_INPUT = (By.XPATH, "//input[@name='platformUrl']")
1920

@@ -39,7 +40,8 @@ class CreateUsecaseLocators:
3940
LOGO_UPLOAD_INPUT = (By.XPATH, "//div[@class='FileUpload-module_Action__Hg0nE']")
4041

4142
# ─── Fields Used for Value Retrieval / Assertions ──────────────────────────
42-
SUMMARY_INPUT = (By.XPATH, "//textarea[@name='summary']")
43+
# Rich text editor (Quill) - uses contenteditable div, not textarea
44+
SUMMARY_INPUT = (By.XPATH, "//div[contains(@class, 'ql-editor') and @contenteditable='true']")
4345
STARTED_ON_VALUE_INPUT = (By.XPATH, "//input[@type='date' and @name='startedOn']")
4446
COMPLETED_ON_VALUE_INPUT = (By.XPATH, "//input[normalize-space(.)='Completed On']")
4547
RUNNING_STATUS_SELECT = (By.XPATH, "//select[@name='runningStatus']")

pages/provider/create_usecase_page.py

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,33 @@ def enter_usecase_name(self, name):
4040
return self # for method chaining
4141

4242
def enter_summary(self, text: str):
43-
# Wait for toast/overlay to disappear before interacting
44-
self.wait_for_invisibility((By.CLASS_NAME, "toast"), timeout=5)
43+
# Try to wait for toast/overlay to disappear, but don't fail if they persist
44+
try:
45+
self.wait_for_invisibility((By.CLASS_NAME, "toast"), timeout=3)
46+
except TimeoutException:
47+
pass # Continue anyway
48+
4549
fld = self.wait.until(
4650
EC.visibility_of_element_located(CreateUsecaseLocators.USECASE_SUMMARY_INPUT),
47-
message="Could not find UseCase summary textarea"
51+
message="Could not find UseCase summary editor"
4852
)
49-
fld.clear()
53+
# For Quill editor (contenteditable div), clear using Ctrl+A then type
54+
fld.click()
55+
# Ctrl+A works cross-platform (Selenium maps to Cmd+A on Mac)
56+
fld.send_keys(Keys.CONTROL + 'a')
57+
fld.send_keys(Keys.DELETE)
5058
fld.send_keys(text)
5159
# Send text twice (application-specific behavior)
5260
fld.send_keys(text)
5361
return self
5462

5563
def enter_platform_url(self, url: str):
56-
# Wait for any overlays to disappear
57-
self.wait_for_invisibility((By.CLASS_NAME, "toast"), timeout=5)
64+
# Try to wait for any overlays to disappear, but don't fail if they persist
65+
try:
66+
self.wait_for_invisibility((By.CLASS_NAME, "toast"), timeout=3)
67+
except TimeoutException:
68+
pass # Continue anyway
69+
5870
fld = self.wait.until(
5971
EC.visibility_of_element_located(CreateUsecaseLocators.PLATFORM_URL_INPUT),
6072
message="Could not find Platform Url input"
@@ -73,8 +85,12 @@ def select_tags(self, items: list[str]):
7385

7486
def select_sectors(self, items: list[str]):
7587
"""Select multiple sectors using BasePage utility to eliminate duplication"""
76-
# Wait for any toast notifications to disappear before clicking combobox
77-
self.wait_for_invisibility((By.CLASS_NAME, "toast"), timeout=5)
88+
# Try to wait for toast notifications to disappear, but don't fail if they persist
89+
# (toasts don't block interaction with the form)
90+
try:
91+
self.wait_for_invisibility((By.CLASS_NAME, "toast"), timeout=3)
92+
except TimeoutException:
93+
pass # Continue anyway - toasts don't block interaction
7894

7995
for val in items:
8096
self.select_combobox_option(CreateUsecaseLocators.SECTOR_INPUT, val)
@@ -115,9 +131,14 @@ def enter_started_on(self, iso_date: str):
115131
return self
116132

117133
def select_running_status(self, status_text: str):
118-
self.wait.until(
119-
EC.invisibility_of_element_located((By.CLASS_NAME, "toast"))
120-
)
134+
# Try to wait for toasts to disappear, but don't fail if they persist
135+
try:
136+
self.wait_with_timeout(3).until(
137+
EC.invisibility_of_element_located((By.CLASS_NAME, "toast"))
138+
)
139+
except TimeoutException:
140+
pass # Continue anyway
141+
121142
select_el = self.wait.until(
122143
EC.presence_of_element_located(CreateUsecaseLocators.RUNNING_STATUS_INPUT),
123144
message="Could not find Running Status <select>"
@@ -149,7 +170,8 @@ def get_usecase_name_value(self):
149170
return self.driver.find_element(*CreateUsecaseLocators.USECASE_NAME_INPUT).get_attribute("value")
150171

151172
def get_summary_value(self):
152-
return self.driver.find_element(*CreateUsecaseLocators.SUMMARY_INPUT).get_attribute("value")
173+
# For contenteditable div, use textContent instead of value attribute
174+
return self.driver.find_element(*CreateUsecaseLocators.SUMMARY_INPUT).text
153175

154176
def get_platform_url_value(self):
155177
return self.driver.find_element(*CreateUsecaseLocators.PLATFORM_URL_INPUT).get_attribute("value")

0 commit comments

Comments
 (0)