test: add E2E user journey test suite (pytest + Playwright skeleton)
- tests/test_user_journey.py: 23 pytest tests covering auth, search, settings, and download flows using TestClient with mocked providers (no real network calls) - tests/e2e/user_journey.spec.ts: 6 fixme Playwright test placeholders for full UI journey (register, login, browse, search, settings, logout)
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* User Journey E2E Tests
|
||||
*
|
||||
* Simulates a complete user flow: register → login → browse → search → settings → logout.
|
||||
* All tests are serial because they share browser state (auth token, navigation).
|
||||
*
|
||||
* FORBIDDEN: Do NOT use page.waitForTimeout() — use waitForResponse() or waitForSelector()
|
||||
*/
|
||||
|
||||
test.describe('User Journey E2E', () => {
|
||||
test.describe.configure({ mode: 'serial' });
|
||||
|
||||
test.fixme('should register a new user', async ({ page }) => {
|
||||
// TODO: Navigate to /web or /login
|
||||
// Switch to register tab (text=Inscription)
|
||||
// Fill #registerUsername with unique username
|
||||
// Fill #registerPassword and #registerPasswordConfirm
|
||||
// Click #registerSubmit
|
||||
// Wait for API response via waitForResponse(r => r.url().includes('/api/auth/register'))
|
||||
// Verify #authSuccess becomes visible or contains success message
|
||||
});
|
||||
|
||||
test.fixme('should login with registered credentials', async ({ page }) => {
|
||||
// TODO: Navigate to /login
|
||||
// Fill #loginUsername and #loginPassword
|
||||
// Click #loginSubmit
|
||||
// Wait for response via waitForResponse(r => r.url().includes('/api/auth/login'))
|
||||
// Verify redirect to /web or home page
|
||||
// Verify auth token is stored (check localStorage or cookie)
|
||||
});
|
||||
|
||||
test.fixme('should browse homepage without errors', async ({ page }) => {
|
||||
// TODO: Navigate to /web
|
||||
// Wait for page to load via waitForSelector for main content area
|
||||
// Verify no console errors
|
||||
// Verify page title or main heading is visible
|
||||
// Note: content may be empty in test env — just verify no crash
|
||||
});
|
||||
|
||||
test.fixme('should search for anime', async ({ page }) => {
|
||||
// TODO: Click on anime search tab (if tabs exist)
|
||||
// Fill #animeSearchInput with "Naruto"
|
||||
// Submit the search form (trigger HTMX request)
|
||||
// Wait for response via waitForResponse(r => r.url().includes('/api/anime/search'))
|
||||
// Verify search results appear or "no results" message shown
|
||||
// Verify results container has expected selectors
|
||||
});
|
||||
|
||||
test.fixme('should update settings', async ({ page }) => {
|
||||
// TODO: Click on settings tab or navigate to settings section
|
||||
// Wait for settings panel to load via waitForResponse(r => r.url().includes('/api/settings'))
|
||||
// Verify #default_lang dropdown exists
|
||||
// Change language setting (select different option)
|
||||
// Submit/save settings form
|
||||
// Wait for response via waitForResponse(r => r.url().includes('/api/settings') && r.request().method() === 'PATCH')
|
||||
// Verify success toast notification appears
|
||||
});
|
||||
|
||||
test.fixme('should logout successfully', async ({ page }) => {
|
||||
// TODO: Click logout button
|
||||
// Wait for response via waitForResponse(r => r.url().includes('/api/auth/logout'))
|
||||
// Verify redirect to login page or auth state is cleared
|
||||
// Verify protected content is no longer accessible
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user