test(e2e): verify login establishes a working API session

Guards against regressions where the session cookie is set but
the backend rejects it — a URL redirect alone is not enough.

Refs #48
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-22 19:59:27 +01:00
parent 2a46136f61
commit ea6b727e44

View File

@@ -48,6 +48,15 @@ test.describe('Authentication', () => {
await page.screenshot({ path: 'test-results/e2e/login-success.png' });
});
test('login establishes a session that authenticates API calls', async ({ page }) => {
// Guards against regressions where the session cookie is set but broken —
// a working URL redirect is not enough evidence that auth works end-to-end.
await login(page);
const response = await page.request.get('/api/users/me');
expect(response.ok()).toBe(true);
await page.screenshot({ path: 'test-results/e2e/auth-session-valid.png' });
});
test('logout clears the session and redirects to /login', async ({ page }) => {
await login(page);
// Logout is inside the user avatar dropdown — open it first