mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 09:31:13 -05:00
4.3 KiB
4.3 KiB
Phase 5: Testing Checklist
Quick Manual Tests (30 min)
✅ Test 1: State Machine Flow
- Open moderation queue → Click submission
- Check DevTools React Components: Find
SubmissionReviewManager - Verify state transitions:
idle→claiming→locked→loading_data→reviewing - Expected: Items load, no console errors
✅ Test 2: Lock Expiry Warning
- Claim submission and wait ~13 minutes (or modify DB lock duration to 2 min for testing)
- Expected: Toast warning appears: "Lock Expiring Soon"
- Click to extend lock
- Expected: Lock renewed, toast confirms
✅ Test 3: Approval Flow
- Select items → Click "Approve Selected"
- Check state transitions:
reviewing→approving→complete - Expected: Success toast with requestId, items approved
✅ Test 4: Rejection Flow
- Select items → Click "Reject Selected"
- Enter reason → Confirm
- Check state:
reviewing→rejecting→complete - Expected: Success toast, items rejected
✅ Test 5: Illegal Transition Prevention
- While in
approvingstate, try clicking "Reject" - Expected: Button disabled, no console errors
✅ Test 6: Error Recovery
- Disconnect network → Attempt approval
- Expected: State shows
error, "Try Again" button appears - Reconnect → Click "Try Again"
- Expected: Recovery successful
Database Validation Queries (15 min)
Query 1: Active Locks
SELECT id, status, locked_until, assigned_to
FROM content_submissions
WHERE locked_until > NOW()
ORDER BY locked_until DESC;
Expected: All locks valid, no expired with status='locked'
Query 2: Stuck Locks Check
SELECT id, status, locked_until
FROM content_submissions
WHERE status = 'locked'
AND locked_until < NOW();
Expected: 0 rows (no stuck locks)
Query 3: Request Tracking Coverage
SELECT
endpoint,
COUNT(*) as request_count,
AVG(duration_ms) as avg_duration_ms,
COUNT(CASE WHEN error_message IS NOT NULL THEN 1 END) as error_count
FROM request_metadata
WHERE created_at > NOW() - INTERVAL '1 hour'
GROUP BY endpoint
ORDER BY request_count DESC;
Expected: process-selective-approval present with requests
Query 4: Status Type Safety
SELECT status, COUNT(*) as count
FROM content_submissions
WHERE status NOT IN ('draft', 'pending', 'locked', 'reviewing', 'partially_approved', 'approved', 'rejected', 'escalated')
GROUP BY status;
Expected: 0 rows (all statuses valid)
Performance Check (15 min)
Test 1: State Machine Overhead
- Chrome DevTools → Performance tab → Record
- Submit approval flow
- Stop recording → Search for "moderationReducer"
- Target: < 5ms total time
Test 2: UI Responsiveness
- Measure button click → state change
- Target: < 100ms response time
Test 3: Memory Leak Check
- DevTools Memory tab → Take baseline heap snapshot
- Perform 20 form submissions
- Force GC (🗑️) → Take second snapshot
- Compare snapshots
- Expected: No significant memory retention
Success Criteria
Functional:
- ✅ State machine controls all submission states
- ✅ Lock expiry warnings work
- ✅ Illegal transitions prevented
- ✅ Error recovery functional
- ✅ All buttons respect state machine guards
Quality:
- ✅ Zero TypeScript errors
- ✅ No console errors during normal flow
- ✅ All manual tests pass
- ✅ Database shows no orphaned/invalid data
Performance:
- ✅ State machine overhead < 5ms
- ✅ UI response < 100ms
- ✅ No memory leaks
Quick Test Commands
# Test lock expiry (reduce to 2 min for testing)
UPDATE content_submissions
SET locked_until = NOW() + INTERVAL '2 minutes'
WHERE id = 'YOUR_SUBMISSION_ID';
# Reset stuck submission
UPDATE content_submissions
SET status = 'pending', locked_until = NULL, assigned_to = NULL
WHERE id = 'YOUR_SUBMISSION_ID';
# View recent request tracking
SELECT * FROM request_metadata
ORDER BY created_at DESC
LIMIT 20;
Issue Checklist
- All 6 manual tests pass
- All 4 database queries return expected results
- Performance benchmarks meet targets
- No memory leaks detected
- Lock monitoring functions correctly
- Error recovery works
- UI reflects state accurately
Estimated Time: 1 hour total