Добавить auto-capture ошибок и фильтр source у тикетов. Refs EventHub/EventHubBack#35
CI / test (push) Successful in 5m53s
CI / push-image (push) Successful in 10m1s
CI / ci-done (push) Successful in 0s
CI / deploy-ift (push) Successful in 47s
CI / e2e-ift (push) Successful in 2m49s
CI / deploy-stage (push) Successful in 7m58s
CI / e2e-stage (push) Successful in 1m20s

This commit is contained in:
2026-07-17 00:44:13 +03:00
parent b2cd4b53fc
commit b39a676e1a
10 changed files with 296 additions and 16 deletions
+48
View File
@@ -0,0 +1,48 @@
import { test, expect } from '@playwright/test';
import { seedAuthenticatedSession } from '../helpers/session';
/**
* Авто-capture фронтовых ошибок Admin SPA → POST /v1/tickets (source=frontend).
* Ручной «сообщить о проблеме» — клиентский сценарий, не UI Control Center.
*/
test.describe('frontend error auto-report (mock)', () => {
test('reportClientError шлёт POST /v1/tickets с source=frontend', async ({ page }) => {
await seedAuthenticatedSession(page);
let reported: { error_message?: string; source?: string } | null = null;
await page.route('**/v1/tickets', async (route) => {
if (route.request().method() === 'POST') {
reported = route.request().postDataJSON() as typeof reported;
await route.fulfill({
status: 201,
contentType: 'application/json',
body: JSON.stringify({
id: 't-fe-1',
source: 'frontend',
status: 'open',
count: 1,
error_hash: 'abc',
error_message: reported?.error_message ?? 'err',
}),
});
return;
}
await route.continue();
});
await page.goto('/dashboard');
await expect(page.getByTestId('layout-shell')).toBeVisible();
await page.waitForFunction(() => typeof window.__ehReportClientError === 'function');
await page.evaluate(async () => {
await window.__ehReportClientError!({
message: 'e2e-frontend-auto-report',
stack: 'Error: e2e-frontend-auto-report\n at e2e:1:1',
source: 'frontend',
});
});
await expect.poll(() => reported?.source, { timeout: 10_000 }).toBe('frontend');
expect(reported?.error_message).toContain('e2e-frontend-auto-report');
});
});