# 🚀 ROA2WEB Testing - Quick Start Ghid rapid pentru rularea testelor Playwright cu detectarea problemelor reale. ## ⚡ Start Rapid ```bash # 1. Instalează dependențele (prima dată) npm install # 2. Curăță fișierele temporare (recomandat) ./cleanup-tests.sh # 3. Rulează toate testele cu analiză completă ./run-comprehensive-tests.sh # 4. Pentru teste simple/CI ./run-tests.sh ``` ## 📋 Scripturi Disponibile | Script | Platformă | Descriere | Funcționalitate | |--------|-----------|-----------|------------------| | **`run-comprehensive-tests.sh`** | Linux/macOS/WSL | **🎯 RECOMANDAT** - Testare completă cu detecție probleme | Analiză avansată, recomandări, raportare detaliată | | `run-tests.sh` | Linux/macOS/WSL | Script Playwright standard | Testare de bază mock + integrare | | `cleanup-tests.sh` | Linux/macOS/WSL | Curățare fișiere temporare | Screenshots, videos, rapoarte | ## 🎯 Comenzi Esențiale ### 🚀 **Testare Comprehensivă (RECOMANDATĂ)** ```bash ./run-comprehensive-tests.sh # Toate testele + analiză completă ./run-comprehensive-tests.sh --no-cleanup # Fără curățarea fișierelor ./run-comprehensive-tests.sh --no-real-world # Doar teste de bază ./run-comprehensive-tests.sh --help # Toate opțiunile ``` ### 🔧 **Testare Standard** ```bash ./run-tests.sh # Teste mock + integrare ./run-tests.sh --no-mock # Doar teste de integrare ./run-tests.sh --no-integration # Doar teste mock ``` ### 🧹 **Curățare & Management** ```bash ./cleanup-tests.sh # Curăță toate fișierele temporare ./cleanup-tests.sh --deep # Curățare avansată + cache ``` ### 🔍 **Debug & Development** ```bash npx playwright test auth/login.spec.js --headed # Login cu UI vizibil npx playwright test --debug # Debug interactiv npx playwright show-report # Afișează ultimul raport ``` ## 📊 Ce Testează ### 🎭 **Testare Comprehensivă** - ✅ **Authentication Flow** (10 teste): Login real, validare, token management - ✅ **Real-World Scenarios** (4 teste): Journey complet utilizator, performance - ✅ **Issue Detection** (4 teste): Debugging, network monitoring, CORS - ✅ **Reports Functionality** (2 teste): Companies, invoices, payments API - ✅ **Responsive Design** (4 teste): Mobile, tablet, desktop, orientări ### 🔧 **Testare Standard** - ✅ **Basic Auth** (10 teste): Login, validare, erori - ✅ **Dashboard** (8 teste): Companii, statistici, navigare - ✅ **Invoices** (10 teste): Liste, filtrare, export - ✅ **Payments** (12 teste): Încasări, totalizări, metodă - ✅ **Responsive** (9 teste): Breakpoint-uri, touch interactions **Total: 70+ teste specifice + 200+ teste standard pe 5 browsere** ## 🔧 Setup Minim ```bash cd roa2web/reports-app/frontend npm install # Instalează dependențele npx playwright install # Instalează browserele chmod +x *.sh # Permisiuni pentru scripturi ./run-comprehensive-tests.sh --help # Verifică că totul funcționează ``` ## 📋 **Prerequisites pentru Testare** ```bash # 1. Servicii necesare (în terminale separate): cd roa2web/reports-app/backend && uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 cd roa2web/reports-app/frontend && npm run dev cd roa2web && ./ssh_tunnel.sh start # 2. Verifică că serviciile rulează: curl http://localhost:8000/health # Backend curl http://localhost:3001 # Frontend nc -z localhost 1521 # SSH Tunnel ``` ## 📱 Browsere Suportate - **Chromium** (Chrome/Edge) - Principal pentru debugging - **Firefox** - Cross-browser compatibility - **WebKit** (Safari) - Apple ecosystem - **Mobile Chrome** (Pixel 5) - Mobile testing - **Mobile Safari** (iPhone 12) - iOS testing ## 🎭 Exemple Practice ```bash # 🚀 Workflow Development (RECOMANDAT) ./cleanup-tests.sh # Curăță vechile fișiere ./run-comprehensive-tests.sh # Toate testele cu analiză cat test-reports-*/comprehensive-test-report.md # Vezi raportul # 🔧 Workflow Standard/CI ./run-tests.sh # Teste rapide standard npx playwright show-report # Vezi rezultatele # 🔍 Debug Specific Issues npx playwright test auth/login.spec.js --headed --debug npx playwright test e2e/debugging-real-issues.spec.js --headed # 🧹 Curățare după testare ./cleanup-tests.sh --deep # Curățare completă ``` ## 🚨 Troubleshooting ### ❌ **Permission Denied pe Scripturi** ```bash chmod +x *.sh # Permite execuția scripturilor ``` ### ❌ **Windows Line Endings** ```bash sed -i 's/\r$//' *.sh # Convertește line endings ``` ### ❌ **Serviciile Nu Rulează** ```bash # Verifică serviciile: ./run-comprehensive-tests.sh --no-basic --no-real-world # Doar verificare servicii ``` ### ❌ **Teste Failed - Debugging** ```bash ./run-comprehensive-tests.sh # Vezi raport detaliat cu recomandări npx playwright test --debug # Debug interactiv npx playwright show-report # Ultimul raport Playwright ``` ### ❌ **JWT Token Issues (Known Issue)** ```bash # Problema curentă identificată: # 401 Unauthorized pe /companies/ după login # Vezi FINAL_COMPREHENSIVE_TEST_REPORT.md pentru soluție ``` ### ❌ **Curățare Space pe Disk** ```bash ./cleanup-tests.sh --deep # Curăță tot + cache ``` ## 📊 **Interpretarea Rezultatelor** ### ✅ **Success Output:** ```bash ✅ All tests completed successfully! ⚡ Average Response Time: 8ms 🎉 No critical issues found! ``` ### 🚨 **Issues Found Output:** ```bash ❌ API Errors: 8 🚨 CRITICAL: JWT Token not sent to protected routes 💡 RECOMMENDATION: Fix token transmission in api.js 📋 Report: test-reports-TIMESTAMP/comprehensive-test-report.md ``` ## 🎯 **Ce Faci Dacă...** | Problemă | Soluție | |----------|---------| | 🚨 **Authentication 401 errors** | Vezi `FINAL_COMPREHENSIVE_TEST_REPORT.md` - problemă JWT token | | ⚡ **Teste durează mult** | Folosește `./run-tests.sh` pentru testare rapidă | | 🔍 **Vrei să debug o problemă** | `npx playwright test [test-name] --headed --debug` | | 📊 **Vrei raport detaliat** | `./run-comprehensive-tests.sh` + vezi `test-reports-*/` | | 🧹 **Disk plin cu fișiere test** | `./cleanup-tests.sh --deep` | --- ## 🎉 **Next Steps** 1. **🚀 Start:** `./run-comprehensive-tests.sh` 2. **📊 Review:** `cat test-reports-*/comprehensive-test-report.md` 3. **🔧 Fix Issues:** Follow recommendations in report 4. **📚 Deep Dive:** `TEST_RUNNER_GUIDE.md` pentru ghid complet **🎯 RESULT:** Aplicație testată comprehensiv cu probleme reale identificate și soluții recomandate!