import { expect, test } from '@playwright/test' test('Startseite liefert Titel und Systemzustand', async ({ page }) => { await page.goto('/') await expect(page.getByRole('heading', { level: 1 })).toHaveText('AfiS-Aktensystem') await expect(page.getByRole('heading', { name: 'Systemzustand' })).toBeVisible() await expect(page.getByRole('cell', { name: 'Datenbank' })).toBeVisible() }) test('Gesundheitsendpunkt antwortet mit allen drei Abhaengigkeiten', async ({ request }) => { const response = await request.get('/api/health') expect([200, 503]).toContain(response.status()) const body = await response.json() expect(Object.keys(body.components).sort()).toEqual(['clamav', 'database', 'discordGateway']) }) test('Antwort traegt eine strikte Inhaltsrichtlinie', async ({ page }) => { const response = await page.goto('/') const csp = response?.headers()['content-security-policy'] ?? '' expect(csp).toContain("object-src 'none'") expect(csp).toContain("frame-ancestors 'none'") expect(csp).toMatch(/script-src [^;]*'nonce-/) expect(csp).not.toMatch(/script-src [^;]*'unsafe-inline'/) })