Add API security guards, rate limiter, and manual test checklist

Implement strict CORS enforcement and per-IP rate limiting in the Next.js middleware. Add input validation helpers for
coordinates and request body size limits. Introduce SSRF protection for calendar URL fetching. Update mobile settings to
support new transport options and arrival buffers. Include a comprehensive manual testing checklist for integration
verification.
This commit is contained in:
2026-05-12 14:42:11 +02:00
parent 863996f06c
commit 35971596b3
21 changed files with 1096 additions and 124 deletions
+216
View File
@@ -0,0 +1,216 @@
# TimeToLeave - Manual Integration Testing Checklist
## Overview
This checklist guides you through manual testing of the TimeToLeave application to ensure all features work correctly in the browser.
## Prerequisites
- [ ] Application is running locally or deployed
- [ ] All required environment variables are set
- [ ] Network connection is available for external API calls
---
## 1. Settings Infrastructure Testing
### Arrival Buffer Settings
- [ ] Navigate to Settings panel
- [ ] Set arrival buffer to 10 minutes
- [ ] Verify buffer value is displayed correctly
- [ ] Test different buffer values (0, 5, 15, 30 minutes)
- [ ] Verify buffer value persists after page refresh
### Walking Option Toggle
- [ ] Enable "Show walking option" toggle
- [ ] Verify toggle state is saved
- [ ] Disable "Show walking option" toggle
- [ ] Verify toggle state persists after page refresh
### Bike Option Toggle
- [ ] Enable "Show bike option" toggle
- [ ] Verify toggle state is saved
- [ ] Disable "Show bike option" toggle
- [ ] Verify toggle state persists after page refresh
---
## 2. Walk Routing Testing
### Walk Route API
- [ ] Open Developer Tools (F12) → Network tab
- [ ] Trigger a walk route calculation (e.g., by loading an event with walk mode)
- [ ] Verify `/api/walk-route` request appears in network log
- [ ] Check request contains correct query parameters (fromLat, fromLng, toLat, toLng)
- [ ] Verify response contains distance, duration, and steps array
- [ ] Test with different coordinate pairs
### Walk Route Display
- [ ] Enable walking option in settings
- [ ] Load an event that should show walk route
- [ ] Verify walk duration appears under train section
- [ ] Verify walk distance is displayed
- [ ] Verify step-by-step instructions are shown
- [ ] Test with events at different locations
---
## 3. Departure Time Calculation Testing
### Countdown Badge
- [ ] Set arrival buffer to 10 minutes
- [ ] Verify countdown badge shows earlier departure time than event time
- [ ] Test with different event times (now, in 1 hour, in 3 hours)
- [ ] Verify countdown updates in real-time
### Departure Time Override
- [ ] Switch between transport modes (train, bike, walk)
- [ ] Verify countdown updates to reflect selected mode
- [ ] Test mode switching multiple times
- [ ] Verify departure time calculation is consistent
---
## 4. Mode Selector Testing
### Transport Mode Selection
- [ ] Verify "Train" mode is selected by default
- [ ] Click "Bike" mode button
- [ ] Verify "Bike" mode is now active
- [ ] Click "Walk" mode button
- [ ] Verify "Walk" mode is now active
- [ ] Test switching between all modes multiple times
### Conditional Rendering
- [ ] With walking option disabled: verify walk section is hidden
- [ ] With walking option enabled: verify walk section appears
- [ ] With bike option disabled: verify bike section is hidden
- [ ] With bike option enabled: verify bike section appears
- [ ] Test all combinations of toggle states
---
## 5. JourneyList Filtering Testing
### Arrival Buffer Filtering
- [ ] Set arrival buffer to 5 minutes
- [ ] Load multiple journeys with different arrival times
- [ ] Verify journeys arriving too late are filtered out
- [ ] Increase arrival buffer to 15 minutes
- [ ] Verify previously filtered journeys now appear
- [ ] Test filtering with real-world journey data
---
## 6. Cross-Feature Integration Testing
### Complete Workflow
- [ ] Open settings and set arrival buffer to 10 minutes
- [ ] Enable walking option
- [ ] Enable bike option
- [ ] Load an event with multiple journey options
- [ ] Verify countdown badge shows earlier departure time
- [ ] Switch to bike mode and verify countdown updates
- [ ] Verify walk duration appears under train section
- [ ] Disable bike option and verify bike section disappears
- [ ] Re-enable bike option and verify bike section reappears
- [ ] Test complete workflow with different events
---
## 7. Edge Cases Testing
### Empty States
- [ ] Test with no walk route available (remote location)
- [ ] Verify appropriate error message is displayed
- [ ] Test with missing coordinates
- [ ] Verify graceful handling of missing data
### Network Errors
- [ ] Disable network connection (offline mode in DevTools)
- [ ] Attempt to load walk route
- [ ] Verify error state is displayed
- [ ] Re-enable network and verify retry works
### Invalid Data
- [ ] Test with invalid coordinate values
- [ ] Test with zero or negative buffer times
- [ ] Verify application handles invalid data gracefully
---
## 8. Accessibility Testing
### Keyboard Navigation
- [ ] Tab through all settings controls
- [ ] Verify all buttons and toggles are keyboard accessible
- [ ] Test mode selector with keyboard only
### Screen Reader Compatibility
- [ ] Use Chrome's accessibility inspector or a screen reader
- [ ] Verify all settings have proper labels
- [ ] Verify all interactive elements are announced correctly
### High Contrast Mode
- [ ] Enable high contrast mode in OS settings
- [ ] Verify all UI elements remain visible and readable
---
## 9. Performance Testing
### Loading Times
- [ ] Measure time to load walk route for nearby location (< 5km)
- [ ] Measure time to load walk route for farther location (10-20km)
- [ ] Verify loading spinner appears during API calls
- [ ] Verify loading spinner disappears when complete
### Memory Usage
- [ ] Open Developer Tools → Memory tab
- [ ] Perform multiple walk route calculations
- [ ] Verify no memory leaks (memory usage should stabilize)
---
## 10. Responsive Design Testing
### Mobile
- [ ] Test on mobile device (iPhone/Android)
- [ ] Verify settings panel is usable on small screens
### Tablet
- [ ] Test on tablet device
- [ ] Verify all controls are properly sized
### Desktop
- [ ] Test on various desktop screen sizes
- [ ] Verify layout does not break
---
## Reporting Issues
When you encounter an issue during testing:
1. Note the exact steps to reproduce
2. Record browser/device information
3. Capture any error messages or console logs
4. Take screenshots if UI is affected
5. Test with latest code after reporting
---
## Sign-Off
- [ ] All required tests passed successfully
- [ ] No critical bugs found
- [ ] Application ready for production deployment
**Tested by:** ________________________
**Date:** ________________________
**Browser/Device:** ________________________
**Build Version:** ________________________
---
## Additional Notes
_Add any observations, workarounds, or special test conditions here._