test(e2e): align web specs with current app routes
This commit is contained in:
@@ -1,24 +1,27 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { mockAuthenticatedUser } from './support/auth';
|
||||
|
||||
const mockModerationQueue = {
|
||||
data: [
|
||||
{
|
||||
id: 'mod-1', listingId: 'l1', title: 'Căn hộ cần duyệt', propertyType: 'APARTMENT',
|
||||
transactionType: 'SALE', price: 5000000000, sellerName: 'Nguyen Van A',
|
||||
aiModerationScore: 85, submittedAt: '2026-03-01T00:00:00Z', status: 'PENDING',
|
||||
listingId: 'l1', propertyTitle: 'Căn hộ cần duyệt', propertyType: 'APARTMENT',
|
||||
transactionType: 'SALE', priceVND: 5000000000, sellerName: 'Nguyen Van A',
|
||||
moderationScore: 85, createdAt: '2026-03-01T00:00:00Z',
|
||||
},
|
||||
{
|
||||
id: 'mod-2', listingId: 'l2', title: 'Nhà phố cần duyệt', propertyType: 'HOUSE',
|
||||
transactionType: 'RENT', price: 15000000, sellerName: 'Tran Thi B',
|
||||
aiModerationScore: 42, submittedAt: '2026-03-02T00:00:00Z', status: 'PENDING',
|
||||
listingId: 'l2', propertyTitle: 'Nhà phố cần duyệt', propertyType: 'HOUSE',
|
||||
transactionType: 'RENT', priceVND: 15000000, sellerName: 'Tran Thi B',
|
||||
moderationScore: 42, createdAt: '2026-03-02T00:00:00Z',
|
||||
},
|
||||
],
|
||||
total: 2, page: 1, limit: 20, totalPages: 1,
|
||||
};
|
||||
|
||||
test.describe('Admin Moderation Page', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.route('**/admin/moderation**', (route) => {
|
||||
test.beforeEach(async ({ page, context, baseURL }) => {
|
||||
await mockAuthenticatedUser(page, context, baseURL, { role: 'ADMIN' });
|
||||
|
||||
await page.route('**/api/v1/admin/moderation**', (route) => {
|
||||
if (route.request().method() === 'GET') {
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
@@ -60,7 +63,7 @@ test.describe('Admin Moderation Page', () => {
|
||||
});
|
||||
|
||||
test('handles empty moderation queue', async ({ page }) => {
|
||||
await page.route('**/admin/moderation**', (route) =>
|
||||
await page.route('**/api/v1/admin/moderation**', (route) =>
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user