Playwright logout test: dialog handler + wait_for_url for async flow
This commit is contained in:
@@ -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'):
|
||||
|
||||
Reference in New Issue
Block a user