test(e2e): align web specs with current app routes

This commit is contained in:
Ho Ngoc Hai
2026-05-04 20:11:09 +07:00
parent f112045826
commit 39156fc107
21 changed files with 334 additions and 458 deletions

View File

@@ -1,17 +1,18 @@
import { test, expect } from '@playwright/test';
import { mockAuthenticatedUser } from './support/auth';
const mockKycQueue = {
data: [
{
id: 'kyc-1', userId: 'u1', fullName: 'Nguyen Van A', phone: '0912345678',
userId: 'u1', fullName: 'Nguyen Van A', phone: '0912345678',
email: 'a@test.com', role: 'AGENT', kycStatus: 'PENDING',
submittedAt: '2026-03-01T00:00:00Z',
createdAt: '2026-03-01T00:00:00Z',
kycData: { idType: 'CCCD', idNumber: '123456789012', frontImageUrl: '/id-front.jpg', backImageUrl: '/id-back.jpg', selfieUrl: '/selfie.jpg' },
},
{
id: 'kyc-2', userId: 'u2', fullName: 'Tran Thi B', phone: '0987654321',
userId: 'u2', fullName: 'Tran Thi B', phone: '0987654321',
email: null, role: 'AGENT', kycStatus: 'PENDING',
submittedAt: '2026-03-02T00:00:00Z',
createdAt: '2026-03-02T00:00:00Z',
kycData: { idType: 'PASSPORT', idNumber: 'B1234567' },
},
],
@@ -19,8 +20,10 @@ const mockKycQueue = {
};
test.describe('Admin KYC Page', () => {
test.beforeEach(async ({ page }) => {
await page.route('**/admin/kyc**', (route) => {
test.beforeEach(async ({ page, context, baseURL }) => {
await mockAuthenticatedUser(page, context, baseURL, { role: 'ADMIN' });
await page.route('**/api/v1/admin/kyc**', (route) => {
if (route.request().method() === 'GET') {
return route.fulfill({
status: 200,
@@ -56,7 +59,7 @@ test.describe('Admin KYC Page', () => {
});
test('handles empty KYC queue', async ({ page }) => {
await page.route('**/admin/kyc**', (route) =>
await page.route('**/api/v1/admin/kyc**', (route) =>
route.fulfill({
status: 200,
contentType: 'application/json',