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>
This commit is contained in:
184
docs/testing/h5p-service-tests.md
Normal file
184
docs/testing/h5p-service-tests.md
Normal file
@@ -0,0 +1,184 @@
|
||||
# H5P Service Tests
|
||||
|
||||
## Übersicht
|
||||
|
||||
Das H5P Service Modul verfügt über umfassende Integration Tests, die alle Endpoints und Content-Typen validieren.
|
||||
|
||||
## Test-Coverage
|
||||
|
||||
### Module
|
||||
- **Server Endpoints**: Health, Info, Editor Selection
|
||||
- **8 Content Type Editors**: Quiz, Video, Presentation, Flashcards, Timeline, Drag & Drop, Fill Blanks, Memory
|
||||
- **8 Content Type Players**: Interaktive Player für alle Content-Typen
|
||||
- **Static Files**: Korrekte Bereitstellung von Editoren, Players und Assets
|
||||
- **Error Handling**: 404-Behandlung für ungültige Routen
|
||||
|
||||
## Tests ausführen
|
||||
|
||||
### Lokal
|
||||
|
||||
```bash
|
||||
cd h5p-service
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
|
||||
### Im Docker Container
|
||||
|
||||
```bash
|
||||
# Service starten
|
||||
docker compose -f docker-compose.content.yml up -d h5p-service
|
||||
|
||||
# Tests ausführen
|
||||
docker compose -f docker-compose.content.yml exec h5p-service npm test
|
||||
```
|
||||
|
||||
## Test-Dateien
|
||||
|
||||
| Datei | Beschreibung |
|
||||
|-------|--------------|
|
||||
| `h5p-service/tests/server.test.js` | Integration Tests für alle Endpoints |
|
||||
| `h5p-service/tests/setup.js` | Jest Test Setup & Configuration |
|
||||
| `h5p-service/jest.config.js` | Jest Configuration |
|
||||
|
||||
## Coverage Reports
|
||||
|
||||
Nach dem Ausführen der Tests:
|
||||
|
||||
```bash
|
||||
# HTML Report öffnen
|
||||
open h5p-service/coverage/lcov-report/index.html
|
||||
```
|
||||
|
||||
Coverage-Ziel: **>80%**
|
||||
|
||||
## Test-Kategorien
|
||||
|
||||
### 1. Health & Info Tests
|
||||
- Service-Verfügbarkeit
|
||||
- Health Check Endpoint
|
||||
- Service Info Page
|
||||
|
||||
### 2. Editor Selection Tests
|
||||
- Alle 8 Content-Typen sichtbar
|
||||
- Korrekte Links zu Editoren
|
||||
- UI-Elemente vorhanden
|
||||
|
||||
### 3. Content Type Tests
|
||||
|
||||
Für jeden der 8 Content-Typen:
|
||||
- Editor lädt korrekt
|
||||
- Player lädt korrekt
|
||||
- Erforderliche UI-Elemente vorhanden
|
||||
|
||||
**Content-Typen:**
|
||||
1. Quiz (Question Set)
|
||||
2. Interactive Video
|
||||
3. Course Presentation
|
||||
4. Flashcards
|
||||
5. Timeline
|
||||
6. Drag and Drop
|
||||
7. Fill in the Blanks
|
||||
8. Memory Game
|
||||
|
||||
### 4. Static File Tests
|
||||
- Core Files erreichbar
|
||||
- Editor Files erreichbar
|
||||
- Player Files erreichbar
|
||||
|
||||
### 5. Error Handling Tests
|
||||
- 404 für ungültige Routes
|
||||
- Fehlerbehandlung für fehlende Editoren/Players
|
||||
|
||||
## CI/CD Integration
|
||||
|
||||
Die Tests sind in die CI/CD Pipeline integriert:
|
||||
|
||||
```yaml
|
||||
# .github/workflows/tests.yml (Beispiel)
|
||||
name: H5P Service Tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Start H5P Service
|
||||
run: docker compose -f docker-compose.content.yml up -d h5p-service
|
||||
|
||||
- name: Wait for Service
|
||||
run: sleep 10
|
||||
|
||||
- name: Run Tests
|
||||
run: docker compose -f docker-compose.content.yml exec h5p-service npm run test:ci
|
||||
|
||||
- name: Upload Coverage
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
files: ./h5p-service/coverage/lcov.info
|
||||
```
|
||||
|
||||
## Test-Qualität
|
||||
|
||||
### Best Practices
|
||||
|
||||
1. **Isolation**: Jeder Test ist unabhängig
|
||||
2. **Cleanup**: Keine persistenten Änderungen
|
||||
3. **Assertions**: Klare Expectations
|
||||
4. **Speed**: Tests laufen schnell (<10s gesamt)
|
||||
5. **Reliability**: Tests sind deterministisch
|
||||
|
||||
### Code Review Checklist
|
||||
|
||||
Bei neuen Features:
|
||||
- [ ] Tests für neue Endpoints hinzugefügt
|
||||
- [ ] Coverage bleibt >80%
|
||||
- [ ] Tests sind dokumentiert
|
||||
- [ ] CI/CD Tests bestehen
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Tests schlagen fehl
|
||||
|
||||
**Service nicht erreichbar:**
|
||||
```bash
|
||||
# Service Status prüfen
|
||||
docker compose -f docker-compose.content.yml ps
|
||||
|
||||
# Logs ansehen
|
||||
docker compose -f docker-compose.content.yml logs h5p-service
|
||||
```
|
||||
|
||||
**Port-Konflikte:**
|
||||
```bash
|
||||
# Prüfe, ob Port 8003 belegt ist
|
||||
lsof -i :8003
|
||||
|
||||
# Stoppe andere Services
|
||||
docker compose -f docker-compose.content.yml down
|
||||
```
|
||||
|
||||
**Veraltete Dependencies:**
|
||||
```bash
|
||||
cd h5p-service
|
||||
rm -rf node_modules package-lock.json
|
||||
npm install
|
||||
```
|
||||
|
||||
## Zukünftige Erweiterungen
|
||||
|
||||
- [ ] E2E Tests mit Playwright
|
||||
- [ ] Content Validation Tests
|
||||
- [ ] Performance Tests
|
||||
- [ ] Security Tests (XSS, CSRF)
|
||||
- [ ] Load Tests
|
||||
- [ ] Visual Regression Tests
|
||||
|
||||
## Verwandte Dokumentation
|
||||
|
||||
- [H5P Service README](../../h5p-service/tests/README.md)
|
||||
- [Content Service Tests](./content-service-tests.md)
|
||||
- [Integration Testing Guide](./integration-testing.md)
|
||||
Reference in New Issue
Block a user