# 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