Files
ITWorx-Pulse-Public/apps/web/tests/e2e/capacity-real.spec.ts
T
ITWorx Pulse release export bd774932d5
Public source validation / validate (push) Failing after 3m8s
Publish ITWorx Pulse source
2026-09-03 02:09:19 +02:00

27 lines
1.6 KiB
TypeScript

import AxeBuilder from '@axe-core/playwright';
import { expect, test } from '@playwright/test';
const enabled = Boolean(process.env.PULSE_E2E_REAL_BASE_URL);
test('persisted capacity history produces one qualified explainable forecast', async ({ page }) => {
test.skip(!enabled, 'Requires an isolated real Pulse stack.');
expect((await page.request.get('/auth/test-login')).ok()).toBeTruthy();
const response = await page.request.get('/api/v1/forecasts');
expect(response.ok()).toBeTruthy();
const snapshot = await response.json() as { qualifiedCount: number; items: Array<{ entityId: string; dataPoints: number; confidence: string; projectedAt?: string }> };
expect(snapshot.qualifiedCount).toBe(1);
expect(snapshot.items[0]).toMatchObject({ dataPoints: 3, confidence: 'medium' });
expect(snapshot.items[0].projectedAt).toBeTruthy();
await page.goto('/capacity');
await expect(page.getByText(/1 gekwalificeerde prognoses/)).toBeVisible();
await expect(page.getByRole('heading', { name: 'Media forecast' })).toBeVisible();
await expect(page.getByText('Mediane dagelijkse groei', { exact: true })).toBeVisible();
await expect(page.getByText('Gemiddelde betrouwbaarheid')).toBeVisible();
await expect(page.getByText('42 dagen', { exact: false })).toBeVisible();
await expect(page.getByText('0 B / 0 B')).toHaveCount(0);
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth + 1)).toBe(true);
const axe = await new AxeBuilder({ page }).analyze();
expect(axe.violations.filter((item) => item.impact === 'serious' || item.impact === 'critical')).toEqual([]);
});