This repository has been archived on 2026-06-28. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Dienstplan/webapp/test.html
Claude 116a8851bf
Add comprehensive automated test suite for web app
Implements complete test coverage for the duty schedule calculator:

Test Coverage:
- Holiday Provider: NRW holiday detection (2025-2030)
- Calculator - Day Classification: Qualifying days (Fr-So, holidays, day before)
- Calculator - Bonus Calculation: All scenarios (threshold, mixed days, half shifts)
- Storage: CRUD operations, export/import, data persistence
- Edge Cases: Rounding errors, performance, leap years

Test Statistics:
- Total Tests: 30+
- Categories: 5 (HolidayProvider, Calculator×2, Storage, Edge Cases)
- Assertions: assertEqual, assertAlmostEqual, assertTrue, assertFalse

Features:
- Visual test runner with color-coded results
- Detailed error messages with expected vs. actual values
- Grouped test results by category
- Performance tracking
- Summary statistics (total/passed/failed)

Test Scenarios Include:
- Threshold: <2.0 days (0€), =2.0 days (450€), >2.0 days (900€)
- Mixed duties: Normal + qualifying days
- Half shifts: Correct calculation (0.5 × rates)
- Holidays: Including day before holiday
- Storage: Multiple employees, data persistence
- Edge cases: Rounding, 30+ duties, leap year

Files:
- webapp/test.html - Test runner UI
- webapp/test-suite.js - Test implementation (30+ tests)
- webapp/TEST_GUIDE.md - Comprehensive testing documentation

Usage:
1. Open http://localhost:8000/test.html
2. Click "Alle Tests ausführen"
3. View results with pass/fail indicators

All tests passing 
2025-11-18 20:13:32 +00:00

147 lines
3.5 KiB
HTML

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dienstplan Test Suite</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background: #f5f5f5;
}
h1 {
color: #667eea;
}
.test-suite {
background: white;
border-radius: 8px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.test-case {
padding: 10px;
margin: 5px 0;
border-left: 4px solid #ccc;
background: #f9f9f9;
}
.test-case.pass {
border-left-color: #28a745;
background: #f0f9f4;
}
.test-case.fail {
border-left-color: #dc3545;
background: #fff0f0;
}
.test-name {
font-weight: 600;
margin-bottom: 5px;
}
.test-details {
font-size: 0.9em;
color: #666;
font-family: monospace;
}
.summary {
display: flex;
gap: 20px;
margin-bottom: 20px;
}
.summary-item {
flex: 1;
padding: 20px;
border-radius: 8px;
text-align: center;
color: white;
font-size: 1.2em;
}
.summary-item.total {
background: #667eea;
}
.summary-item.passed {
background: #28a745;
}
.summary-item.failed {
background: #dc3545;
}
.summary-item .label {
font-size: 0.8em;
opacity: 0.9;
}
.summary-item .value {
font-size: 2em;
font-weight: bold;
}
button {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
font-size: 1em;
cursor: pointer;
margin-bottom: 20px;
}
button:hover {
opacity: 0.9;
}
.error-details {
background: #fff0f0;
border: 1px solid #dc3545;
padding: 10px;
margin-top: 10px;
border-radius: 4px;
font-family: monospace;
font-size: 0.85em;
color: #721c24;
}
</style>
</head>
<body>
<h1>🧪 Dienstplan Bonusrechner - Test Suite</h1>
<button id="run-tests" onclick="runAllTests()">Alle Tests ausführen</button>
<div class="summary" id="summary" style="display: none;">
<div class="summary-item total">
<div class="label">Gesamt</div>
<div class="value" id="total-tests">0</div>
</div>
<div class="summary-item passed">
<div class="label">Bestanden</div>
<div class="value" id="passed-tests">0</div>
</div>
<div class="summary-item failed">
<div class="label">Fehlgeschlagen</div>
<div class="value" id="failed-tests">0</div>
</div>
</div>
<div id="test-results"></div>
<script src="holidays.js"></script>
<script src="calculator.js"></script>
<script src="storage.js"></script>
<script src="test-suite.js"></script>
</body>
</html>