diff --git a/testing-protocol.md b/testing-protocol.md new file mode 100644 index 0000000..b08b4f0 --- /dev/null +++ b/testing-protocol.md @@ -0,0 +1,131 @@ +# MC Cars — Local Testing Protocol + +> This document records the exact steps taken to verify the MC Cars stack is operational. +> Run these steps after every stack spin-up to confirm baseline functionality. + +--- + +## Prerequisites + +- Docker Engine with Compose v2 +- Clean data directory: `rm -rf data/db data/storage data/n8n && mkdir -p data/{db,storage,n8n}` + +--- + +## 1. Spin Up the Stack + +```bash +docker compose -f docker-compose.yml -f docker-compose.local.yml up -d --build +``` + +Wait ~30 seconds for migrations to complete, then verify: + +```bash +docker compose -f docker-compose.yml -f docker-compose.local.yml ps +``` + +Expected: all 14 services running (db healthy, kong healthy). + +--- + +## 2. Verify API Responds + +```bash +curl -s http://localhost:55580/index.html | head -5 +``` +Expected: HTML response with `` + +```bash +curl -s -H "apikey: $ANON_KEY" "http://localhost:55521/rest/v1/vehicles?select=brand,model" +``` +Expected: `[{"brand":"Ferrari","model":"296 GTB"}]` + +--- + +## 3. Playwright End-to-End Tests + +### 3.1 Public Website — Verify Access & Ferrari + +1. Navigate to `http://localhost:55580/index.html` +2. Verify page loads with title "MC Cars · Sportwagenvermietung Steiermark" +3. Verify hero section is visible +4. Verify "1" car count in stats section +5. Verify Ferrari 296 GTB card is visible with: + - Image: "Ferrari 296 GTB" + - Specs: 830 PS, 330 km/h, 2.9s + - Price: € 850 / pro Tag + - Buttons: "Details" and "Buchen" + +### 3.2 Playwright — Make a Reservation + +1. Scroll to/click "Buchen" section +2. Select "Ferrari 296 GTB" from vehicle dropdown +3. Click "Individuell" (custom dates) button +4. Set Start date: `2026-06-20` +5. Set End date: `2026-06-22` +6. Click "Weiter" (Weiter button, ref=e146) +7. Verify step 2 ("Kontaktdaten") is shown +8. Verify pricing sidebar shows: + - "Ferrari 296 GTB · 2 Tage" + - "Wochenendtage (2 × € 1100)" → "€ 2.200" + - "MwSt. (20%)" → "€ 440" + - "Gesamtbetrag" → "€ 2.640" + - "Kaution" → "€ 5.000" +9. Fill Name: `Jose Lago` +10. Fill Email: `jose@lago.dev` +11. Fill Phone: `+43 660 1234567` +12. Click "Weiter" to go to step 3 +13. Click "Anfrage absenden" (submit button) +14. Verify toast notification: "Danke! Wir melden uns in Kürze per E-Mail." +15. Verify form reset (vehicle dropdown back to "Fahrzeug wählen") + +### 3.3 Admin Portal — Verify Lead Appears + +1. Navigate to `http://localhost:55581/admin.html` +2. Verify login page loads with title "Admin · MC Cars" +3. Fill email: `admin@mccars.local` +4. Fill password: `mc-cars-admin` +5. Click "Anmelden" +6. Verify password rotation screen ("Passwort setzen") appears +7. Set new password: `NewMcCars2026!` (twice) +8. Click "Speichern" +9. Verify admin dashboard loads with hash `#leads` +10. Verify tabs: "Leads 1", "Kunden 0", "Bestellungen 0", "Fahrzeuge", "Einstellungen" +11. Verify the lead appears in "Aktive Leads" table with: + - **Eingang:** 17.05.26, 13:34 (current date/time) + - **Name/E-Mail:** Jose Lago · jose@lago.dev + - **Fahrzeug:** Ferrari 296 GTB + - **Zeitraum:** 2026-06-20 → 2026-06-22 + - **Gesamtbetrag:** € 2.640 + - **Status:** new + - **Actions:** Details, Qualifizieren, Ablehnen + +--- + +## 4. Spin Down & Cleanup + +```bash +docker compose -f docker-compose.yml -f docker-compose.local.yml down +``` + +Clean data directory for next test run: + +```bash +rm -rf data/db/* 2>/dev/null +# Note: data/db/ directory may need sudo to fully remove (owned by Docker bind mount UID) +``` + +--- + +## Expected Results Summary + +| Check | Expected | +|-------|----------| +| All services running | Yes (14 services) | +| Public website loads | Yes, 200 OK | +| API returns vehicles | Yes, Ferrari 296 GTB | +| Booking form works | Yes, 3-step wizard | +| Server-side pricing | Yes, € 2.640 for weekend | +| Booking submission | Yes, success toast shown | +| Admin login | Yes, password rotation enforced | +| Lead visible in admin | Yes, all fields correct |