feat(admin): E2E content/system mock-сьюты, row testids, IFT smoke. Refs EventHub/EventHubFrontAdmin#33 #37 #38 #39

This commit is contained in:
2026-07-14 22:44:22 +03:00
parent a3468518b3
commit 836e4a7eea
23 changed files with 831 additions and 223 deletions
+12 -19
View File
@@ -1,5 +1,7 @@
import type { Page, Route } from '@playwright/test';
import { createModerationSeed, type ModerationState } from './moderationSeed';
import { createContentSeed } from './contentSeed';
import { tryHandleContentApi } from './handleContentApi';
export type MockAdmin = {
id: string;
@@ -43,6 +45,7 @@ type MockOptions = {
export async function installAdminApiMocks(page: Page, options: MockOptions = {}) {
let currentUser: MockAdmin = { ...MOCK_ADMIN, ...options.user };
const moderation: ModerationState | null = options.moderation === false ? null : createModerationSeed();
const content = createContentSeed();
await page.route('**/v1/admin/**', async (route) => {
const req = route.request();
@@ -111,6 +114,12 @@ export async function installAdminApiMocks(page: Page, options: MockOptions = {}
}
if (method === 'GET' && path.includes('/v1/admin/nodes/metrics')) {
// Prefer content seed with sample node (monitoring)
if (
await tryHandleContentApi(route, method, path, url, content, json, () => req.postDataJSON())
) {
return;
}
await json(route, 200, { nodes: [] });
return;
}
@@ -267,26 +276,10 @@ export async function installAdminApiMocks(page: Page, options: MockOptions = {}
return;
}
}
}
// soft stubs for linked entities in inbox
if (method === 'GET' && /\/v1\/admin\/users\/[^/]+$/.test(path)) {
await json(route, 200, {
id: 'user-1',
email: 'user1@eventhub.local',
nickname: 'User One',
role: 'user',
status: 'active',
});
return;
}
if (method === 'GET' && /\/v1\/admin\/events\/[^/]+$/.test(path)) {
await json(route, 200, {
id: 'evt-1',
title: 'E2E Event',
status: 'active',
});
return;
}
if (await tryHandleContentApi(route, method, path, url, content, json, () => req.postDataJSON())) {
return;
}
if (method === 'GET') {