# Manual Testing Checklist for RateRight

## Test Environment Setup
- [ ] Local development server running (`python run.py`)
- [ ] Database initialized with test data
- [ ] Email/SMS testing disabled or configured for test environment
- [ ] Test user accounts created (contractor + worker)

---

## Rating System Testing

### Basic Rating Functionality
- [ ] Submit rating with all 5 stars
- [ ] Submit rating with mixed scores (e.g., 4,5,3,5)
- [ ] Submit rating with minimum scores (all 1s)
- [ ] Add comment to rating
- [ ] Check "would work again" option
- [ ] Leave "would work again" unchecked

### Rating Validation
- [ ] Try to rate twice (should fail with message)
- [ ] Try to rate as non-party to contract (should fail)
- [ ] Try to submit rating without required fields
- [ ] Try to submit rating with invalid scores (0 or 6)

### Rating Display
- [ ] Check average rating updates on worker profile
- [ ] Verify rating appears in contract history
- [ ] Check rating statistics (star breakdown)
- [ ] Verify recent ratings show on profile

### Rating Workflow
- [ ] Rate from contractor dashboard
- [ ] Rate from contract closeout page
- [ ] Rate from direct contract link
- [ ] Navigate back after rating submission

---

## Gamification System Testing

### Point Awarding
- [ ] Complete action and verify points awarded
- [ ] Check point total updates in real-time
- [ ] Verify point history shows activities
- [ ] Check different activity types award correct points

### Level Progression
- [ ] Start at level 1 with 0 points
- [ ] Earn enough points to reach level 2 (100 points)
- [ ] Verify level increases at correct thresholds
- [ ] Check level badge/indicator updates

### Leaderboards
- [ ] Check weekly leaderboard updates after earning points
- [ ] Verify monthly leaderboard includes recent activities
- [ ] Check all-time leaderboard ranking
- [ ] Verify league-specific leaderboards (Bronze, Silver, Gold)
- [ ] Check leaderboard resets weekly on Monday

### Achievements
- [ ] Unlock "First Job" achievement when completing first contract
- [ ] Check achievement notification appears
- [ ] Verify achievement shows on profile
- [ ] Check achievement progress tracking

### League System
- [ ] Start in Bronze league
- [ ] Earn points to qualify for Silver league promotion
- [ ] Check league badge updates
- [ ] Verify league-specific leaderboard placement

---

## Notification System Testing

### Email Notifications
- [ ] New message triggers email
- [ ] Rating received sends email notification
- [ ] Job match found sends email
- [ ] Payment received triggers email
- [ ] Email template renders correctly with variables

### SMS Notifications
- [ ] Job match sends SMS (if enabled)
- [ ] Urgent notifications send SMS
- [ ] SMS content is concise and clear
- [ ] Phone number validation works

### Push Notifications
- [ ] Browser push notifications work (if implemented)
- [ ] Notifications show proper title and message
- [ ] Click on notification navigates correctly

### Notification Preferences
- [ ] Can disable email notifications in settings
- [ ] Can disable SMS notifications
- [ ] Can set notification frequency (immediate/daily/weekly)
- [ ] Quiet hours setting respected (no notifications 10PM-8AM)
- [ ] Unsubscribe link in emails works

### Notification Management
- [ ] View notification history in app
- [ ] Mark notifications as read
- [ ] Bulk mark all as read
- [ ] Delete old notifications
- [ ] Notification count badge updates

### Batch Notifications
- [ ] System maintenance notifications sent to all users
- [ ] Bulk job match notifications work
- [ ] Newsletter/announcement notifications

---

## Messaging System Testing

### Basic Messaging
- [ ] Send message between contractor and worker
- [ ] Message appears in recipient's inbox immediately
- [ ] Send message with special characters/emojis
- [ ] Send long message (test character limits)

### Message Status
- [ ] Message shows as "sent" after sending
- [ ] Message shows as "delivered" when recipient comes online
- [ ] Message shows as "read" after recipient opens it
- [ ] Read timestamps are accurate

### Conversation Management
- [ ] Messages group correctly into conversations
- [ ] Conversation list shows most recent message
- [ ] Unread count badge shows correctly
- [ ] Mark entire conversation as read
- [ ] Delete messages (soft delete)

### Real-time Updates
- [ ] Messages appear instantly (5-second polling)
- [ ] Unread count updates in real-time
- [ ] Conversation list updates when new message arrives
- [ ] Read status updates without refresh

### Message Search
- [ ] Search messages by keyword
- [ ] Search results highlight matching text
- [ ] Search across all conversations
- [ ] Filter messages by user/date

### Message Validation
- [ ] Empty messages are rejected
- [ ] Very long messages are truncated or rejected
- [ ] HTML/script tags are sanitized
- [ ] Profanity filter works (if implemented)

---

## Integration Testing

### Complete Job Workflow
- [ ] Contractor posts job
- [ ] Worker applies for job
- [ ] Contractor accepts application
- [ ] Contract is created and both parties sign
- [ ] Work is completed and marked complete
- [ ] Rating is submitted → triggers points + notification + message
- [ ] All systems update correctly (points, level, average rating, notifications)

### Cross-System Triggers
- [ ] Rating submission triggers:
  - [ ] Points awarded to rated user
  - [ ] Notification sent to rated user
  - [ ] Average rating updated
  - [ ] Level progression checked
  - [ ] Leaderboard updated
- [ ] Contract completion triggers:
  - [ ] Completion points awarded
  - [ ] Achievement checks run
  - [ ] Notification sent to both parties
  - [ ] Status updates correctly

### User Journey Testing
- [ ] New user registration → profile completion points
- [ ] First job posting → first job achievement
- [ ] First application → engagement points
- [ ] First rating → rating milestone achievement
- [ ] Level progression → promotion notification

---

## Performance Testing

### Load Testing
- [ ] Submit 50 ratings quickly (no deadlocks/errors)
- [ ] Send 100 messages rapidly (all delivered)
- [ ] Generate leaderboard with 1000+ users
- [ ] Bulk send notifications to 500+ users

### Database Performance
- [ ] Message search is fast with 10,000+ messages
- [ ] Leaderboard generation is quick
- [ ] Rating calculations are efficient
- [ ] No N+1 query problems

### Browser Performance
- [ ] Page loads are under 2 seconds
- [ ] Message polling doesn't slow down browser
- [ ] Large conversation loads quickly
- [ ] No memory leaks in JavaScript

---

## Error Handling Testing

### Network Issues
- [ ] Message sending fails gracefully with poor connection
- [ ] Notification retry works if delivery fails
- [ ] Form submissions handle timeout errors
- [ ] Polling continues after network reconnection

### Invalid Data
- [ ] Malformed rating submission handled properly
- [ ] Invalid user IDs in URLs show 404
- [ ] SQL injection attempts blocked
- [ ] XSS attempts sanitized

### System Errors
- [ ] Database connection loss handled gracefully
- [ ] Email server failure doesn't crash app
- [ ] SMS service outage doesn't affect other features
- [ ] One system failure doesn't cascade to others

---

## Security Testing

### Authentication
- [ ] Cannot access other user's messages
- [ ] Cannot rate contracts you're not party to
- [ ] Cannot view other user's notification history
- [ ] Session expires after inactivity

### Input Validation
- [ ] Message content is sanitized
- [ ] Rating comments filtered for inappropriate content
- [ ] File uploads (if any) are validated
- [ ] API endpoints validate user permissions

### Data Privacy
- [ ] User email addresses not exposed publicly
- [ ] Phone numbers only visible to relevant parties
- [ ] Message content not logged in plain text
- [ ] Notification preferences respected

---

## Mobile/Responsive Testing

### Mobile Browser
- [ ] All forms work on mobile
- [ ] Messages display correctly on small screens
- [ ] Notification badges visible on mobile
- [ ] Touch interactions work properly

### Tablet Testing
- [ ] Layout adapts well to tablet screens
- [ ] Conversation view is usable
- [ ] Rating forms are touch-friendly
- [ ] Navigation is intuitive

---

## Browser Compatibility

### Chrome
- [ ] All features work correctly
- [ ] Push notifications work (if implemented)
- [ ] Local storage works for offline features

### Firefox
- [ ] JavaScript functions correctly
- [ ] CSS renders properly
- [ ] No console errors

### Safari
- [ ] iOS Safari compatibility
- [ ] Touch events work correctly
- [ ] No webkit-specific issues

### Edge
- [ ] Basic functionality works
- [ ] No IE legacy issues

---

## Accessibility Testing

### Screen Readers
- [ ] Rating forms are screen reader accessible
- [ ] Notification alerts are announced
- [ ] Message threads are navigable
- [ ] Form labels are properly associated

### Keyboard Navigation
- [ ] All features accessible via keyboard
- [ ] Tab order is logical
- [ ] Focus indicators are visible
- [ ] Shortcuts work as expected

---

## Test Results Summary

**Date:** _______________  
**Tester:** _____________  
**Environment:** _______  

### Results
- [ ] All critical functions work
- [ ] No data corruption observed
- [ ] Performance is acceptable
- [ ] Security checks passed
- [ ] Cross-browser compatibility confirmed

### Issues Found
1. _________________________________
2. _________________________________
3. _________________________________

### Recommended Actions
1. _________________________________
2. _________________________________
3. _________________________________

**Overall Test Status:** ⬜ Pass ⬜ Fail ⬜ Conditional Pass

---

## Automation Notes

These manual tests should be supplemented with the automated test suites:
- `pytest tests/test_rating_system.py -v`
- `pytest tests/test_gamification.py -v`
- `pytest tests/test_notifications.py -v`
- `pytest tests/test_messaging.py -v`
- `pytest tests/test_integration.py -v`

Run load tests with:
- `locust -f tests/load_test.py --host=http://localhost:5000`
