Files
GerbilManager/gerbil-manager-web/e2e/statistik.spec.ts

32 lines
1.5 KiB
TypeScript

/** QA-1: Statistik & Berichte (FEAT-7) — Auswertungen rendern. */
import { de, expect, gotoSection, skipUnlessMock, test } from './fixtures'
const t = de.pages.statistik
test('Statistikseite lädt (leer oder mit Daten, aber deutsch)', async ({ page }) => {
await gotoSection(page, de.nav.statistics)
await expect(page.getByRole('heading', { name: t.title })).toBeVisible()
// Live ohne Daten: leerer Zustand; sonst die Auswertungs-Karten
await expect(
page.getByText(t.empty).or(page.getByRole('heading', { name: t.littersPerYear })),
).toBeVisible()
})
test('alle fünf Auswertungen rendern mit den Seed-Daten', async ({ page }) => {
skipUnlessMock()
await gotoSection(page, de.nav.statistics)
await expect(page.getByRole('heading', { name: t.littersPerYear })).toBeVisible()
await expect(page.getByRole('heading', { name: t.avgLitterSize })).toBeVisible()
await expect(page.getByRole('heading', { name: t.farbschlag })).toBeVisible()
await expect(page.getByRole('heading', { name: t.population })).toBeVisible()
await expect(page.getByRole('heading', { name: t.losses })).toBeVisible()
// Diagramme: Balken (Würfe/Jahr), horizontale Farbschlag-Balken, Bestandskurve
await expect(page.locator('svg').first()).toBeVisible()
await expect(page.locator('.hbar').first()).toBeVisible()
await expect(page.locator('svg.line-chart')).toBeVisible()
// Farbschlag-Verteilung enthält Agouti (mehrere aktive Agouti-Tiere im Seed)
await expect(page.locator('.hbar__label', { hasText: 'Agouti' })).toBeVisible()
})