This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
breakpilot-pwa/studio-v2/e2e/korrektur.spec.ts
Benjamin Admin 21a844cb8a fix: Restore all files lost during destructive rebase
A previous `git pull --rebase origin main` dropped 177 local commits,
losing 3400+ files across admin-v2, backend, studio-v2, website,
klausur-service, and many other services. The partial restore attempt
(660295e2) only recovered some files.

This commit restores all missing files from pre-rebase ref 98933f5e
while preserving post-rebase additions (night-scheduler, night-mode UI,
NightModeWidget dashboard integration).

Restored features include:
- AI Module Sidebar (FAB), OCR Labeling, OCR Compare
- GPU Dashboard, RAG Pipeline, Magic Help
- Klausur-Korrektur (8 files), Abitur-Archiv (5+ files)
- Companion, Zeugnisse-Crawler, Screen Flow
- Full backend, studio-v2, website, klausur-service
- All compliance SDKs, agent-core, voice-service
- CI/CD configs, documentation, scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:51:32 +01:00

231 lines
7.8 KiB
TypeScript

import { test, expect } from '@playwright/test'
/**
* E2E Tests for /korrektur
*
* Tests the Korrekturplattform main page:
* - Page loads correctly
* - Stats cards are displayed
* - Klausur cards work
* - Quick actions work
* - Modals work
*/
test.describe('Korrektur Hauptseite', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/korrektur')
await page.waitForLoadState('networkidle')
})
// ==========================================================================
// PAGE LOAD TESTS
// ==========================================================================
test('page loads with correct title', async ({ page }) => {
await expect(page.getByRole('heading', { name: 'Korrekturplattform' })).toBeVisible()
})
test('page shows subtitle', async ({ page }) => {
await expect(page.getByText('KI-gestuetzte Abiturklausur-Korrektur')).toBeVisible()
})
// ==========================================================================
// STATS CARDS TESTS
// ==========================================================================
test('stats cards are displayed', async ({ page }) => {
await page.waitForTimeout(500)
// Check for stat labels
await expect(page.getByText('Offene Korrekturen')).toBeVisible()
await expect(page.getByText('Erledigt (Woche)')).toBeVisible()
await expect(page.getByText('Durchschnitt')).toBeVisible()
await expect(page.getByText('Zeit gespart')).toBeVisible()
})
// ==========================================================================
// KLAUSUREN SECTION TESTS
// ==========================================================================
test('Klausuren section header is visible', async ({ page }) => {
await page.waitForTimeout(500)
await expect(page.getByRole('heading', { name: 'Klausuren' })).toBeVisible()
})
test('Neue Klausur card is visible', async ({ page }) => {
await page.waitForTimeout(600)
await expect(page.getByText('Neue Klausur')).toBeVisible()
})
test('clicking Neue Klausur opens modal', async ({ page }) => {
await page.waitForTimeout(600)
// Click on Neue Klausur card
await page.getByText('Neue Klausur').click()
// Modal should open
await expect(page.getByText('Neue Klausur erstellen')).toBeVisible()
})
// ==========================================================================
// CREATE KLAUSUR MODAL TESTS
// ==========================================================================
test('create modal has required fields', async ({ page }) => {
await page.waitForTimeout(600)
// Open modal
await page.getByText('Neue Klausur').click()
// Check for form fields
await expect(page.getByLabel('Titel')).toBeVisible()
await expect(page.getByLabel('Fach')).toBeVisible()
await expect(page.getByLabel('Jahr')).toBeVisible()
await expect(page.getByLabel('Semester')).toBeVisible()
await expect(page.getByLabel('Modus')).toBeVisible()
})
test('create modal has submit button', async ({ page }) => {
await page.waitForTimeout(600)
// Open modal
await page.getByText('Neue Klausur').click()
await expect(page.getByRole('button', { name: 'Erstellen' })).toBeVisible()
})
test('create modal cancel closes modal', async ({ page }) => {
await page.waitForTimeout(600)
// Open modal
await page.getByText('Neue Klausur').click()
await expect(page.getByText('Neue Klausur erstellen')).toBeVisible()
// Cancel
await page.getByRole('button', { name: 'Abbrechen' }).click()
// Modal should be closed
await expect(page.getByText('Neue Klausur erstellen')).not.toBeVisible()
})
// ==========================================================================
// QUICK ACTIONS TESTS
// ==========================================================================
test('Schnellaktionen section is visible', async ({ page }) => {
await page.waitForTimeout(700)
await expect(page.getByRole('heading', { name: 'Schnellaktionen' })).toBeVisible()
})
test('QR Upload quick action is visible', async ({ page }) => {
await page.waitForTimeout(800)
await expect(page.getByText('QR Upload')).toBeVisible()
})
test('Direkt hochladen quick action is visible', async ({ page }) => {
await page.waitForTimeout(800)
await expect(page.getByText('Direkt hochladen')).toBeVisible()
})
test('Schnellstart quick action is visible', async ({ page }) => {
await page.waitForTimeout(800)
await expect(page.getByText('Schnellstart')).toBeVisible()
})
test('EH hochladen quick action is visible', async ({ page }) => {
await page.waitForTimeout(900)
await expect(page.getByText('EH hochladen')).toBeVisible()
})
test('Abitur-Archiv quick action is visible', async ({ page }) => {
await page.waitForTimeout(900)
await expect(page.getByText('Abitur-Archiv')).toBeVisible()
})
test('clicking Abitur-Archiv navigates to archiv', async ({ page }) => {
await page.waitForTimeout(900)
// Click on Abitur-Archiv
await page.getByText('Abitur-Archiv').click()
// Should navigate to archiv
await expect(page).toHaveURL(/\/korrektur\/archiv/)
})
// ==========================================================================
// DIRECT UPLOAD MODAL TESTS
// ==========================================================================
test('clicking Direkt hochladen opens upload modal', async ({ page }) => {
await page.waitForTimeout(800)
await page.getByText('Direkt hochladen').click()
// Modal should show - use heading selector to avoid matching button
await expect(page.getByRole('heading', { name: 'Arbeiten hochladen' })).toBeVisible()
})
test('upload modal has drag drop zone', async ({ page }) => {
await page.waitForTimeout(800)
await page.getByText('Direkt hochladen').click()
await expect(page.getByText('Dateien hierher ziehen')).toBeVisible()
})
test('upload modal cancel closes modal', async ({ page }) => {
await page.waitForTimeout(800)
await page.getByText('Direkt hochladen').click()
await expect(page.getByRole('heading', { name: 'Arbeiten hochladen' })).toBeVisible()
await page.getByRole('button', { name: 'Abbrechen' }).click()
await expect(page.getByRole('heading', { name: 'Arbeiten hochladen' })).not.toBeVisible()
})
// ==========================================================================
// EH UPLOAD MODAL TESTS
// ==========================================================================
test('clicking EH hochladen opens EH modal', async ({ page }) => {
await page.waitForTimeout(900)
await page.getByText('EH hochladen').click()
await expect(page.getByText('Erwartungshorizont hochladen')).toBeVisible()
})
test('EH modal has file drop zone', async ({ page }) => {
await page.waitForTimeout(900)
await page.getByText('EH hochladen').click()
await expect(page.getByText('EH-Datei hierher ziehen')).toBeVisible()
})
// ==========================================================================
// THEME TOGGLE TESTS
// ==========================================================================
test('theme toggle is visible', async ({ page }) => {
// Theme toggle should be in header
const themeToggle = page.locator('[class*="ThemeToggle"], button').filter({ has: page.locator('svg') }).first()
await expect(themeToggle).toBeVisible()
})
// ==========================================================================
// SIDEBAR TESTS
// ==========================================================================
test('sidebar is visible', async ({ page }) => {
// Sidebar should be present
const sidebar = page.locator('aside')
await expect(sidebar).toBeVisible()
})
test('sidebar has BreakPilot logo', async ({ page }) => {
await expect(page.getByText('BreakPilot')).toBeVisible()
})
})