# ROA2WEB Test Runner Guide Ghid pentru rularea testelor Playwright folosind scripturile disponibile. ## 🚀 Scripturi Disponibile ### 1. Script Bash (Linux/macOS/WSL) ```bash ./run_tests.sh [test_type] [browser] [mode] ``` ### 2. Script Windows Batch ```cmd run_tests.bat [test_type] [browser] [mode] ``` ### 3. Script Python (Cross-platform) ```bash python run_tests.py [options] ``` ## 📋 Opțiuni Disponibile ### Tipuri de Teste - `all` - Toate testele (implicit) - `auth` - Doar testele de autentificare - `dashboard` - Doar testele dashboard - `invoices` - Doar testele facturi - `payments` - Doar testele încasări - `responsive` - Doar testele responsive - `smoke` - Testele critice (login + dashboard basic) ### Browsere - `chromium` - Doar pe Chromium - `firefox` - Doar pe Firefox - `webkit` - Doar pe WebKit (Safari) - `mobile` - Doar pe browsere mobile ### Moduri de rulare - `--headed` - Cu interfață browser vizibilă - `--debug` - Mod debug (pas cu pas) - `--ui` - Cu Playwright UI - `--report` - Afișează raportul ## 🛠️ Exemple de Utilizare ### Bash/Linux/macOS ```bash # Toate testele ./run_tests.sh # Doar testele de autentificare ./run_tests.sh auth # Testele dashboard pe Firefox cu UI ./run_tests.sh dashboard firefox --headed # Teste smoke în mod debug ./run_tests.sh smoke --debug # Afișează help ./run_tests.sh --help ``` ### Windows ```cmd REM Toate testele run_tests.bat REM Doar testele facturi run_tests.bat invoices REM Testele responsive pe Chromium run_tests.bat responsive chromium REM Teste cu Playwright UI run_tests.bat all --ui ``` ### Python (Cross-platform) ```bash # Toate testele python run_tests.py # Testele payments cu opțiuni avansate python run_tests.py payments --workers 2 --retries 1 # Lista toate testele disponibile python run_tests.py --list # Testele care conțin "login" în nume python run_tests.py --grep "login" # Afișează help complet python run_tests.py --help ``` ## 🔧 Opțiuni Avansate (Python) Scriptul Python oferă opțiuni suplimentare: ```bash # Numărul de worker-i paraleli python run_tests.py all --workers 4 # Numărul de reîncercări pentru testele failed python run_tests.py auth --retries 2 # Timeout personalizat (în milisecunde) python run_tests.py invoices --timeout 60000 # Filtrare cu regex python run_tests.py --grep "should.*correctly" # Combinații complexe python run_tests.py responsive webkit --headed --workers 1 ``` ## 📊 Monitorizare și Raportare ### Afișarea Raportului ```bash # Bash ./run_tests.sh --report # Windows run_tests.bat --report # Python python run_tests.py --report ``` ### Listarea Testelor ```bash # Doar cu Python python run_tests.py --list ``` ## 🎯 Workflow Recomandat ### 1. Dezvoltare Rapidă ```bash # Teste smoke pentru verificare rapidă ./run_tests.sh smoke # Testele unei funcționalități specifice ./run_tests.sh auth --headed ``` ### 2. Testing Complet ```bash # Toate testele pe toate browserele ./run_tests.sh all # Testele responsive pe mobile ./run_tests.sh responsive mobile ``` ### 3. Debugging ```bash # Debug interactiv ./run_tests.sh auth --debug # Cu UI pentru investigare ./run_tests.sh invoices --ui ``` ### 4. CI/CD ```bash # Pentru integrare continuă python run_tests.py all --workers 2 --retries 1 ``` ## 🔧 Setup Inițial ### 1. Asigură-te că dependențele sunt instalate ```bash cd roa2web/reports-app/frontend npm install ``` ### 2. (Opțional) Pornește serverul frontend ```bash npm run dev ``` *Nota: Testele funcționează și cu API-uri mock-uite* ### 3. Rulează testele ```bash ./run_tests.sh ``` ## 🚨 Troubleshooting ### Problema: "command not found" ```bash # Bash - fă scriptul executabil chmod +x run_tests.sh # Python - verifică că Python 3 este instalat python3 --version ``` ### Problema: "Frontend server not detected" ```bash # Pornește serverul în alt terminal npm run dev # Sau rulează testele cu mock-uri (implicit) ./run_tests.sh auth ``` ### Problema: "Playwright not installed" ```bash npm install npx playwright install ``` ### Problema: Teste failed ```bash # Verifică cu debug mode ./run_tests.sh [test_type] --debug # Sau cu UI pentru investigare ./run_tests.sh [test_type] --ui # Afișează raportul detaliat ./run_tests.sh --report ``` ## 📈 Performance Tips 1. **Rulare Paralelă**: Folosește `--workers N` pentru teste mai rapide 2. **Browser Specific**: Rulează pe un singur browser pentru dezvoltare 3. **Teste Smoke**: Folosește `smoke` pentru verificări rapide 4. **Mock APIs**: Testele sunt optimizate să ruleze fără server backend ## 🎭 Informații Despre Teste - **Total teste**: 262 (peste 5 browsere) - **Coverage**: Login, Dashboard, Facturi, Încasări, Responsive - **Pattern**: Page Object Model pentru mentenabilitate - **Mock**: API responses pentru consistență - **Screenshots**: Automat la failure - **Videos**: Pentru testele failed --- *Pentru documentație completă despre teste, vezi `tests/README.md`*