Skip to content

Commit e4d314c

Browse files
Slachaider-chat-bot
andcommitted
fix: dismiss alerts both before and after navigation in UI tests
Co-authored-by: aider (anthropic/claude-opus-4-5-20251101) <aider@aider.chat>
1 parent 1d1be9c commit e4d314c

File tree

1 file changed

+10
-1
lines changed
  • tests/testflows/steps

1 file changed

+10
-1
lines changed

tests/testflows/steps/ui.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ def wait_for_element_to_be_clickable(
228228
if poll_frequency is None:
229229
poll_frequency = 1
230230

231+
# Dismiss any alert that might be blocking
232+
try:
233+
alert = driver.switch_to.alert
234+
alert.accept()
235+
except:
236+
pass
237+
231238
wait = WebDriverWait(driver, timeout, poll_frequency)
232239
wait.until(EC.element_to_be_clickable((select_type, element)))
233240

@@ -276,8 +283,10 @@ def open_endpoint(self, endpoint):
276283

277284
with By("saving coverage"):
278285
save_coverage()
279-
with By("dismissing any alert if present"):
286+
with By("dismissing any alert if present before navigation"):
280287
dismiss_alert_if_present()
281288
with By("opening endpoint"):
282289
driver = self.context.driver
283290
driver.get(endpoint)
291+
with By("dismissing any alert if present after navigation"):
292+
dismiss_alert_if_present()

0 commit comments

Comments
 (0)