import pytest
|
|
|
|
BASE_URL = "http://127.0.0.1:8080"
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_user_logout(page):
|
|
# Login first
|
|
await page.goto(f"{BASE_URL}/login")
|
|
await page.fill("#email", "testuser@example.com")
|
|
await page.fill("#password", "password123")
|
|
await page.click("button[type=submit]")
|
|
await page.wait_for_url("**/dashboard")
|
|
|
|
# Logout
|
|
await page.click("text=Logout")
|
|
await page.wait_for_url("**/")
|
|
assert page.url == f"{BASE_URL}/" or page.url.endswith("/") |