Files
goodgo-platform/e2e/api/auth-refresh.spec.ts
Ho Ngoc Hai 9301f44119 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>
2026-04-08 01:41:07 +07:00

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();
});
});