veza/apps/web/e2e/LATEST_FIXES.md
2025-12-22 22:00:50 +01:00

97 lines
2.1 KiB
Markdown

# ✅ LATEST E2E FIXES - QUICK REFERENCE
**Date**: 2025-12-18
**Status**: ✅ **APPLIED**
---
## 🎯 3 CRITICAL FIXES
### 1. ✅ Full Storage Dump in `getAuthToken()`
**File**: `test-helpers.ts` (lines 34-60)
**Now Shows**:
```
🔍 [Helper] Dumping Storage for Debug:
- LocalStorage: {"veza_access_token":"eyJhbGciOiJI..."}
- SessionStorage: {}
- Cookies: session_id=abc123
```
**Why**: See **EXACTLY** what's in storage (no guessing)
---
### 2. ✅ Wait for Token (5 seconds)
**File**: `test-helpers.ts` (lines 146-152)
**What Changed**:
```typescript
// Wait up to 5s for token to appear
await page.waitForFunction(() => {
return localStorage.getItem('veza_access_token') || localStorage.getItem('auth-storage');
}, null, { timeout: 5000 });
```
**Why**: Handles async token storage (no race conditions)
---
### 3. ✅ Password Selector (4 variations)
**File**: `auth.spec.ts` (lines 125, 177, 368)
**What Changed**:
```typescript
// Before: 3 variations
input[name="passwordConfirm"], input[name="password_confirm"], input[name="confirmPassword"]
// After: 4 variations
input[name="passwordConfirm"], input[name="password_confirm"], input[name="confirmPassword"], input#passwordConfirm
```
**Why**: Covers ID selector too
---
## 🧪 RUN TEST
```bash
cd apps/web && npm run test:e2e
```
---
## 🔍 WHAT TO EXPECT
### ✅ Success
```
⏳ [LOGIN] Waiting for token to appear in storage...
🔍 [Helper] Dumping Storage for Debug:
- LocalStorage: {"veza_access_token":"eyJhbGciOiJI..."}
✅ Found token in direct key: veza_access_token
✅ [LOGIN] Successfully authenticated
```
### ❌ Failure
```
⏳ [LOGIN] Waiting for token to appear in storage...
⚠️ Token wait timeout - proceeding with verification
🔍 [Helper] Dumping Storage for Debug:
- LocalStorage: {}
- SessionStorage: {}
- Cookies: session_id=abc123
❌ [LOGIN] FAILED: No token found in storage after login!
```
**Either way, you see EVERYTHING!**
---
## 📄 DETAILED DOCS
- **LATEST_FIXES.md** ← You are here (1 page)
- **DEBUG_TOKEN_STORAGE_FIXES.md** - Complete details (6 pages)
---
**MAXIMUM DEBUG VISIBILITY** 🔍