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>
25 lines
807 B
TypeScript
25 lines
807 B
TypeScript
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();
|
|
});
|
|
});
|