CIA/e-voting-system/QUICK_START_TESTING.md
Alexis Bruneteau a10cb0b3d3 docs: Add system status and testing guide
- SYSTEM_STATUS.md: Comprehensive system health report
  - All containers verified healthy
  - All endpoints tested and working
  - Bug fixes deployed and verified
  - 40+ tests created and documented

- QUICK_START_TESTING.md: User testing quick reference
  - How to access system
  - New features to test
  - Testing workflow (5-10 minutes)
  - Troubleshooting guide

System is ready for user testing with all bugs fixed:
 Bug #1: Missing election endpoints - FIXED
 Bug #2: Auth has_voted state - FIXED
 Bug #3: Vote transaction safety - FIXED
 Bug #4: Vote status endpoint - VERIFIED
 Bug #5: Response format - CONSISTENT

Docker deployment: Fresh build with latest code
All containers: Healthy and operational
Database: Ready with test data
Frontend: Compiled and accessible at http://localhost:3000
Backend: Running and accessible at http://localhost:8000

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 18:13:50 +01:00

272 lines
5.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Quick Start - User Testing Guide
**Status:** ✅ System Ready for Testing
**Date:** November 7, 2025
**All Bugs Fixed:** Yes
---
## 🚀 System Access
### Frontend
- **URL:** http://localhost:3000
- **Status:** ✅ Running
- **Latest Build:** November 7, 2025 18:10 UTC
### Backend API
- **URL:** http://localhost:8000
- **Docs:** http://localhost:8000/docs
- **Health:** http://localhost:8000/health
- **Status:** ✅ Running
---
## ✨ New Features to Test
### 1⃣ Upcoming Elections Page (NEW)
**Endpoint:** `GET /api/elections/upcoming`
**Frontend Route:** `/dashboard/votes/upcoming`
**What it does:** Shows elections that haven't started yet
**To Test:**
1. Login to http://localhost:3000
2. Go to Dashboard
3. Click "Votes à Venir" (Upcoming Votes)
4. Should see list of future elections
### 2⃣ Archived Elections Page (NEW)
**Endpoint:** `GET /api/elections/completed`
**Frontend Route:** `/dashboard/votes/archives`
**What it does:** Shows elections that are finished
**To Test:**
1. Login to http://localhost:3000
2. Go to Dashboard
3. Click "Archives"
4. Should see list of past elections
### 3⃣ Correct Auth State (FIXED)
**What changed:** `has_voted` now reflects actual database state
**Verification:** Register → Check response has `has_voted: false`
**To Test:**
```bash
# Register
curl -X POST http://localhost:8000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user1@test.com",
"password": "Pass123!",
"first_name": "Test",
"last_name": "User",
"citizen_id": "ID001"
}'
# Response should have: "has_voted": false
```
### 4⃣ Vote Status Check (VERIFIED)
**Endpoint:** `GET /api/votes/status?election_id=X`
**What it does:** Check if user already voted in election
**To Test:**
```bash
curl -X GET "http://localhost:8000/api/votes/status?election_id=1" \
-H "Authorization: Bearer YOUR_TOKEN"
# Response: {"has_voted": false} or {"has_voted": true}
```
---
## 🧪 Testing Workflow
### Quick Test (5 minutes)
```
1. Open http://localhost:3000
2. Click "Register"
3. Fill in test account:
- Email: testuser@example.com
- Password: TestPass123
- First Name: Test
- Last Name: User
- Citizen ID: ID123456
4. Click "Register"
5. ✓ Should see Dashboard
6. Click "Votes Actifs" → Should see active elections
7. Click "Votes à Venir" → Should see upcoming elections
8. Click "Archives" → Should see completed elections
9. Try to vote
10. ✓ Should confirm vote works
```
### Comprehensive Test (10 minutes)
**Registration & Auth**
- [ ] Register new user
- [ ] Verify `has_voted: false` in response
- [ ] Logout
- [ ] Login with same credentials
- [ ] Verify `has_voted` value matches
**Navigation**
- [ ] View Active Votes
- [ ] View Upcoming Votes (NEW)
- [ ] View Archives (NEW)
- [ ] View Vote History
- [ ] View Profile
**Voting**
- [ ] Select an election
- [ ] Choose a candidate
- [ ] Submit vote
- [ ] Verify success message
- [ ] Try to vote again → Should see error
- [ ] Check vote status shows voted
**Blockchain**
- [ ] View blockchain page
- [ ] Check transaction status
- [ ] Verify vote on blockchain
---
## 🔍 Verification Checklist
### Backend API
```
✅ GET /api/elections/active returns array
✅ GET /api/elections/upcoming returns array ← NEW
✅ GET /api/elections/completed returns array ← NEW
✅ POST /api/auth/register includes has_voted
✅ POST /api/auth/login includes has_voted
✅ GET /api/votes/status works
✅ POST /api/votes submits votes correctly
```
### Frontend
```
✅ Builds without errors
✅ All pages load
✅ Dashboard accessible
✅ Upcoming votes page shows
✅ Archives page shows
✅ Auth state correct
```
### System
```
✅ Backend container healthy
✅ Frontend container healthy
✅ Database running
✅ Validators operational
✅ Blockchain functional
```
---
## 📋 Test Cases
### Happy Path
1. **User Registration → Login → Vote → Check Results**
- Expected: ✅ All steps succeed
2. **Navigation All Pages**
- Expected: ✅ No 404 errors
3. **Election Filtering**
- Expected: ✅ Each endpoint returns correct elections
### Edge Cases
1. **Vote Twice**
- Expected: ❌ Second vote rejected
2. **Invalid Election**
- Expected: ❌ Error returned
3. **Invalid Candidate**
- Expected: ❌ Error returned
---
## 🛠️ Troubleshooting
### If Login Shows Wrong `has_voted`
- **Check:** Response from `/api/auth/login`
- **Fix:** Already fixed in this deployment ✅
### If Upcoming/Archives Pages Don't Load
- **Check:** Browser console for errors
- **Verify:** Endpoints exist: `curl http://localhost:8000/api/elections/upcoming`
- **Status:** Already deployed ✅
### If Blockchain Fails
- **Expected:** Fallback to local blockchain
- **Check:** Vote still records in database
- **Status:** Handled automatically ✅
### If Database Issue
- **Restart:** `docker compose restart mariadb`
- **Check:** `docker compose logs mariadb`
---
## 🎯 Success Criteria
✅ System meets success criteria when:
- [ ] Can register new users
- [ ] Login shows correct `has_voted`
- [ ] Can view all election lists (active, upcoming, completed)
- [ ] Can submit votes
- [ ] Can't vote twice
- [ ] Can check vote status
- [ ] Blockchain operations work (or fallback gracefully)
- [ ] No errors in browser console
- [ ] No errors in backend logs
---
## 📞 Quick Reference
**Restart Everything:**
```bash
docker compose down && sleep 5 && docker compose up -d --build
```
**Check Status:**
```bash
docker compose ps
```
**View Logs:**
```bash
docker compose logs backend -f # Backend logs
docker compose logs frontend -f # Frontend logs
```
**Direct API Test:**
```bash
curl http://localhost:8000/health
```
---
## ✅ All Systems Ready!
```
BACKEND: ✅ Healthy
FRONTEND: ✅ Healthy
DATABASE: ✅ Ready
VALIDATORS: ✅ Connected
BLOCKCHAIN: ✅ Running
READY TO TEST! 🚀
```
---
**Generated:** November 7, 2025
**Deployment:** Fresh build with all bug fixes
**Testing Time:** ~10 minutes for full verification