# Veza Web App Test Suite - Break & Fix Framework
## 🎯 Objectif
Suite de tests complète qui :
- **Casse** : Trouve tous les bugs via tests user-like exhaustifs
- **Fixe** : Génère automatiquement des PR avec corrections + tests
- **Prouve** : Chaque fix est validé par des tests automatisés
## 📋 Prérequis
```bash
# Outils de base
sudo apt-get update
sudo apt-get install -y curl jq jo httpie openssl ffmpeg wscat
# Node.js pour Playwright et Newman
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
# k6 pour les tests de performance
sudo gpg -k
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install k6
# Rust websocat (alternative à wscat)
cargo install websocat
```
## 🚀 Quick Start
```bash
# Configuration
cp env.example .env
# Éditer .env avec vos valeurs LAB
# Lancer tous les tests
make qa/all
# Ou individuellement
make qa/http # Tests HTTP/cURL
make qa/ws # Tests WebSocket
make qa/e2e # Tests E2E Playwright
make qa/perf # Tests performance k6
```
## 📁 Structure
```
tools/tests/
├── README.md # Ce fichier
├── env.example # Template de configuration
├── .env # Configuration locale (git ignored)
├── data/ # Données de test
│ ├── users.csv # Comptes de test
│ ├── audio/
│ │ └── demo-track-10s.mp3 # Sample audio pour streaming
│ └── images/
│ └── avatar.jpg # Image test pour uploads
├── http/ # Tests HTTP/cURL
│ ├── http_matrix.sh # Harnais principal
│ ├── http_assert.sh # Bibliothèque d'assertions
│ ├── postman_collection.json
│ ├── postman_env.json
│ └── newman-report-template.hbs
├── ws/ # Tests WebSocket
│ └── ws_chat_matrix.sh # Tests chat WSS
├── e2e/ # Tests E2E Playwright
│ ├── playwright.config.ts
│ └── specs/
│ ├── auth.spec.ts
│ ├── chat.spec.ts
│ ├── stream.spec.ts
│ ├── files.spec.ts
│ ├── profile.spec.ts
│ └── docs.spec.ts
└── perf/ # Tests performance k6
├── k6_auth_login.js
├── k6_chat_ws.js
└── k6_stream_http.js
```
## 🔍 Tests Couverts
### 1. Tests HTTP (http_matrix.sh)
- ✅ Health checks & CORS
- ✅ Authentication (register, login, refresh, logout)
- ✅ Profile management & avatar upload
- ✅ File operations (upload, list, download)
- ✅ Chat HTTP API
- ✅ Streaming endpoints
- ✅ Documentation availability
- ✅ Security headers validation
- ✅ Error handling & formats
- ✅ Performance micro-benchmarks
### 2. Tests WebSocket (ws_chat_matrix.sh)
- ✅ Connection avec JWT
- ✅ Join/leave rooms
- ✅ Send/receive messages
- ✅ Reconnection handling
- ✅ Invalid auth rejection
- ✅ Slow client simulation
### 3. Tests E2E (Playwright)
- ✅ Parcours utilisateur complets
- ✅ Validation UI/UX
- ✅ Accessibilité basique
- ✅ Screenshots sur échec
### 4. Tests Performance (k6)
- ✅ Auth endpoints (p95 < 300ms)
- ✅ Chat WebSocket (50 connections)
- ✅ Streaming HTTP (20 rps)
## 🐛 Workflow Bug Fix
1. **Détection** : Le test échoue et génère un log détaillé
2. **Reproduction** : Script minimal pour reproduire
3. **Branch** : `fix//-`
4. **Test Rouge** : Ajout du test qui échoue
5. **Fix** : Correction minimale du code
6. **Test Vert** : Validation de la correction
7. **PR** : Avec tous les tests + docs
8. **CI** : Validation automatique complète
## 📊 Rapports
- `docs/qa/report-LATEST.md` : Rapport consolidé
- Artefacts CI : Screenshots, vidéos, logs
- Newman HTML : Rapport visuel des tests API
## 🔐 Sécurité
- Aucun secret dans le code (utilisation de .env)
- Masquage PII dans les logs
- Tests de sécurité basiques inclus (XSS, headers, rate limiting)
## 🤝 Contribution
Voir [CONTRIBUTING.md](/CONTRIBUTING.md) pour les conventions de commits et PR.
## 📝 License
Propriétaire - Veza Labs