feat(e2e): add Playwright E2E testing infrastructure and critical path tests
Set up Playwright with dual-project config (API + Web), auth test fixtures, 16 E2E tests covering registration, login, profile, token refresh, and homepage rendering. Added GitHub Actions CI workflow for automated E2E runs. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
24
e2e/api/auth-refresh.spec.ts
Normal file
24
e2e/api/auth-refresh.spec.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { test, expect } from '../fixtures';
|
||||
|
||||
test.describe('POST /auth/refresh', () => {
|
||||
test('refreshes tokens with valid refresh token', async ({ request, testTokens }) => {
|
||||
const res = await request.post('/auth/refresh', {
|
||||
data: { refreshToken: testTokens.refreshToken },
|
||||
});
|
||||
|
||||
expect(res.status()).toBe(201);
|
||||
const body = await res.json();
|
||||
expect(body).toHaveProperty('accessToken');
|
||||
expect(body).toHaveProperty('refreshToken');
|
||||
// New tokens should differ from original
|
||||
expect(body.accessToken).not.toBe(testTokens.accessToken);
|
||||
});
|
||||
|
||||
test('rejects invalid refresh token', async ({ request }) => {
|
||||
const res = await request.post('/auth/refresh', {
|
||||
data: { refreshToken: 'invalid-refresh-token' },
|
||||
});
|
||||
|
||||
expect(res.ok()).toBeFalsy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user