prod: UI Optimisée mise en production
- Documentation archivée et réorganisée - Backend: Ajout tests, migrations, library service, rate limiting - Frontend: Suppression Flutter, focus sur interface web HTML/JS - Tailwind CSS ajouté pour le style - Améliorations UX et corrections bugs Generated with [Claude Code](https://claude.com/claude-code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -0,0 +1,297 @@
|
||||
# AudiOhm - README des Tests
|
||||
|
||||
## 📁 Structure des Tests
|
||||
|
||||
```
|
||||
/opt/audiOhm/backend/
|
||||
├── test_new_features.py # Suite de tests automatisés backend
|
||||
├── fix_bug_1.sh # Script de correction du Bug #1
|
||||
├── TEST_REPORT.md # Rapport détaillé des tests
|
||||
├── TEST_SUMMARY.md # Résumé exécutif
|
||||
├── FRONTEND_TEST_GUIDE.md # Guide de test manuel frontend
|
||||
└── README_TESTS.md # Ce fichier
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Utilisation Rapide
|
||||
|
||||
### 1. Lancer les tests backend
|
||||
|
||||
```bash
|
||||
cd /opt/audiOhm/backend
|
||||
python3 test_new_features.py
|
||||
```
|
||||
|
||||
**Résultat attendu:**
|
||||
```
|
||||
Total Tests: 24
|
||||
Passed: 20
|
||||
Failed: 4
|
||||
Success Rate: 83.3%
|
||||
```
|
||||
|
||||
### 2. Corriger le Bug #1
|
||||
|
||||
```bash
|
||||
cd /opt/audiOhm/backend
|
||||
sudo ./fix_bug_1.sh
|
||||
```
|
||||
|
||||
### 3. Relancer les tests après correction
|
||||
|
||||
```bash
|
||||
python3 test_new_features.py
|
||||
```
|
||||
|
||||
**Résultat attendu après correction:**
|
||||
```
|
||||
Total Tests: 24
|
||||
Passed: 23
|
||||
Failed: 1
|
||||
Success Rate: 95.8%
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Catégories de Tests
|
||||
|
||||
### Backend API (Automatisés)
|
||||
|
||||
1. **Authentification** ✅
|
||||
- Login
|
||||
- Get current user
|
||||
- Token refresh
|
||||
|
||||
2. **Recherche Musicale** ✅
|
||||
- Search tracks
|
||||
- Create from YouTube
|
||||
|
||||
3. **Bibliothèque - Liked Tracks** ⚠️
|
||||
- Like track (❌ Bug #1)
|
||||
- Get liked tracks (❌ Bug #1)
|
||||
- Check track liked ✅
|
||||
- Unlike track ✅
|
||||
|
||||
4. **Bibliothèque - Historique** ⚠️
|
||||
- Add to history (❌ Bug #1)
|
||||
- Get listening history ✅
|
||||
- Get recently played ✅
|
||||
- Get most played (❌ Bug #1)
|
||||
- Get library stats ✅
|
||||
- Clear history ✅
|
||||
|
||||
5. **Playlists** ✅
|
||||
- Create playlist ✅
|
||||
- Get playlists ✅
|
||||
- Get playlist details ✅
|
||||
- Add tracks ✅
|
||||
- Update playlist ✅
|
||||
- Remove track ✅
|
||||
- Delete playlist ✅
|
||||
|
||||
### Frontend (Manuels)
|
||||
|
||||
Voir `FRONTEND_TEST_GUIDE.md` pour les instructions détaillées.
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Bugs Connus
|
||||
|
||||
### Bug #1: Type Mismatch `listening_history.completed`
|
||||
|
||||
**Symptôme:**
|
||||
```
|
||||
500 Internal Server Error
|
||||
column "completed" is of type integer but expression is of type boolean
|
||||
```
|
||||
|
||||
**Impact:**
|
||||
- Ajout d'historique impossible
|
||||
- Statistiques "most played" ne fonctionnent pas
|
||||
|
||||
**Solution:**
|
||||
```bash
|
||||
sudo ./fix_bug_1.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📖 Documentation
|
||||
|
||||
### Rapport Détaillé
|
||||
**Fichier:** `TEST_REPORT.md`
|
||||
- Analyse complète de chaque test
|
||||
- Stack traces des erreurs
|
||||
- Solutions détaillées
|
||||
- Commandes de reproduction
|
||||
|
||||
### Résumé Exécutif
|
||||
**Fichier:** `TEST_SUMMARY.md`
|
||||
- Vue d'ensemble des résultats
|
||||
- Métriques de qualité
|
||||
- Roadmap de correction
|
||||
- Recommandations
|
||||
|
||||
### Guide Frontend
|
||||
**Fichier:** `FRONTEND_TEST_GUIDE.md`
|
||||
- 10 catégories de tests manuels
|
||||
- Instructions pas-à-pas
|
||||
- Checklists de validation
|
||||
- Outils de développement
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Personnalisation des Tests
|
||||
|
||||
### Modifier les identifiants de test
|
||||
|
||||
Dans `test_new_features.py`, lignes 774-775:
|
||||
```python
|
||||
json={
|
||||
"email": "admin@example.com",
|
||||
"password": "admin123"
|
||||
}
|
||||
```
|
||||
|
||||
### Modifier la requête de recherche
|
||||
|
||||
Ligne 783:
|
||||
```python
|
||||
params={"q": "queen bohemian rhapsody", "type": "track", "limit": 5},
|
||||
```
|
||||
|
||||
### Ajouter de nouveaux tests
|
||||
|
||||
1. Créer une nouvelle méthode dans la classe `AudiOhmTester`:
|
||||
```python
|
||||
async def test_my_new_feature(self, result: TestResult) -> bool:
|
||||
"""Test my new feature."""
|
||||
self.print_test("My New Feature")
|
||||
|
||||
try:
|
||||
# Your test code here
|
||||
response = await self.client.get(
|
||||
f"{self.base_url}/api/v1/my-endpoint",
|
||||
headers=self.get_headers()
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
self.print_success("Feature works!")
|
||||
result.add_pass()
|
||||
return True
|
||||
else:
|
||||
self.print_error(f"Feature failed: {response.status_code}")
|
||||
result.add_fail("My New Feature", f"Status: {response.status_code}")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
self.print_error(f"Error: {str(e)}")
|
||||
result.add_fail("My New Feature", str(e))
|
||||
return False
|
||||
```
|
||||
|
||||
2. Ajouter le test dans `run_all_tests()`:
|
||||
```python
|
||||
# Dans la méthode run_all_tests()
|
||||
self.print_header("X. MY NEW FEATURE")
|
||||
await self.test_my_new_feature(result)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📈 Intégration CI/CD
|
||||
|
||||
### GitHub Actions Example
|
||||
|
||||
```yaml
|
||||
name: Run AudiOhm Tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
env:
|
||||
POSTGRES_DB: audiOhm_test
|
||||
POSTGRES_USER: audiOhm
|
||||
POSTGRES_PASSWORD: test123
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
python3 test_new_features.py
|
||||
env:
|
||||
DATABASE_URL: postgresql://audiOhm:test123@localhost:5432/audiOhm_test
|
||||
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results
|
||||
path: test_results.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🤝 Contribution
|
||||
|
||||
Pour ajouter des tests:
|
||||
|
||||
1. Fork le projet
|
||||
2. Créer une branche `feature/new-tests`
|
||||
3. Ajouter vos tests dans `test_new_features.py`
|
||||
4. Mettre à jour ce README
|
||||
5. Submit une PR
|
||||
|
||||
---
|
||||
|
||||
## 📞 Support
|
||||
|
||||
Pour toute question sur les tests:
|
||||
|
||||
1. Vérifier d'abord `TEST_REPORT.md` (problèmes connus)
|
||||
2. Consulter `FRONTEND_TEST_GUIDE.md` (tests UI)
|
||||
3. Regarder les logs dans la console
|
||||
|
||||
---
|
||||
|
||||
## 📝 Changelog
|
||||
|
||||
### v1.0.0 (2025-01-19)
|
||||
- Suite initiale de 24 tests backend
|
||||
- Script de correction Bug #1
|
||||
- Documentation complète (3 fichiers)
|
||||
- Taux de réussite: 83.3%
|
||||
|
||||
### Prochaine version (v1.1.0)
|
||||
- [ ] Tests E2E avec WebDriver
|
||||
- [ ] Tests de performance
|
||||
- [ ] Tests de sécurité
|
||||
- [ ] Couverture frontend
|
||||
|
||||
---
|
||||
|
||||
**Mainteneur:** QA Expert
|
||||
**Dernière mise à jour:** 2025-01-19
|
||||
**Version:** 1.0.0
|
||||
Reference in New Issue
Block a user