import AxeBuilder from '@axe-core/playwright'; import { expect, test } from '@playwright/test'; const enabled = Boolean(process.env.PULSE_E2E_REAL_BASE_URL); test('default dashboard and wallboard expose usable real sources', async ({ page }) => { test.skip(!enabled, 'Run against an isolated server smoke stack.'); test.setTimeout(90_000); expect((await page.request.get('/auth/test-login')).ok()).toBeTruthy(); const failures: string[] = []; page.on('pageerror', (error) => failures.push(error.message)); page.on('response', (response) => { const path = new URL(response.url()).pathname; if (path.startsWith('/api/') && response.status() >= 400) failures.push(`${response.status()} ${path}`); }); await page.goto('/dashboards/11111111-1111-4111-8111-111111111111'); await expect(page.getByRole('heading', { level: 1, name: 'Overzicht' })).toBeVisible(); await expect(page.locator('.widget-card--runtime')).toHaveCount(5); await expect(page.locator('.widget-placeholder')).toHaveCount(0); await expect.poll(() => failures, { timeout: 5_000 }).toEqual([]); await expect(page.locator('.metric-chart')).toBeVisible(); await expect(page.getByText('Disk 1').first()).toBeVisible(); await expect(page.getByText('pulse', { exact: true }).first()).toBeVisible(); await expect(page.getByText('Inventaris succesvol bijgewerkt')).toBeVisible(); await expect(page.locator('.widget-card--runtime[data-runtime-state="usable"]')).toHaveCount(5); expect(await page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth)).toBe(true); expect((await new AxeBuilder({ page }).analyze()).violations.filter((item) => item.impact === 'critical' || item.impact === 'serious')).toEqual([]); await page.goto('/wallboard?refresh=300&interval=300'); await expect(page.getByRole('heading', { name: 'Operationeel wallboard' })).toBeVisible(); await expect(page.locator('.wallboard-connection').filter({ hasText: 'Transport' })).toContainText('Verbonden'); await expect(page.locator('.wallboard-connection').filter({ hasText: 'Data' })).toContainText('Bruikbaar'); expect(await page.evaluate(() => document.documentElement.scrollHeight <= window.innerHeight + 1)).toBe(true); await expect(page.locator('.metric-chart')).toBeVisible(); await page.setViewportSize({ width: 390, height: 844 }); expect(await page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth)).toBe(true); expect((await new AxeBuilder({ page }).analyze()).violations.filter((item) => item.impact === 'critical' || item.impact === 'serious')).toEqual([]); expect(failures).toEqual([]); });