# Manual Testing Guide - Arbeitslosengeld Rechner

**Purpose:** Step-by-step guide for manual testing of the Arbeitslosengeld Rechner tool page.

## Prerequisites

- Access to http://localhost:8003/tools/arbeitslosengeld-rechner
- Browser DevTools open (F12)
- Console tab visible

## Test Scenarios

### Scenario 1: Basic Calculation - Netto, No Children

**Steps:**

1. Navigate to http://localhost:8003/tools/arbeitslosengeld-rechner
2. Select "Netto" radio button (should be selected by default)
3. Enter "2000" in "Einkommen (€/Monat)" field
4. Enter "35" in "Alter" field
5. Ensure "Kinder vorhanden" toggle is OFF
6. Wait 300ms for debounced calculation

**Expected Results:**

- Results section appears below form
- ALG 1 Amount: **1.200,00 €**
- Duration: **12 Monate**
- Calculation Breakdown shows:
  - Nettoeinkommen: 2.000,00 €
  - ALG 1 Satz: 60%
  - Basis-ALG 1: 1.200,00 €
- Export buttons visible

**Verification:**

- Check browser console for errors
- Verify values match expected calculations
- Check that results appear smoothly (no flash)

### Scenario 2: Basic Calculation - Netto, With Children

**Steps:**

1. Use Scenario 1 setup
2. Toggle "Kinder vorhanden" to ON

**Expected Results:**

- ALG 1 Amount: **1.340,00 €** (67% of 2000€)
- ALG 1 Satz: 67% (mit Kindern)

### Scenario 3: Basic Calculation - Brutto

**Steps:**

1. Select "Brutto" radio button
2. Enter "3000" in "Einkommen (€/Monat)" field
3. Enter "35" in "Alter" field

**Expected Results:**

- Nettoeinkommen: **1.950,00 €** (65% of 3000€)
- ALG 1 Amount: **1.170,00 €** (60% of 1950€)

### Scenario 4: Maximum Cap - West Germany

**Steps:**

1. Select "Netto" radio button
2. Enter "5000" in "Einkommen (€/Monat)" field
3. Enter "35" in "Alter" field
4. Ensure Region is "Westdeutschland"

**Expected Results:**

- ALG 1 Amount: **2.390,00 €** (capped at maximum)
- Calculation Breakdown shows:
  - Höchstbetrag (West): 2.390,00 €
  - isCapped: true

### Scenario 5: Maximum Cap - East Germany

**Steps:**

1. Open "Erweiterte Optionen"
2. Select "Ostdeutschland" in Region dropdown
3. Enter "5000" in "Einkommen (€/Monat)" field
4. Enter "35" in "Alter" field

**Expected Results:**

- ALG 1 Amount: **2.320,00 €** (capped at maximum)
- Höchstbetrag (Ost): 2.320,00 €

### Scenario 6: Duration Calculation - Age 50

**Steps:**

1. Enter "2000" in "Einkommen (€/Monat)" field
2. Enter "50" in "Alter" field

**Expected Results:**

- Duration: **12 Monate** (minimum)

### Scenario 7: Duration Calculation - Age 55

**Steps:**

1. Enter "2000" in "Einkommen (€/Monat)" field
2. Enter "55" in "Alter" field

**Expected Results:**

- Duration: **22 Monate** (12 + (55-50)\*2)

### Scenario 8: Duration Calculation - Age 58

**Steps:**

1. Enter "2000" in "Einkommen (€/Monat)" field
2. Enter "58" in "Alter" field

**Expected Results:**

- Duration: **24 Monate** (maximum)

### Scenario 9: Side Income - At Freibetrag

**Steps:**

1. Enter "2000" in "Einkommen (€/Monat)" field
2. Enter "35" in "Alter" field
3. Open "Erweiterte Optionen"
4. Enter "165" in "Nebenverdienst (€/Monat)" field

**Expected Results:**

- ALG 1 Amount: **1.200,00 €** (no reduction)
- Side Income Impact section shows:
  - Freibetrag: 165,00 €
  - Übersteigender Betrag: 0,00 €
  - Abzug: 0,00 €

### Scenario 10: Side Income - With Reduction

**Steps:**

1. Enter "2000" in "Einkommen (€/Monat)" field
2. Enter "35" in "Alter" field
3. Open "Erweiterte Optionen"
4. Enter "365" in "Nebenverdienst (€/Monat)" field (200€ over Freibetrag)

**Expected Results:**

- ALG 1 Amount: **720,00 €** (1200€ - 480€ reduction)
- Side Income Impact shows:
  - Freibetrag: 165,00 €
  - Übersteigender Betrag: 200,00 €
  - Abzug: 480,00 € (40% of 1200€)

### Scenario 11: Side Income - Maximum Reduction

**Steps:**

1. Enter "2000" in "Einkommen (€/Monat)" field
2. Enter "35" in "Alter" field
3. Open "Erweiterte Optionen"
4. Enter "1000" in "Nebenverdienst (€/Monat)" field

**Expected Results:**

- ALG 1 Amount: **240,00 €** (1200€ - 960€ reduction, 80% cap)
- Abzug: 960,00 € (80% of 1200€)

### Scenario 12: Employment Months Validation

**Steps:**

1. Enter "2000" in "Einkommen (€/Monat)" field
2. Enter "35" in "Alter" field
3. Open "Erweiterte Optionen"
4. Enter "10" in "Beschäftigungsmonate (letzte 2 Jahre)" field

**Expected Results:**

- Error message appears: "Du musst mindestens 12 Monate..."
- Results section hidden
- showResults: false

### Scenario 13: Input Validation - Empty Income

**Steps:**

1. Leave "Einkommen (€/Monat)" field empty
2. Enter "35" in "Alter" field

**Expected Results:**

- No calculation runs
- No results displayed
- No error message (validation only on calculate)

### Scenario 14: Input Validation - Invalid Age

**Steps:**

1. Enter "2000" in "Einkommen (€/Monat)" field
2. Enter "15" in "Alter" field

**Expected Results:**

- Error message: "Bitte gib ein gültiges Alter ein (16-67 Jahre)"
- Results section hidden

### Scenario 15: Excel Export

**Steps:**

1. Complete Scenario 1 (basic calculation)
2. Click "Als Excel exportieren" button

**Expected Results:**

- Excel file downloads
- Filename: `arbeitslosengeld-berechnung-YYYY-MM-DD.xlsx`
- File contains all calculation data
- Data matches displayed results

### Scenario 16: PDF Export

**Steps:**

1. Complete Scenario 1 (basic calculation)
2. Click "Als PDF exportieren" button

**Expected Results:**

- Print dialog opens
- PDF contains all calculation data
- Data matches displayed results

### Scenario 17: URL Parameters

**Steps:**

1. Navigate to: `http://localhost:8003/tools/arbeitslosengeld-rechner?income=2000&type=netto&age=35`
2. Page loads with pre-filled values

**Expected Results:**

- Form fields pre-filled:
  - Income: 2000
  - Type: Netto (selected)
  - Age: 35
- Results automatically calculated and displayed
- ALG 1 Amount: 1.200,00 €

### Scenario 18: Real-time Calculation Updates

**Steps:**

1. Enter "2000" in "Einkommen (€/Monat)" field
2. Enter "35" in "Alter" field
3. Wait for results to appear
4. Change income to "3000"
5. Wait 300ms

**Expected Results:**

- Results update automatically after 300ms delay
- No flickering or multiple calculations
- Smooth transition

### Scenario 19: Responsive Design - Mobile

**Steps:**

1. Open browser DevTools
2. Set viewport to 375px width (iPhone)
3. Navigate to calculator page
4. Enter values and verify layout

**Expected Results:**

- Form fields stack vertically
- Result cards stack vertically
- All text readable
- Buttons have 44px+ touch targets
- No horizontal scrolling

### Scenario 20: Responsive Design - Tablet

**Steps:**

1. Set viewport to 768px width (iPad)
2. Navigate to calculator page
3. Enter values and verify layout

**Expected Results:**

- Form uses 2-column layout
- Result cards side-by-side
- All elements properly spaced

## Common Issues to Check

### Issue 1: Results Not Displaying

**Symptoms:**

- Form fields work
- No results appear after entering values

**Debugging Steps:**

1. Open browser console (F12)
2. Check for Alpine.js errors
3. Verify `showResults` is `true`:
   ```javascript
   Alpine.$data(document.querySelector("[x-data]")).showResults;
   ```
4. Verify `hasError` is `false`:
   ```javascript
   Alpine.$data(document.querySelector("[x-data]")).hasError;
   ```
5. Check if calculation ran:
   ```javascript
   Alpine.$data(document.querySelector("[x-data]")).alg1Amount;
   ```

### Issue 2: Calculation Not Running

**Symptoms:**

- Values entered but no calculation

**Debugging Steps:**

1. Check if `init()` method executed
2. Verify watchers are set up:
   ```javascript
   // Check if watchers exist (Alpine.js internal)
   ```
3. Verify both `incomeAmount` and `age` are set:
   ```javascript
   const data = Alpine.$data(document.querySelector("[x-data]"));
   console.log("Income:", data.incomeAmount);
   console.log("Age:", data.age);
   ```

### Issue 3: Export Not Working

**Symptoms:**

- Export button clicked but no file downloads

**Debugging Steps:**

1. Check browser console for errors
2. Verify API endpoint exists: `/v2/api/export-tool-excel.php`
3. Check network tab for API response
4. Verify response is blob type

## Expected Calculation Values Reference

### Test Case: 2000€ Netto, Age 35, No Children, West

- Nettoeinkommen: 2.000,00 €
- ALG 1 Satz: 60%
- Basis-ALG 1: 1.200,00 €
- Final ALG 1: 1.200,00 €
- Duration: 12 Monate

### Test Case: 2000€ Netto, Age 35, With Children, West

- Nettoeinkommen: 2.000,00 €
- ALG 1 Satz: 67%
- Basis-ALG 1: 1.340,00 €
- Final ALG 1: 1.340,00 €
- Duration: 12 Monate

### Test Case: 5000€ Netto, Age 35, No Children, West

- Nettoeinkommen: 5.000,00 €
- ALG 1 Satz: 60%
- Basis-ALG 1: 3.000,00 € (before cap)
- Final ALG 1: 2.390,00 € (capped)
- Duration: 12 Monate
- isCapped: true

## Browser Compatibility Checklist

- [ ] Chrome/Edge (Chromium)
- [ ] Firefox
- [ ] Safari
- [ ] Mobile Safari (iOS)
- [ ] Chrome Mobile (Android)

## Performance Checklist

- [ ] Calculation completes in < 100ms
- [ ] Debouncing works (no excessive calculations)
- [ ] Page loads in < 3 seconds
- [ ] No layout shift (CLS < 0.1)
- [ ] Smooth animations

## Accessibility Checklist

- [ ] Keyboard navigation works
- [ ] Focus states visible
- [ ] Screen reader compatible
- [ ] ARIA labels present
- [ ] Color contrast sufficient

## Related Cursor Rules

When working with ALG 1 calculator manual testing, the following Cursor rules apply:

- **[tools-pages-reference.mdc](../../../../.cursor/rules/tools-pages-reference.mdc)** - Testing patterns and troubleshooting
- **[tools-pages-core-validation.mdc](../../../../.cursor/rules/tools-pages-core-validation.mdc)** - Validation patterns
- **[tools-pages-alg1-calculator.mdc](../../../../.cursor/rules/tools-pages-alg1-calculator.mdc)** - ALG 1 calculator specific patterns
