Playwright logout test: dialog handler + wait_for_url for async flow

This commit is contained in:
2026-05-05 09:24:59 +02:00
parent e07292ba44
commit a20230187f
11 changed files with 72 additions and 1 deletions
+6 -1
View File
@@ -120,6 +120,8 @@ def test_desktop(pw):
# 5. Logout
try:
# Register confirm() handler — auto-accept
page.on('dialog', lambda d: d.accept())
# Click the logout button (⎋ icon)
# Find a visible logout element across all known selectors
logout_btn = None
@@ -139,7 +141,10 @@ def test_desktop(pw):
}""")
if res:
print(f' [debug] logout invoked via JS: {res}')
time.sleep(2)
# Wait for async logout (POST /auth/logout + clear + redirect)
try: page.wait_for_url('**/login**', timeout=10000)
except: pass
time.sleep(1)
logout_btn = 'js' # sentinel
if logout_btn is not None:
if hasattr(logout_btn, 'click'):