# Testing Guide ## Quick Start 1. **Start the development server:** ```bash npm run dev ``` 2. **Open your browser:** Navigate to http://localhost:3000 --- ## Test Scenarios ### Scenario 1: Admin Login & System Setup **Login:** - Email: `admin@muller.com` - Password: `admin123` - User Type: Admin **What to test:** - ✅ View dashboard statistics - ✅ Navigate to Teams page - ✅ Navigate to Workers page - ✅ Navigate to Managers page - ✅ Navigate to Machines page - ✅ Verify all 4 teams are listed - ✅ Verify all 36 workers are listed - ✅ Verify all 4 shift managers are listed - ✅ Verify all 7 machines are listed - ✅ Test logout functionality --- ### Scenario 2: Shift Manager - Create Shift **Login:** - Email: `james.anderson@muller.com` - Password: `muller123` - User Type: Shift Manager **What to test:** 1. ✅ View shift manager dashboard 2. ✅ Navigate to "Create Shift" page 3. ✅ Select shift type (AM or PM) 4. ✅ Select today's date 5. ✅ Select "Red Team" 6. ✅ Assign 7 operators to the 7 machines: - T1: David Wilson (RED-OP1) - T2: Robert Brown (RED-OP2) - T3: William Davis (RED-OP3) - T4: Richard Miller (RED-OP4) - T5: Joseph Moore (RED-OP5) - T6: Thomas Taylor (RED-OP6) - T7: Charles Jackson (RED-OP7) 7. ✅ Click "Create Shift" 8. ✅ Verify shift appears in "Shifts" page 9. ✅ Verify shift status is "Active" 10. ✅ Test logout --- ### Scenario 3: Operator - View Active Shift **Login:** - Email: `david.wilson.red@muller.com` - Password: `muller123` - User Type: Operator **What to test:** 1. ✅ View operator dashboard 2. ✅ Verify active shift is displayed 3. ✅ Verify shift details (date, team, machine, shift time) 4. ✅ Click "Open Report" button 5. ✅ Verify report page loads with basic info section --- ### Scenario 4: Operator - Fill Out Report **Prerequisites:** Complete Scenario 2 & 3 first **Login:** Same as Scenario 3 **What to test:** #### A. Safety Checklist 1. ✅ Check all 6 safety items 2. ✅ Click "Save" 3. ✅ Verify data persists after page refresh #### B. Production Pre-Checks 1. ✅ Enter Wall Thickness values (Top, Label Panel, Base, Neck) 2. ✅ Enter Section Weights values 3. ✅ Enter Station 1 Weights values 4. ✅ Click "Save" 5. ✅ Verify data persists #### C. Production Parameters 1. ✅ Click "Add Hourly Temperature Parameters" 2. ✅ Enter Melt Temp (e.g., 220) 3. ✅ Enter Reg % (default 35.5) 4. ✅ Enter Head PSI (e.g., 150) 5. ✅ Click "Add" 6. ✅ Verify entry appears in table 7. ✅ Add 2-3 more entries 8. ✅ Verify all entries are displayed #### D. Bottle Weight Tracking 1. ✅ Click "Add Weight Tracking" 2. ✅ Enter weights for 4 bottles (e.g., 33.8, 34.1, 34.0, 33.9) 3. ✅ Click "Add" 4. ✅ Verify chart updates with new data point 5. ✅ Verify average is calculated automatically 6. ✅ Add 2-3 more entries 7. ✅ Verify chart shows trend lines (average, upper/lower limits, target) #### E. Hourly Quality Checks 1. ✅ Click "Add Quality Check" 2. ✅ Check relevant inspection items 3. ✅ Enter Base Weight and Neck Weight 4. ✅ Click "Add" 5. ✅ Verify entry appears in table #### F. Production Tracking 1. ✅ Click "Add Production Tracking" 2. ✅ Enter Hour (e.g., "8:00 AM") 3. ✅ Enter Total Production This Shift 4. ✅ Enter Production This Hour 5. ✅ Add optional comment 6. ✅ Click "Add" 7. ✅ Verify entry appears in table #### G. Seam Leak Test 1. ✅ Click "Add Seam Leak Test" 2. ✅ Enter time 3. ✅ Click "Add Mould" button 4. ✅ Enter Mould Number (e.g., 5) 5. ✅ Select Pass/Fail 6. ✅ Add 2-3 more moulds 7. ✅ Click "Save Test" 8. ✅ Verify test appears with all moulds #### H. Film Details 1. ✅ Click "Add New Film" 2. ✅ Enter Width 3. ✅ Enter Roll Number 4. ✅ Enter Product Code 5. ✅ Enter Pallet Number 6. ✅ Click "Add" 7. ✅ Verify film entry appears in table #### I. Production Data 1. ✅ Verify Average Weight is auto-calculated 2. ✅ Enter Total Bags Made 3. ✅ Enter Quality Metrics (Height fails, Top Load fails, etc.) 4. ✅ Enter Output Metrics (Wheel Output, Total Good Bottles, etc.) 5. ✅ Click "Save" 6. ✅ Verify data persists --- ### Scenario 5: Multiple Teams & Shifts **Test concurrent operations:** 1. ✅ Login as Green Team manager (sarah.mitchell@muller.com / muller123) 2. ✅ Create a shift for Green Team 3. ✅ Assign Green Team operators 4. ✅ Logout 5. ✅ Login as Green Team operator (daniel.white.green@muller.com / muller123) 6. ✅ Verify active shift appears 7. ✅ Open report and add some data 8. ✅ Logout 9. ✅ Login as Red Team operator (david.wilson.red@muller.com / muller123) 10. ✅ Verify only Red Team shift appears (not Green Team) 11. ✅ Verify report data is separate from Green Team --- ### Scenario 6: Shift Closure & Archive **Prerequisites:** Complete Scenario 2 **Login as Shift Manager:** - Email: `james.anderson@muller.com` - Password: `muller123` **What to test:** 1. ✅ Navigate to "Shifts" page 2. ✅ Find the active shift 3. ✅ (Note: Shift closure functionality needs to be implemented) 4. ✅ After closure, verify shift status changes to "Closed" **Login as Operator:** - Email: `david.wilson.red@muller.com` - Password: `muller123` **What to test:** 1. ✅ Verify closed shift no longer appears in "Active Shifts" 2. ✅ Navigate to "Shifts Archive" 3. ✅ Verify closed shift appears in archive 4. ✅ Verify report is read-only (cannot edit) --- ## Test Data Summary ### Admin - **1 account** with full system access ### Shift Managers (4) - Red Team: james.anderson@muller.com - Green Team: sarah.mitchell@muller.com - Blue Team: michael.thompson@muller.com - Yellow Team: emma.roberts@muller.com - **All passwords:** muller123 ### Operators (28 total - 7 per team) - Red Team: david.wilson.red@muller.com (and 6 more) - Green Team: daniel.white.green@muller.com (and 6 more) - Blue Team: andrew.rodriguez.blue@muller.com (and 6 more) - Yellow Team: ronald.king.yellow@muller.com (and 6 more) - **All passwords:** muller123 ### Machines (7) - T1, T2, T3, T4, T5, T6, T7 --- ## Expected Behaviors ### Authentication - ✅ Invalid credentials show error message - ✅ Successful login redirects to role-specific dashboard - ✅ Logout returns to login page - ✅ Protected routes redirect to login if not authenticated ### Data Persistence - ✅ All form data saves to database - ✅ Data persists after page refresh - ✅ Data persists after logout/login ### Role-Based Access - ✅ Admin can access admin pages only - ✅ Shift Manager can access shift manager pages only - ✅ Operator can access operator pages only - ✅ Users cannot access other roles' pages ### Shift Assignment - ✅ Operators only see shifts they're assigned to - ✅ Operators only see reports for their assigned machine - ✅ Multiple operators can work simultaneously on different machines ### Data Isolation - ✅ Each operator's report is separate - ✅ Each shift's data is separate - ✅ Teams' data is isolated from each other --- ## Known Issues / Future Enhancements 1. **Shift Closure:** Need to implement shift closure functionality for shift managers 2. **Password Reset:** No password reset functionality yet 3. **Email Notifications:** Not implemented 4. **PDF Export:** Report PDF export not implemented 5. **Real-time Updates:** No WebSocket for real-time collaboration 6. **Mobile App:** Web-only, no native mobile app 7. **Advanced Analytics:** No analytics dashboard yet --- ## Performance Testing ### Load Testing Scenarios 1. ✅ Create 10+ shifts 2. ✅ Add 50+ report entries 3. ✅ Test with multiple concurrent users 4. ✅ Test chart rendering with large datasets 5. ✅ Test database query performance ### Browser Compatibility - ✅ Chrome - ✅ Firefox - ✅ Safari - ✅ Edge - ✅ Mobile browsers (iOS Safari, Chrome Mobile) --- ## Troubleshooting ### Cannot Login - Verify database is running - Check DATABASE_URL in .env - Verify seed data was created successfully - Check browser console for errors ### Data Not Saving - Check browser console for API errors - Verify Prisma client is generated - Check database connection - Verify API routes are working ### Charts Not Displaying - Verify recharts is installed - Check browser console for errors - Verify data format is correct - Test with sample data ### Shift Not Appearing for Operator - Verify shift was created for today's date - Verify operator is assigned to the shift - Verify shift status is "active" - Check database records --- ## Success Criteria ✅ All user roles can login successfully ✅ Admin can view and manage all system entities ✅ Shift managers can create and manage shifts ✅ Operators can view assigned shifts ✅ Operators can fill out complete reports ✅ All data persists correctly ✅ Charts display correctly ✅ Role-based access control works ✅ Mobile responsive design works ✅ No critical errors in console