dak.c2s/frontend/e2e/dashboard.spec.ts
CCS Admin 77805191cf test: add Playwright E2E tests (auth, dashboard, cases, admin)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:44:25 +00:00

45 lines
1.7 KiB
TypeScript

import { test, expect } from '@playwright/test'
test.describe('Dashboard', () => {
test.beforeEach(async ({ page }) => {
// Log in before each test
await page.goto('/login')
await page.getByLabel('E-Mail').fill('admin@dak-portal.de')
await page.getByLabel('Passwort').fill('admin123')
await page.getByRole('button', { name: 'Anmelden' }).click()
await expect(page).toHaveURL(/\/dashboard/)
})
test('KPI cards are visible after login', async ({ page }) => {
// All four KPI cards should be displayed
await expect(page.getByText('Fälle gesamt')).toBeVisible()
await expect(page.getByText('Offene ICD')).toBeVisible()
await expect(page.getByText('Offene Codierung')).toBeVisible()
await expect(page.getByText('Gutachten gesamt')).toBeVisible()
})
test('year selector exists and can be changed', async ({ page }) => {
// The year selector trigger should be visible
const yearSelector = page.locator('button').filter({ hasText: /^\d{4}$/ })
await expect(yearSelector).toBeVisible()
// Click it to open the dropdown
await yearSelector.click()
// Previous years should be available in the dropdown
const currentYear = new Date().getFullYear()
const previousYear = currentYear - 1
await expect(page.getByRole('option', { name: String(previousYear) })).toBeVisible()
// Select the previous year
await page.getByRole('option', { name: String(previousYear) }).click()
})
test('Fallgruppen chart section is visible', async ({ page }) => {
await expect(page.getByText('Fallgruppen')).toBeVisible()
})
test('weekly chart section is visible', async ({ page }) => {
await expect(page.getByText('Wöchentliche Übersicht')).toBeVisible()
})
})