Spaces:
Running
Running
| """ | |
| Auth teardown tests — verify logout works. | |
| This file is named with 'z_' prefix so it runs LAST alphabetically. | |
| These tests navigate to /logout which invalidates the shared test session, | |
| so they must not run before any test that depends on auth_context. | |
| Run with: pytest tests/e2e_z_auth.py -v | |
| """ | |
| import pytest | |
| from playwright.sync_api import Page, Browser, expect | |
| from tests.conftest import login, BASE_URL | |
| class TestLogout: | |
| def test_sign_out_logs_out(self, browser: Browser): | |
| """Navigating to /logout clears the session and shows the login page.""" | |
| # Use a dedicated fresh context so the shared auth_context is not affected. | |
| ctx = browser.new_context(viewport={"width": 1280, "height": 900}) | |
| page = ctx.new_page() | |
| login(page) | |
| page.goto(f"{BASE_URL}/logout", timeout=30000) | |
| expect(page.locator('button:has-text("Login")')).to_be_visible(timeout=15000) | |
| ctx.close() | |