Initial commit: ROA2WEB - FastAPI + Vue.js + Telegram Bot
Modern ERP Reports Application with microservices architecture Tech Stack: - Backend: FastAPI + python-oracledb (Oracle DB integration) - Frontend: Vue.js 3 + PrimeVue + Vite - Telegram Bot: python-telegram-bot + SQLite - Infrastructure: Shared database pool, JWT authentication, SSH tunnel Features: - FastAPI backend with async Oracle connection pool - Vue.js 3 responsive frontend with PrimeVue components - Telegram bot alternative interface - Microservices architecture with shared components - Complete deployment support (Linux Docker + Windows IIS) - Comprehensive testing (Playwright E2E + pytest) Repository Structure: - reports-app/ - Main application (backend, frontend, telegram-bot) - shared/ - Shared components (database pool, auth, utils) - deployment/ - Deployment scripts (Linux & Windows) - docs/ - Project documentation - security/ - Security scanning and git hooks
This commit is contained in:
236
reports-app/frontend/scripts/README_ANDROID.md
Normal file
236
reports-app/frontend/scripts/README_ANDROID.md
Normal file
@@ -0,0 +1,236 @@
|
||||
# 📱 Android Testing Scripts
|
||||
|
||||
Scripturi pentru testarea aplicației ROA2WEB pe telefoane Android reale.
|
||||
|
||||
## 🎯 Scripturi Disponibile
|
||||
|
||||
| Script | Platform | Status | Descriere |
|
||||
|--------|----------|---------|-----------|
|
||||
| **android-test-setup.ps1** | Windows PowerShell | [OK] Functional | Setup complet Android testing |
|
||||
| **android-disconnect.sh** | Bash/WSL | [OK] Functional | Cleanup port forwarding |
|
||||
|
||||
---
|
||||
|
||||
## Quick Start (Windows)
|
||||
|
||||
**In Windows PowerShell:**
|
||||
|
||||
```powershell
|
||||
cd E:\proiecte\roa2web\roa2web\reports-app\frontend\scripts
|
||||
|
||||
# Setup complet (prima data)
|
||||
.\android-test-setup.ps1
|
||||
```
|
||||
|
||||
**Pentru cleanup:**
|
||||
```bash
|
||||
# In WSL (dupa testare)
|
||||
cd /mnt/e/proiecte/roa2web/roa2web/reports-app/frontend
|
||||
./scripts/android-disconnect.sh
|
||||
```
|
||||
|
||||
**Screenshot-uri (Claude Code):**
|
||||
|
||||
Nu mai este nevoie de script pentru salvare screenshot-uri! Claude Code poate face screenshot-uri direct prin MCP (chrome-devtools-android) si le primeste inline pentru analiza.
|
||||
|
||||
---
|
||||
|
||||
## 📜 Documentație Detaliată
|
||||
|
||||
### 1️⃣ `android-test-setup.ps1` (Windows PowerShell)
|
||||
|
||||
**Scop:** Configurare completă conexiune Android pentru testare
|
||||
|
||||
**Ce face:**
|
||||
- ✅ Verifică ADB este instalat
|
||||
- ✅ Verifică telefon conectat (WiFi sau USB)
|
||||
- ✅ Configurează port forwarding pentru Chrome DevTools (9222)
|
||||
- ✅ Configurează reverse port forwarding pentru acces aplicație (3000, 8001)
|
||||
- ✅ Testează conexiunea la Chrome pe telefon
|
||||
- ✅ Afișează informații rețea și configurare MCP
|
||||
- ✅ Comenzi utile pentru debugging
|
||||
|
||||
**Utilizare:**
|
||||
```powershell
|
||||
cd E:\proiecte\roa2web\roa2web\reports-app\frontend\scripts
|
||||
.\android-test-setup.ps1
|
||||
```
|
||||
|
||||
**Când să rulezi:**
|
||||
- Prima dată când conectezi telefonul
|
||||
- După restart calculator/telefon
|
||||
- Când port forwarding nu mai funcționează
|
||||
- Pentru verificare setup
|
||||
|
||||
**Output exemplu:**
|
||||
```
|
||||
================================
|
||||
🚀 ROA2WEB - Android Testing Setup
|
||||
================================
|
||||
|
||||
✓ ADB este instalat
|
||||
Android Debug Bridge version 1.0.41
|
||||
|
||||
✓ Telefon Android conectat: 1 dispozitiv(e)
|
||||
10.0.20.114:38261 device
|
||||
|
||||
✓ Port forwarding configurat: localhost:9222 -> Chrome pe telefon
|
||||
10.0.20.114:38261 tcp:9222 localabstract:chrome_devtools_remote
|
||||
|
||||
✓ Reverse port forwarding configurat
|
||||
Frontend: http://localhost:3000
|
||||
Backend: http://localhost:8001/api
|
||||
|
||||
ℹ IP-ul calculatorului: 10.0.20.144
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 2 `android-disconnect.sh` (Bash/WSL)
|
||||
|
||||
**Scop:** Cleanup port forwarding când termini testarea
|
||||
|
||||
**Ce face:**
|
||||
- ✅ Șterge toate port forwarding-urile (9222, 3000, 8001)
|
||||
- ✅ Șterge reverse port forwarding
|
||||
- ✅ Cleanup complet pentru deconectare sigură
|
||||
|
||||
**Utilizare:**
|
||||
```bash
|
||||
cd /mnt/e/proiecte/roa2web/roa2web/reports-app/frontend
|
||||
./scripts/android-disconnect.sh
|
||||
```
|
||||
|
||||
**Când să rulezi:**
|
||||
- După finalizarea sesiunii de testare
|
||||
- Înainte de a deconecta telefonul
|
||||
- Pentru cleanup general
|
||||
|
||||
**Output exemplu:**
|
||||
```
|
||||
🔌 Deconectare telefon Android și cleanup...
|
||||
✓ Port forwarding șters
|
||||
✓ Reverse port forwarding șters
|
||||
✅ Deconectare completă!
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Workflow Complet de Testare
|
||||
|
||||
### Setup Inițial (o dată):
|
||||
|
||||
**1. Instalează ADB pe Windows:**
|
||||
```powershell
|
||||
winget install Google.PlatformTools
|
||||
```
|
||||
|
||||
**2. Configurează telefonul Android:**
|
||||
```
|
||||
Setări → Despre telefon → Apasă 7x "Build number"
|
||||
Setări → Developer options → Activează "USB debugging"
|
||||
Setări → Developer options → Activează "Wireless debugging"
|
||||
```
|
||||
|
||||
**3. Conectează telefonul:**
|
||||
- **WiFi:** `adb pair IP:PORT` apoi `adb connect IP:PORT`
|
||||
- **USB:** Conectează cablu, acceptă "Allow USB debugging"
|
||||
|
||||
### Workflow Zilnic:
|
||||
|
||||
```powershell
|
||||
# Windows PowerShell
|
||||
|
||||
# 1. Setup conexiune
|
||||
cd E:\proiecte\roa2web\roa2web\reports-app\frontend\scripts
|
||||
.\android-test-setup.ps1
|
||||
|
||||
# 2. Pornește aplicația (în WSL)
|
||||
cd /mnt/e/proiecte/roa2web/roa2web
|
||||
./start-dev.sh
|
||||
|
||||
# 3. Pe telefon Chrome: http://localhost:3000
|
||||
|
||||
# 4. In Claude Code: "fa screenshot de pe telefon" (MCP inline)
|
||||
|
||||
# 5. La final, cleanup (WSL)
|
||||
./scripts/android-disconnect.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### "ADB not found"
|
||||
```powershell
|
||||
winget install Google.PlatformTools
|
||||
# Sau download manual: https://developer.android.com/tools/releases/platform-tools
|
||||
```
|
||||
|
||||
### "No Android device connected"
|
||||
**WiFi:**
|
||||
```powershell
|
||||
adb pair 10.0.20.114:PORT # Portul din "Pair device"
|
||||
adb connect 10.0.20.114:PORT # Portul wireless debugging
|
||||
adb devices # Verifică
|
||||
```
|
||||
|
||||
**USB:**
|
||||
- Verifică cablul (unele sunt doar pentru încărcare)
|
||||
- Deblochează telefonul
|
||||
- Acceptă "Allow USB debugging"
|
||||
|
||||
### "Port forwarding nu funcționează"
|
||||
```powershell
|
||||
# Re-setup complet
|
||||
.\android-test-setup.ps1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ Note Importante
|
||||
|
||||
### De ce `android-test-setup.sh` nu funcționează în WSL?
|
||||
|
||||
ADB în WSL2 **nu poate vedea** dispozitivele USB conectate la Windows. Chiar și cu ADB wireless, există probleme de networking între WSL2 și Android device.
|
||||
|
||||
**Soluție:** Folosește scripturile **PowerShell** care rulează ADB direct în Windows!
|
||||
|
||||
### Chrome DevTools MCP
|
||||
|
||||
Pentru ca Chrome DevTools MCP să funcționeze din WSL (Claude Code), trebuie:
|
||||
1. Port forwarding activ: `adb forward tcp:9222 ...`
|
||||
2. Windows port proxy: `netsh interface portproxy add v4tov4 ...`
|
||||
3. Configurare MCP cu IP-ul fizic Windows: `http://10.0.20.144:9222`
|
||||
|
||||
Vezi `tests/ANDROID_TESTING_GUIDE.md` pentru setup complet.
|
||||
|
||||
---
|
||||
|
||||
## 📚 Documentație Suplimentară
|
||||
|
||||
- **ANDROID_QUICK_START.md** - Ghid rapid 5 minute
|
||||
- **tests/ANDROID_TESTING_GUIDE.md** - Ghid complet cu troubleshooting
|
||||
- **frontend/README.md** - Secțiunea "Testing on Real Android Devices"
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
**Scripturi functionale:**
|
||||
- [OK] `android-test-setup.ps1` (Windows PowerShell) - Setup complet
|
||||
- [OK] `android-disconnect.sh` (WSL) - Cleanup
|
||||
|
||||
**Screenshot-uri:**
|
||||
- Nu mai este nevoie de script dedicat
|
||||
- Claude Code face screenshot-uri prin MCP (chrome-devtools-android) inline
|
||||
|
||||
**Testare optima:**
|
||||
- Ruleaza android-test-setup.ps1 din Windows PowerShell
|
||||
- Claude Code controleaza Chrome pe telefon prin MCP
|
||||
|
||||
---
|
||||
|
||||
**Autor:** ROA2WEB Development Team
|
||||
**Data:** 2025-10-20
|
||||
**Versiune:** 3.0 (Final cleanup - doar scripturi esentiale)
|
||||
39
reports-app/frontend/scripts/android-disconnect.sh
Normal file
39
reports-app/frontend/scripts/android-disconnect.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ROA2WEB - Android Disconnect Script
|
||||
# Opreste conexiunea si curata port forwarding
|
||||
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
print_success() { echo -e "${GREEN}[OK] $1${NC}"; }
|
||||
print_info() { echo -e "${BLUE}[INFO] $1${NC}"; }
|
||||
|
||||
echo
|
||||
print_info " Deconectare telefon Android si cleanup..."
|
||||
echo
|
||||
|
||||
# Remove all port forwarding
|
||||
print_info "Stergere port forwarding..."
|
||||
adb forward --remove-all 2>/dev/null || true
|
||||
print_success "Port forwarding sters"
|
||||
|
||||
# Remove all reverse port forwarding
|
||||
print_info "Stergere reverse port forwarding..."
|
||||
adb reverse --remove-all 2>/dev/null || true
|
||||
print_success "Reverse port forwarding sters"
|
||||
|
||||
echo
|
||||
print_success "[OK] Deconectare completa!"
|
||||
echo
|
||||
print_info "Poti deconecta telefonul de la calculator in siguranta."
|
||||
echo
|
||||
print_info "Pentru a reconecta, ruleaza (Windows PowerShell):"
|
||||
echo " .\\android-test-setup.ps1"
|
||||
echo
|
||||
266
reports-app/frontend/scripts/android-test-setup.ps1
Normal file
266
reports-app/frontend/scripts/android-test-setup.ps1
Normal file
@@ -0,0 +1,266 @@
|
||||
# ROA2WEB - Android Testing Setup Script (PowerShell)
|
||||
# Configureaza conexiunea la telefon Android pentru testare
|
||||
|
||||
param(
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
if ($Help) {
|
||||
Write-Host @"
|
||||
ROA2WEB - Android Testing Setup
|
||||
|
||||
Acest script configureaza conexiunea ADB Wireless pentru testare pe Android.
|
||||
|
||||
Usage:
|
||||
.\android-test-setup.ps1
|
||||
|
||||
Prerequisites:
|
||||
- ADB instalat (winget install Google.PlatformTools)
|
||||
- Telefon Android cu Wireless Debugging activat
|
||||
- Telefon si calculator in aceeasi retea WiFi
|
||||
|
||||
"@
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Colors
|
||||
function Write-Header($message) {
|
||||
Write-Host "`n================================" -ForegroundColor Blue
|
||||
Write-Host $message -ForegroundColor Blue
|
||||
Write-Host "================================`n" -ForegroundColor Blue
|
||||
}
|
||||
|
||||
function Write-Success($message) {
|
||||
Write-Host "[OK] $message" -ForegroundColor Green
|
||||
}
|
||||
|
||||
function Write-Error($message) {
|
||||
Write-Host "[ERROR] $message" -ForegroundColor Red
|
||||
}
|
||||
|
||||
function Write-Warning($message) {
|
||||
Write-Host "[WARN] $message" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
function Write-Info($message) {
|
||||
Write-Host "[INFO] $message" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
# Check ADB is installed
|
||||
function Check-ADB {
|
||||
Write-Header "Verificare ADB (Android Debug Bridge)"
|
||||
|
||||
$adb = Get-Command adb -ErrorAction SilentlyContinue
|
||||
if (-not $adb) {
|
||||
Write-Error "ADB nu este instalat sau nu este in PATH!"
|
||||
Write-Host ""
|
||||
Write-Info "Pentru a instala ADB:"
|
||||
Write-Host " winget install Google.PlatformTools"
|
||||
Write-Host ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Success "ADB este instalat"
|
||||
adb version | Select-Object -First 1
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Check device connection
|
||||
function Check-Device {
|
||||
Write-Header "Verificare Conexiune Telefon"
|
||||
|
||||
$devices = adb devices | Select-String "device$" | Measure-Object | Select-Object -ExpandProperty Count
|
||||
|
||||
if ($devices -eq 0) {
|
||||
Write-Error "Niciun telefon Android conectat!"
|
||||
Write-Host ""
|
||||
Write-Info "Pasi de conectare ADB Wireless:"
|
||||
Write-Host " 1. Pe telefon: Setari → Developer options → Wireless debugging → ON"
|
||||
Write-Host " 2. Apasa pe 'Wireless debugging' → 'Pair device with pairing code'"
|
||||
Write-Host " 3. In PowerShell: adb pair IP:PORT"
|
||||
Write-Host " 4. Introdu codul de pe telefon"
|
||||
Write-Host " 5. In PowerShell: adb connect IP:PORT_WIRELESS"
|
||||
Write-Host ""
|
||||
Write-Info "Dispozitive detectate:"
|
||||
adb devices
|
||||
Write-Host ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Success "Telefon Android conectat: $devices dispozitiv(e)"
|
||||
adb devices | Select-String "device$"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Setup port forwarding for Chrome DevTools
|
||||
function Setup-ChromeDevTools {
|
||||
Write-Header "Configurare Chrome DevTools Port Forwarding"
|
||||
|
||||
# Remove existing forwarding
|
||||
adb forward --remove-all | Out-Null
|
||||
|
||||
# Setup new forwarding
|
||||
adb forward tcp:9222 localabstract:chrome_devtools_remote | Out-Null
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Success "Port forwarding configurat: localhost:9222 -> Chrome pe telefon"
|
||||
} else {
|
||||
Write-Error "Eroare la configurarea port forwarding!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Verify forwarding
|
||||
Write-Info "Port forwarding activ:"
|
||||
adb forward --list
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Setup reverse port forwarding for app access
|
||||
function Setup-AppAccess {
|
||||
Write-Header "Configurare Acces la Aplicatie de pe Telefon"
|
||||
|
||||
# Remove existing reverse forwarding
|
||||
adb reverse --remove-all 2>$null | Out-Null
|
||||
|
||||
# Setup reverse forwarding for frontend and backend
|
||||
adb reverse tcp:3000 tcp:3000 | Out-Null
|
||||
adb reverse tcp:8001 tcp:8001 | Out-Null
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Success "Reverse port forwarding configurat"
|
||||
Write-Info "Pe telefon poti accesa:"
|
||||
Write-Host " Frontend: http://localhost:3000"
|
||||
Write-Host " Backend: http://localhost:8001/api"
|
||||
} else {
|
||||
Write-Warning "Reverse port forwarding a esuat (optional)"
|
||||
Write-Info "Alternativ, foloseste IP-ul calculatorului:"
|
||||
$localIP = (Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias "Wi-Fi*","Ethernet*" | Select-Object -First 1).IPAddress
|
||||
Write-Host " Frontend: http://${localIP}:3000"
|
||||
Write-Host " Backend: http://${localIP}:8001/api"
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Test Chrome DevTools connection
|
||||
function Test-ChromeConnection {
|
||||
Write-Header "Testare Conexiune Chrome DevTools"
|
||||
|
||||
Write-Info "Asigura-te ca Chrome este deschis pe telefon!"
|
||||
Write-Host ""
|
||||
Read-Host "Apasa Enter cand Chrome este deschis pe telefon"
|
||||
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:9222/json/version" -ErrorAction Stop
|
||||
Write-Success "Conexiune reusita la Chrome pe telefon!"
|
||||
Write-Host ""
|
||||
Write-Info "Detalii Chrome:"
|
||||
$response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 10
|
||||
} catch {
|
||||
Write-Error "Nu se poate conecta la Chrome pe telefon!"
|
||||
Write-Host ""
|
||||
Write-Info "Verifica ca:"
|
||||
Write-Host " 1. Chrome este deschis pe telefon"
|
||||
Write-Host " 2. Port forwarding este activ: adb forward --list"
|
||||
Write-Host " 3. Wireless debugging este activat"
|
||||
Write-Host ""
|
||||
Write-Info "Pentru debugging manual:"
|
||||
Write-Host " Invoke-WebRequest http://localhost:9222/json/version"
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Display network info
|
||||
function Display-NetworkInfo {
|
||||
Write-Header "Informatii Retea pentru Acces Remote"
|
||||
|
||||
$localIP = (Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias "Wi-Fi*","Ethernet*" | Select-Object -First 1).IPAddress
|
||||
|
||||
Write-Info "IP-ul calculatorului: $localIP"
|
||||
Write-Host ""
|
||||
Write-Info "Pentru acces de pe telefon (daca reverse port forwarding nu functioneaza):"
|
||||
Write-Host " Frontend: http://${localIP}:3000"
|
||||
Write-Host " Backend: http://${localIP}:8001/api"
|
||||
Write-Host ""
|
||||
Write-Warning "Asigura-te ca telefonul si calculatorul sunt in aceeasi retea WiFi!"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Display MCP configuration
|
||||
function Display-MCPConfig {
|
||||
Write-Header "Configurare Chrome DevTools MCP pentru Claude Code"
|
||||
|
||||
Write-Info "Instalare chrome-devtools-mcp:"
|
||||
Write-Host " npm install -g chrome-devtools-mcp"
|
||||
Write-Host ""
|
||||
|
||||
Write-Info "Configurare in Claude Desktop (claude_desktop_config.json):"
|
||||
Write-Host ""
|
||||
Write-Host @'
|
||||
{
|
||||
"mcpServers": {
|
||||
"chrome-devtools": {
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"chrome-devtools-mcp",
|
||||
"--browser-url",
|
||||
"http://localhost:9222"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
'@
|
||||
Write-Host ""
|
||||
Write-Warning "Dupa configurare, restart Claude Desktop!"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Display useful commands
|
||||
function Display-UsefulCommands {
|
||||
Write-Header "Comenzi Utile"
|
||||
|
||||
Write-Host "Verificare dispozitive:"
|
||||
Write-Host " adb devices"
|
||||
Write-Host ""
|
||||
Write-Host "Restart ADB server:"
|
||||
Write-Host " adb kill-server; adb start-server"
|
||||
Write-Host ""
|
||||
Write-Host "Screenshot de pe telefon:"
|
||||
Write-Host " adb shell screencap -p /sdcard/screenshot.png"
|
||||
Write-Host " adb pull /sdcard/screenshot.png .\screenshot.png"
|
||||
Write-Host ""
|
||||
Write-Host "Verificare Chrome DevTools:"
|
||||
Write-Host " Invoke-WebRequest http://localhost:9222/json/version"
|
||||
Write-Host ""
|
||||
Write-Host "Deschide Chrome DevTools in browser:"
|
||||
Write-Host " Start-Process chrome://inspect#devices"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Main
|
||||
function Main {
|
||||
Clear-Host
|
||||
Write-Header " ROA2WEB - Android Testing Setup"
|
||||
|
||||
Check-ADB
|
||||
Check-Device
|
||||
Setup-ChromeDevTools
|
||||
Setup-AppAccess
|
||||
Test-ChromeConnection
|
||||
Display-NetworkInfo
|
||||
Display-MCPConfig
|
||||
Display-UsefulCommands
|
||||
|
||||
Write-Header "[OK] Setup Complet!"
|
||||
|
||||
Write-Success "Telefonul Android este configurat pentru testare!"
|
||||
Write-Host ""
|
||||
Write-Info "Next steps:"
|
||||
Write-Host " 1. Deschide Chrome pe telefon"
|
||||
Write-Host " 2. Navigheaza la aplicatia ROA2WEB (vezi IP-ul de mai sus)"
|
||||
Write-Host " 3. In Claude Code, cere: 'Fa un screenshot al aplicatiei de pe telefonul meu Android'"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Run main
|
||||
Main
|
||||
Reference in New Issue
Block a user