# Frontend Tests Tests covering the React SPA (`frontend`, port 5173 dev / 80 prod): route guards, navigation, theme, component behaviour, and TanStack Query patterns. Full combined suite: `tests/ALL_TESTS.md` **Test environment:** Feature stack at `http://localhost:$PORT` (see CLAUDE.md §Feature branch workflow). **Admin credentials:** any superuser account created during stack setup. **Regular user credentials:** a second non-admin account for permission boundary tests. --- ## Legend | Symbol | Meaning | |--------|---------| | ✅ | Pass | | ❌ | Fail | | — | N/A for this change | --- ## 19. Frontend — UI & Routing | # | Test | Steps | Expected | |---|------|-------|----------| | 19.1 | PrivateRoute redirect | Open any protected route without token | Redirected to `/login` | | 19.2 | AdminRoute redirect | Log in as non-admin → navigate to `/admin` | Redirected to `/login` | | 19.3 | ServiceAdminRoute | Non-admin, non-group-member → navigate to `/apps/documents/settings` | Redirected (access denied) | | 19.4 | Sidebar collapse | Click collapse button | Sidebar shrinks to icon-only; expand restores labels | | 19.5 | Apps accordion | Click "Apps" in sidebar | Expands to show "Documents" NavLink | | 19.6 | SourcePanel visibility | Navigate to `/apps` then `/apps/documents` | SourcePanel only visible on `/apps/documents` route | | 19.7 | Theme toggle | Click sun/moon button | Mode switches; persists on reload | | 19.8 | Unknown route | Navigate to `/does-not-exist` | Redirected to `/` | | 19.9 | TanStack Query cache | Navigate away from docs → back | List loads from cache instantly; background refetch runs | | 19.10 | 30s service poll | Leave `/apps` open for 30s | `GET /api/services` fires again in network tab | | 19.11 | Three-dots menu not clipped | Scroll document table → open three-dot actions on any row | Dropdown renders above the table's overflow-hidden container; not cut off |