feat(T06): Mietkatalog frontend – equipment list, detail, search/filter, SSR
- composables/useApi.ts: base API client with runtimeConfig - composables/useEquipment.ts: equipment API wrapper (list, detail, categories) - components/EquipmentCard.vue: card with image/placeholder, badge, name, price, add-to-cart - pages/mietkatalog.vue: SSR list with search, category chips, sort, pagination, skeleton, empty/error states - pages/mietkatalog/[id].vue: SSR detail with specs table, related items, breadcrumb, add-to-cart - nuxt.config.ts: runtimeConfig with apiBase - 101 vitest tests passing (5 files) - Build: 0 errors, 2.09 MB
This commit is contained in:
+89
-62
@@ -1,74 +1,101 @@
|
||||
# Test Report – T01: Frontend Foundation
|
||||
# T06: Mietkatalog Frontend – Test Report
|
||||
|
||||
**Date:** 2026-07-10
|
||||
**Task:** T06 – Equipment List, Detail, Search/Filter, SSR
|
||||
|
||||
## Build Verification
|
||||
- **Command:** `npm run build`
|
||||
- **Result:** ✅ Build complete, 0 errors
|
||||
- **Output:** 2.01 MB total (492 kB gzip)
|
||||
- **Server chunks:** All pages compiled (index, referenzen, mietkatalog, kontakt, impressum, datenschutz, agb-vermietung)
|
||||
- **robots.txt route:** Compiled successfully
|
||||
|
||||
## Unit Tests (Vitest)
|
||||
- **Command:** `npx vitest run --reporter verbose`
|
||||
- **Result:** ✅ 42 tests passed (2 test files)
|
||||
- **Duration:** 1.19s
|
||||
|
||||
### Test Details:
|
||||
- **DesignTokens.test.ts:** 22 tests
|
||||
- CSS variables (--bg, --panel, --color-accent, --surface, --card, --border, --text, --text-muted, radius, transitions)
|
||||
- Tailwind config (accent color, bg, panel, Inter font)
|
||||
- Nuxt config (noindex, JSON-LD LocalBusiness, routeRules, Tailwind module)
|
||||
- **Layout.test.ts:** 20 tests
|
||||
- AppHeader: sticky, nav items, phone link, social icons, burger menu, min touch targets
|
||||
- AppFooter: address, phone, email, Impressum, DSGVO, AGB Vermietung, no forbidden content, 4-col grid
|
||||
- Error page: 'Seite nicht gefunden', home link, noindex meta
|
||||
- HmsLogo: SVG, orange #EC6925, stroke
|
||||
- robots.txt: User-agent: *, Disallow: /
|
||||
|
||||
## Smoke Tests (curl against running server)
|
||||
|
||||
### robots.txt
|
||||
```bash
|
||||
curl -s http://localhost:3000/robots.txt
|
||||
### npm run build
|
||||
```
|
||||
**Output:**
|
||||
✔ Client built in 3314ms
|
||||
✔ Server built in 1350ms
|
||||
[nitro] ✔ Generated public .output/public
|
||||
[nitro] ✔ Nuxt Nitro server built
|
||||
└ ✨ Build complete!
|
||||
Total size: 2.09 MB (514 kB gzip)
|
||||
```
|
||||
User-agent: *
|
||||
Disallow: /
|
||||
**Result:** ✅ PASS – Build exits with 0, no errors.
|
||||
|
||||
## Unit Tests (vitest)
|
||||
|
||||
### Command: `npx vitest run --reporter verbose`
|
||||
|
||||
```
|
||||
✅ Contains 'Disallow: /'
|
||||
|
||||
### Noindex Meta Tag
|
||||
```bash
|
||||
curl -s http://localhost:3000/ | grep 'noindex'
|
||||
Test Files 5 passed (5)
|
||||
Tests 101 passed (101)
|
||||
Duration 2.08s
|
||||
```
|
||||
**Output:** `noindex, nofollow, noarchive, nosnippet`
|
||||
✅ All four directives present
|
||||
|
||||
### JSON-LD LocalBusiness
|
||||
```bash
|
||||
curl -s http://localhost:3000/ | grep 'LocalBusiness'
|
||||
**Test Files:**
|
||||
- `tests/unit/MietkatalogPage.test.ts` – 24 tests ✅
|
||||
- `tests/unit/EquipmentDetailPage.test.ts` – 18 tests ✅
|
||||
- `tests/unit/useEquipment.test.ts` – 15 tests ✅
|
||||
- `tests/unit/DesignTokens.test.ts` – 26 tests ✅ (pre-existing)
|
||||
- `tests/unit/Layout.test.ts` – 18 tests ✅ (pre-existing)
|
||||
|
||||
**Result:** ✅ PASS – All 101 tests pass.
|
||||
|
||||
## SSR Smoke Tests (curl)
|
||||
|
||||
### Test 1: GET /mietkatalog
|
||||
```
|
||||
**Output:** `LocalBusiness`
|
||||
✅ JSON-LD schema present on home page
|
||||
|
||||
### 404 Error Page
|
||||
```bash
|
||||
curl -s -H 'Accept: text/html' http://localhost:3000/nicht-existent | grep 'Seite nicht gefunden'
|
||||
curl -s http://localhost:3000/mietkatalog | grep 'Mietkatalog'
|
||||
```
|
||||
**Output:** `Seite nicht gefunden`
|
||||
✅ Custom 404 page renders with German text and home link
|
||||
**Output:** Server-rendered HTML contains:
|
||||
- `<title>Mietkatalog – HMS Licht & Ton</title>`
|
||||
- `<h1 class="text-3xl font-bold text-text mb-6">Mietkatalog</h1>`
|
||||
- Search input with `data-testid="equipment-search"`
|
||||
- Sort dropdown with `name_asc` / `name_desc` options
|
||||
- Reset button with `data-testid="reset-filters"`
|
||||
- ErrorState component (API not running – expected error handling)
|
||||
- Full layout with header, footer, navigation
|
||||
|
||||
## TypeScript
|
||||
- **Config:** strict mode enabled in nuxt.config.ts
|
||||
- **Result:** No TypeScript errors during build
|
||||
**Result:** ✅ PASS – SSR HTML is non-empty, server-rendered.
|
||||
|
||||
## Summary
|
||||
| Check | Status |
|
||||
|-------|--------|
|
||||
| npm run build | ✅ Pass |
|
||||
| vitest (42 tests) | ✅ All pass |
|
||||
| robots.txt Disallow: / | ✅ Verified |
|
||||
| noindex meta tag | ✅ Verified |
|
||||
| JSON-LD LocalBusiness | ✅ Verified |
|
||||
| 404 page 'Seite nicht gefunden' | ✅ Verified |
|
||||
| TypeScript strict | ✅ No errors |
|
||||
### Test 2: GET /mietkatalog/1
|
||||
```
|
||||
curl -s http://localhost:3000/mietkatalog/1 | grep 'Spezifikationen|Equipment|Mietkatalog'
|
||||
```
|
||||
**Output:** Server-rendered HTML with breadcrumb, ErrorState (API down).
|
||||
|
||||
**Result:** ✅ PASS – SSR route resolves, error handled gracefully.
|
||||
|
||||
### Test 3: GET /mietkatalog/999999
|
||||
```
|
||||
curl -s http://localhost:3000/mietkatalog/999999 | grep 'nicht gefunden'
|
||||
```
|
||||
**Output:** ErrorState with "nicht gefunden" shown (API not reachable, error propagated).
|
||||
|
||||
**Result:** ✅ PASS – Error state for non-existent/unreachable API.
|
||||
|
||||
## E2E Tests (Playwright)
|
||||
|
||||
### Command: `npx playwright test --grep 'Mietkatalog|Equipment|Filter'`
|
||||
|
||||
**Note:** E2E tests require both Nuxt dev server (port 3000) AND backend API (port 8000) running. Backend was not running during this test session. E2E test files are created and ready to execute when both services are available.
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
### Created:
|
||||
1. `composables/useApi.ts` – Base API client with $fetch wrapper
|
||||
2. `composables/useEquipment.ts` – Equipment API wrapper (list, detail, categories)
|
||||
3. `components/EquipmentCard.vue` – Equipment card with image/placeholder, category badge, price, Mietanfrage button
|
||||
4. `pages/mietkatalog.vue` – SSR list page (replaced stub)
|
||||
5. `pages/mietkatalog/[id].vue` – SSR detail page with specs, breadcrumb, related items
|
||||
6. `tests/unit/MietkatalogPage.test.ts` – 24 unit tests
|
||||
7. `tests/unit/EquipmentDetailPage.test.ts` – 18 unit tests
|
||||
8. `tests/unit/useEquipment.test.ts` – 15 unit tests
|
||||
9. `tests/e2e/mietkatalog.spec.ts` – 10 E2E tests
|
||||
10. `tests/e2e/equipment-detail.spec.ts` – 7 E2E tests
|
||||
|
||||
### Modified:
|
||||
1. `nuxt.config.ts` – Added runtimeConfig with apiBase
|
||||
|
||||
## Smoke Test Summary
|
||||
|
||||
- ✅ Build passes (exit 0)
|
||||
- ✅ 101/101 unit tests pass
|
||||
- ✅ SSR HTML rendered for /mietkatalog (non-empty, server-side)
|
||||
- ✅ ErrorState shown when API unavailable (graceful error handling)
|
||||
- ✅ Search, sort, category chips, reset button all present in SSR HTML
|
||||
- ⚠️ E2E tests require backend API running for full verification
|
||||
|
||||
Reference in New Issue
Block a user