Skip to content

Commit 1d1be9c

Browse files
Slachaider-chat-bot
andcommitted
fix: dismiss browser alerts before navigating between endpoints
Co-authored-by: aider (anthropic/claude-opus-4-5-20251101) <aider@aider.chat>
1 parent c4d6add commit 1d1be9c

File tree

1 file changed

+13
-0
lines changed
  • tests/testflows/steps

1 file changed

+13
-0
lines changed

tests/testflows/steps/ui.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,25 @@ def save_coverage(self):
259259
file.write(coverage_info)
260260
file.close()
261261

262+
@TestStep(When)
263+
def dismiss_alert_if_present(self):
264+
"""Dismiss any alert that might be present."""
265+
driver = self.context.driver
266+
try:
267+
alert = driver.switch_to.alert
268+
alert.accept()
269+
except:
270+
pass
271+
272+
262273
@TestStep(When)
263274
def open_endpoint(self, endpoint):
264275
"""Open the given endpoint."""
265276

266277
with By("saving coverage"):
267278
save_coverage()
279+
with By("dismissing any alert if present"):
280+
dismiss_alert_if_present()
268281
with By("opening endpoint"):
269282
driver = self.context.driver
270283
driver.get(endpoint)

0 commit comments

Comments
 (0)