Skip to content

Latest commit

 

History

History
138 lines (110 loc) · 3.51 KB

File metadata and controls

138 lines (110 loc) · 3.51 KB

PHASE 7: Testing & Quality Assurance

7.1 Backend API Testing with Postman

Create a Postman collection with these requests:

📁 CivicStreak API Collection

📁 Auth
  POST /api/auth/register
    Body: { "email": "test@example.com", "password": "test123", "full_name": "Test User" }
  
  POST /api/auth/login
    Body: { "email": "test@example.com", "password": "test123" }
  
  GET /api/auth/me
    Headers: Authorization: Bearer <token>

📁 Tasks
  GET /api/tasks
    Headers: Authorization: Bearer <token>
    
  GET /api/tasks/today
    Headers: Authorization: Bearer <token>
    
  POST /api/tasks/:id/accept
    Headers: Authorization: Bearer <token>
    
  POST /api/tasks/:id/submit
    Headers: Authorization: Bearer <token>
    Body: form-data { proof_text: "Completed!", proof: <file> }

📁 Issues
  GET /api/issues
  GET /api/issues/:id
  POST /api/issues
    Body: form-data { title, description, category, address }
  POST /api/issues/:id/upvote

📁 Circles
  GET /api/circles
  POST /api/circles
    Body: { "name": "Andheri Green Squad", "ward_id": "..." }
  POST /api/circles/:id/join

📁 Wards
  GET /api/wards
  GET /api/wards/:id/dashboard
  GET /api/wards/leaderboard/global

📁 Portfolio
  GET /api/portfolio/:userId

📁 AI
  GET /api/ai/suggest-tasks
  GET /api/ai/ward-quiz/:wardId
  POST /api/ai/analyze-issue
    Body: { "description": "Broken road on SV Road", "category": "Infrastructure" }

📁 WhatsApp
  GET /api/whatsapp/webhook (health check)

7.2 Testing Checklist

✅ AUTHENTICATION
  □ User can register with email/password
  □ User can login with correct credentials
  □ Invalid credentials are rejected
  □ Protected routes require authentication
  □ Token expiry is handled

✅ MICRO-TASKS
  □ Available tasks are fetched correctly
  □ Tasks can be filtered by category, difficulty, time
  □ User can accept a task
  □ User cannot accept already accepted task
  □ Photo upload works for proof
  □ Text submission works for proof
  □ XP is awarded on completion
  □ Task completion count increments

✅ STREAKS
  □ Streak increments on consecutive day activity
  □ Streak resets after missing a day
  □ Daily streak bonus XP is awarded
  □ Level updates correctly based on streak
  □ Longest streak is tracked

✅ CIVIC ISSUES
  □ Issues can be created with photos
  □ Issues list is filterable by ward/status
  □ Timeline updates can be added
  □ Upvoting works
  □ AI analysis returns meaningful response

✅ CIRCLES
  □ Circles can be created
  □ Users can join circles (respects max capacity)
  □ Cannot join same circle twice
  □ Circle member list displays correctly

✅ WARD DASHBOARD
  □ Dashboard loads with correct stats
  □ Ward selector works
  □ Leaderboard shows ranked users
  □ Issue status breakdown is accurate

✅ PORTFOLIO
  □ Portfolio page loads for any user
  □ Activity heatmap renders correctly
  □ Skills are calculated properly
  □ AI summary generates
  □ Certificate downloads
  □ Share functionality works

✅ WHATSAPP BOT
  □ Bot responds to "hi" with daily brief
  □ "1" sends today's task
  □ "2" sends portfolio summary
  □ "3" sends circle update
  □ "4" sends learning content
  □ "help" sends command list
  □ Unregistered numbers get welcome message
  □ Task submissions via WhatsApp work

✅ AI FEATURES
  □ Task suggestions return valid JSON
  □ Ward quiz generates correct format
  □ Issue analysis provides actionable info
  □ Portfolio summary is coherent