# Manual Testing Checklist: Laravel Monitoring Tools Integration

This document provides a comprehensive manual testing checklist for verifying the Laravel Pulse and Telescope integration into the Manabou backend admin panel.

## Pre-Testing Setup

- [ ] Ensure the application is running in development environment
- [ ] Ensure database migrations have been run
- [ ] Ensure role and permission seeders have been executed
- [ ] Create test users with different permission levels:
  - [ ] Admin user with `monitoring.view` permission
  - [ ] Admin user without `monitoring.view` permission
  - [ ] Non-admin user
  - [ ] Unauthenticated user

## Dashboard Accessibility Tests

### Pulse Dashboard Access

- [ ] **Admin with permission**: Navigate to `/pulse` as admin user with `monitoring.view` permission
  - Expected: Dashboard loads successfully (200 OK)
  - Verify: Pulse dashboard displays with real-time metrics interface
  - Verify: No 403 Forbidden error

- [ ] **Admin without permission**: Navigate to `/pulse` as admin user without `monitoring.view` permission
  - Expected: Access denied (403 Forbidden)
  - Verify: Error message or redirect to login/dashboard

- [ ] **Non-admin user**: Navigate to `/pulse` as non-admin user
  - Expected: Access denied (403 Forbidden)
  - Verify: Error message or redirect to login/dashboard

- [ ] **Unauthenticated user**: Navigate to `/pulse` without authentication
  - Expected: Access denied (403 Forbidden)
  - Verify: Redirect to login page or error message

### Telescope Dashboard Access

- [ ] **Admin with permission**: Navigate to `/telescope` as admin user with `monitoring.view` permission
  - Expected: Dashboard loads successfully (200 OK)
  - Verify: Telescope dashboard displays with debugging interface
  - Verify: No 403 Forbidden error

- [ ] **Admin without permission**: Navigate to `/telescope` as admin user without `monitoring.view` permission
  - Expected: Access denied (403 Forbidden)
  - Verify: Error message or redirect to login/dashboard

- [ ] **Non-admin user**: Navigate to `/telescope` as non-admin user
  - Expected: Access denied (403 Forbidden)
  - Verify: Error message or redirect to login/dashboard

- [ ] **Unauthenticated user**: Navigate to `/telescope` without authentication
  - Expected: Access denied (403 Forbidden)
  - Verify: Redirect to login page or error message

## Navigation Integration Tests

### Sidebar Navigation Visibility

- [ ] **Admin with permission**: Log in as admin user with `monitoring.view` permission
  - Navigate to `/admin/dashboard`
  - Expected: Monitoring section visible in sidebar
  - Verify: "Monitoring" section header appears
  - Verify: "Pulse" link appears with lightning bolt icon
  - Verify: "Telescope" link appears with magnifying glass icon

- [ ] **Admin without permission**: Log in as admin user without `monitoring.view` permission
  - Navigate to `/admin/dashboard`
  - Expected: Monitoring section NOT visible in sidebar
  - Verify: "Monitoring" section header does not appear
  - Verify: "Pulse" link does not appear
  - Verify: "Telescope" link does not appear

- [ ] **Non-admin user**: Log in as non-admin user
  - Navigate to `/admin/dashboard`
  - Expected: Monitoring section NOT visible in sidebar
  - Verify: "Monitoring" section header does not appear
  - Verify: "Pulse" link does not appear
  - Verify: "Telescope" link does not appear

### Navigation Link Functionality

- [ ] **Pulse link navigation**: As admin with permission, click "Pulse" link in sidebar
  - Expected: Navigate to `/pulse` successfully
  - Verify: Pulse dashboard loads
  - Verify: "Pulse" link shows active state (highlighted)

- [ ] **Telescope link navigation**: As admin with permission, click "Telescope" link in sidebar
  - Expected: Navigate to `/telescope` successfully
  - Verify: Telescope dashboard loads
  - Verify: "Telescope" link shows active state (highlighted)

- [ ] **Active state on Pulse**: Navigate to `/pulse` directly
  - Expected: "Pulse" link in sidebar shows active state
  - Verify: Link is highlighted/styled as active

- [ ] **Active state on Telescope**: Navigate to `/telescope` directly
  - Expected: "Telescope" link in sidebar shows active state
  - Verify: Link is highlighted/styled as active

## Dashboard Functionality Tests

### Pulse Dashboard Functionality

- [ ] **Dashboard loads**: Access `/pulse` as authorized admin
  - Verify: Dashboard interface loads without errors
  - Verify: No console errors in browser developer tools

- [ ] **Real-time metrics display**: On Pulse dashboard
  - Verify: Requests metric displays (if any requests have been made)
  - Verify: Exceptions metric displays (if any exceptions have occurred)
  - Verify: Queues metric displays (if any queued jobs exist)
  - Verify: Slow queries metric displays (if any slow queries have been recorded)

- [ ] **Dashboard responsiveness**: On Pulse dashboard
  - Verify: Dashboard is responsive on desktop
  - Verify: Dashboard is responsive on tablet
  - Verify: Dashboard is responsive on mobile

### Telescope Dashboard Functionality

- [ ] **Dashboard loads**: Access `/telescope` as authorized admin
  - Verify: Dashboard interface loads without errors
  - Verify: No console errors in browser developer tools

- [ ] **Entry recording**: On Telescope dashboard
  - Verify: Requests are recorded and displayed
  - Verify: Queries are recorded and displayed
  - Verify: Exceptions are recorded and displayed (if any occur)

- [ ] **Dashboard responsiveness**: On Telescope dashboard
  - Verify: Dashboard is responsive on desktop
  - Verify: Dashboard is responsive on tablet
  - Verify: Dashboard is responsive on mobile

## Data Collection Tests

### Pulse Data Collection

- [ ] **Request recording**: Generate application traffic
  - Make several HTTP requests to the application
  - Navigate to `/pulse`
  - Verify: Requests are recorded and displayed in Pulse dashboard
  - Verify: Request count increases with new requests

- [ ] **Exception recording**: Trigger an exception
  - Perform an action that causes an exception
  - Navigate to `/pulse`
  - Verify: Exception is recorded and displayed
  - Verify: Exception details are visible

- [ ] **Slow query recording**: Execute a slow query
  - Perform a database operation that takes longer than the threshold
  - Navigate to `/pulse`
  - Verify: Slow query is recorded and displayed
  - Verify: Query details and execution time are visible

### Telescope Data Collection

- [ ] **Request recording**: Generate application traffic
  - Make several HTTP requests to the application
  - Navigate to `/telescope`
  - Verify: Requests are recorded and displayed
  - Verify: Request details (method, URL, status) are visible

- [ ] **Query recording**: Execute database queries
  - Perform database operations
  - Navigate to `/telescope`
  - Verify: Queries are recorded and displayed
  - Verify: Query details (SQL, bindings, time) are visible

- [ ] **Exception recording**: Trigger an exception
  - Perform an action that causes an exception
  - Navigate to `/telescope`
  - Verify: Exception is recorded and displayed
  - Verify: Exception details (message, stack trace) are visible

## Data Retention Tests

### Pulse Data Retention

- [ ] **Retention period configuration**: Check Pulse configuration
  - Verify: `config/pulse.php` has retention period setting
  - Verify: Retention period is configurable via environment variables
  - Verify: Default retention period is appropriate (24 hours for development)

- [ ] **Prune command execution**: Run Pulse prune command
  - Execute: `php artisan pulse:purge --hours=24`
  - Verify: Command completes without errors
  - Verify: Old data is removed from database
  - Verify: Recent data is retained

### Telescope Data Retention

- [ ] **Retention period configuration**: Check Telescope configuration
  - Verify: `config/telescope.php` has retention period setting
  - Verify: Retention period is configurable via environment variables
  - Verify: Default retention period is appropriate (24 hours for development)

- [ ] **Prune command execution**: Run Telescope prune command
  - Execute: `php artisan telescope:prune --hours=24`
  - Verify: Command completes without errors
  - Verify: Old data is removed from database
  - Verify: Recent data is retained

## Environment-Specific Configuration Tests

### Development Environment

- [ ] **Pulse recorders**: In development environment
  - Verify: All Pulse recorders are enabled
  - Verify: Sampling rate is 100% for all recorders
  - Verify: Full data collection is occurring

- [ ] **Telescope watchers**: In development environment
  - Verify: All Telescope watchers are enabled
  - Verify: Full data collection is occurring
  - Verify: All entry types are being recorded

### Production Environment (if applicable)

- [ ] **Pulse recorders**: In production environment
  - Verify: Only essential recorders are enabled
  - Verify: Sampling rates are conservative (10-20%)
  - Verify: Performance impact is minimal

- [ ] **Telescope watchers**: In production environment
  - Verify: Only essential watchers are enabled
  - Verify: Sampling rates are conservative
  - Verify: Performance impact is minimal

## Performance Tests

- [ ] **Dashboard load time**: Measure Pulse dashboard load time
  - Expected: Dashboard loads in < 2 seconds
  - Verify: No significant performance degradation

- [ ] **Dashboard load time**: Measure Telescope dashboard load time
  - Expected: Dashboard loads in < 2 seconds
  - Verify: No significant performance degradation

- [ ] **Application performance**: Monitor application performance with monitoring enabled
  - Verify: Application response times are not significantly affected
  - Verify: No memory leaks or resource exhaustion
  - Verify: Database queries are not significantly impacted

## Security Tests

- [ ] **Authentication enforcement**: Verify authentication is required
  - Attempt to access `/pulse` without authentication
  - Expected: Access denied
  - Attempt to access `/telescope` without authentication
  - Expected: Access denied

- [ ] **Authorization enforcement**: Verify authorization is enforced
  - Attempt to access `/pulse` as non-admin user
  - Expected: Access denied
  - Attempt to access `/telescope` as non-admin user
  - Expected: Access denied

- [ ] **Permission enforcement**: Verify permission is enforced
  - Attempt to access `/pulse` as admin without `monitoring.view` permission
  - Expected: Access denied
  - Attempt to access `/telescope` as admin without `monitoring.view` permission
  - Expected: Access denied

## Browser Compatibility Tests

- [ ] **Chrome**: Test in latest Chrome browser
  - Verify: Dashboards load correctly
  - Verify: All features work as expected
  - Verify: No console errors

- [ ] **Firefox**: Test in latest Firefox browser
  - Verify: Dashboards load correctly
  - Verify: All features work as expected
  - Verify: No console errors

- [ ] **Safari**: Test in latest Safari browser
  - Verify: Dashboards load correctly
  - Verify: All features work as expected
  - Verify: No console errors

- [ ] **Edge**: Test in latest Edge browser
  - Verify: Dashboards load correctly
  - Verify: All features work as expected
  - Verify: No console errors

## Final Verification

- [ ] All automated tests pass: `php artisan test tests/Feature/MonitoringToolsIntegrationTest.php`
- [ ] No console errors in browser developer tools
- [ ] No database errors in application logs
- [ ] No performance degradation observed
- [ ] All manual tests completed successfully
- [ ] Documentation is up to date
- [ ] Code review completed
- [ ] Ready for deployment

## Notes

- This checklist should be completed before deploying to production
- Document any issues found during testing
- Update this checklist as new features are added
- Consider automating additional tests as the feature matures
