docs: add comprehensive testing and recovery documentation
- Add app-startup-recovery-solution.md with technical deep dive - Add boot-receiver-testing-guide.md with Android 10+ fixes - Add notification-testing-procedures.md with manual testing steps - Add reboot-testing-procedure.md with automated testing - Add reboot-testing-steps.md with quick reference guide - Add testing-quick-reference.md with common scenarios Documentation covers: - Boot receiver implementation and Direct Boot handling - App startup recovery as fallback mechanism - Comprehensive testing procedures for all scenarios - Troubleshooting guides for common issues - Performance metrics and success criteria - Production deployment best practices This provides complete documentation for the notification system including both boot receiver and app startup recovery approaches.
This commit is contained in:
223
docs/testing-quick-reference.md
Normal file
223
docs/testing-quick-reference.md
Normal file
@@ -0,0 +1,223 @@
|
||||
# DailyNotification Testing Quick Reference
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Manual Testing
|
||||
```bash
|
||||
# 1. Launch app
|
||||
adb shell am start -n com.timesafari.dailynotification/.MainActivity
|
||||
|
||||
# 2. Schedule notification (in app UI)
|
||||
# Tap "Test Notification" button
|
||||
|
||||
# 3. Close app normally
|
||||
adb shell input keyevent KEYCODE_HOME
|
||||
|
||||
# 4. Wait for notification (1 minute)
|
||||
# Check notification panel
|
||||
```
|
||||
|
||||
### Automated Testing
|
||||
```bash
|
||||
# Run bash test script
|
||||
./scripts/daily-notification-test.sh
|
||||
|
||||
# Run Python test script
|
||||
python3 scripts/daily-notification-test.py
|
||||
|
||||
# Run with verbose output
|
||||
python3 scripts/daily-notification-test.py -v
|
||||
```
|
||||
|
||||
## 🔧 Essential ADB Commands
|
||||
|
||||
### App Management
|
||||
```bash
|
||||
# Launch app
|
||||
adb shell am start -n com.timesafari.dailynotification/.MainActivity
|
||||
|
||||
# Normal close (background)
|
||||
adb shell input keyevent KEYCODE_HOME
|
||||
|
||||
# Force stop (kills app)
|
||||
adb shell am force-stop com.timesafari.dailynotification
|
||||
|
||||
# Check if running
|
||||
adb shell "ps | grep timesafari"
|
||||
```
|
||||
|
||||
### Notification Testing
|
||||
```bash
|
||||
# Check notification settings
|
||||
adb shell "dumpsys notification | grep -A5 -B5 timesafari"
|
||||
|
||||
# Open notification settings
|
||||
adb shell "am start -a android.settings.APP_NOTIFICATION_SETTINGS -e android.provider.extra.APP_PACKAGE com.timesafari.dailynotification"
|
||||
|
||||
# List notifications
|
||||
adb shell "cmd notification list"
|
||||
```
|
||||
|
||||
### Alarm Management
|
||||
```bash
|
||||
# Check scheduled alarms
|
||||
adb shell "dumpsys alarm | grep timesafari"
|
||||
|
||||
# Check exact alarm permissions
|
||||
adb shell "dumpsys alarm | grep SCHEDULE_EXACT_ALARM"
|
||||
```
|
||||
|
||||
### Logging
|
||||
```bash
|
||||
# Monitor logs
|
||||
adb logcat | grep -i "dailynotification\|notification"
|
||||
|
||||
# Get recent logs
|
||||
adb logcat -d | grep -i "dailynotification"
|
||||
|
||||
# Clear logs
|
||||
adb logcat -c
|
||||
```
|
||||
|
||||
## 🧪 Test Scenarios
|
||||
|
||||
### Scenario 1: Basic Functionality
|
||||
1. Launch app → Test plugin → Schedule notification → Verify delivery
|
||||
2. **Expected**: All functions work correctly
|
||||
|
||||
### Scenario 2: Background Operation
|
||||
1. Schedule notification → Send to background → Wait for delivery
|
||||
2. **Expected**: Notification appears despite app being backgrounded
|
||||
|
||||
### Scenario 3: Force Stop (Expected Failure)
|
||||
1. Schedule notification → Force stop → Wait for delivery
|
||||
2. **Expected**: No notification appears (this is correct behavior)
|
||||
|
||||
### Scenario 4: Permission Management
|
||||
1. Check permissions → Request permissions → Verify status
|
||||
2. **Expected**: Permissions granted and status updated
|
||||
|
||||
## 🚨 Common Issues
|
||||
|
||||
### Plugin Not Loading
|
||||
- Check `capacitor.plugins.json` exists and is valid
|
||||
- Rebuild: `./gradlew assembleDebug`
|
||||
- Reinstall: `adb install -r app/build/outputs/apk/debug/app-debug.apk`
|
||||
|
||||
### Notifications Not Appearing
|
||||
- Check notification permissions in app
|
||||
- Verify notification importance: `adb shell "dumpsys notification | grep timesafari"`
|
||||
- Check if notifications enabled in system settings
|
||||
|
||||
### Alarms Not Firing
|
||||
- Check exact alarm permissions
|
||||
- Verify alarm scheduled: `adb shell "dumpsys alarm | grep timesafari"`
|
||||
- Check battery optimization settings
|
||||
|
||||
## 📱 Testing Checklist
|
||||
|
||||
### Pre-Test Setup
|
||||
- [ ] Android device/emulator connected via ADB
|
||||
- [ ] App installed and launched
|
||||
- [ ] Notification permissions granted
|
||||
- [ ] Battery optimization disabled (if needed)
|
||||
|
||||
### Test Execution
|
||||
- [ ] Plugin loads successfully
|
||||
- [ ] Echo method works
|
||||
- [ ] Notification scheduling works
|
||||
- [ ] Background operation works
|
||||
- [ ] Force stop behavior is correct
|
||||
- [ ] Permission management works
|
||||
|
||||
### Post-Test Verification
|
||||
- [ ] All expected notifications appeared
|
||||
- [ ] No unexpected errors in logs
|
||||
- [ ] App behavior is consistent
|
||||
- [ ] Performance is acceptable
|
||||
|
||||
## 🎯 Key Differences
|
||||
|
||||
| Action | ADB Command | App Status | Alarms Survive? |
|
||||
|--------|-------------|------------|-----------------|
|
||||
| **Normal Close** | `KEYCODE_HOME` | Background | ✅ Yes |
|
||||
| **Force Stop** | `am force-stop` | Killed | ❌ No |
|
||||
| **Back Button** | `KEYCODE_BACK` | Background | ✅ Yes |
|
||||
|
||||
## 📊 Success Criteria
|
||||
|
||||
### ✅ Test Passes When:
|
||||
- Plugin loads and responds to echo
|
||||
- Notifications appear at scheduled time
|
||||
- Background operation works correctly
|
||||
- Force stop behaves as expected
|
||||
- Permissions are managed properly
|
||||
|
||||
### ❌ Test Fails When:
|
||||
- Plugin doesn't load
|
||||
- Notifications don't appear
|
||||
- App crashes or behaves unexpectedly
|
||||
- Permissions aren't handled correctly
|
||||
- Performance is unacceptable
|
||||
|
||||
## 🔍 Debugging Tips
|
||||
|
||||
### Check App Status
|
||||
```bash
|
||||
# Is app running?
|
||||
adb shell "ps | grep timesafari"
|
||||
|
||||
# What's the app doing?
|
||||
adb shell "dumpsys activity activities | grep timesafari"
|
||||
```
|
||||
|
||||
### Check Notifications
|
||||
```bash
|
||||
# Are notifications enabled?
|
||||
adb shell "dumpsys notification | grep timesafari"
|
||||
|
||||
# What notifications are active?
|
||||
adb shell "cmd notification list"
|
||||
```
|
||||
|
||||
### Check Alarms
|
||||
```bash
|
||||
# Are alarms scheduled?
|
||||
adb shell "dumpsys alarm | grep timesafari"
|
||||
|
||||
# What alarms are pending?
|
||||
adb shell "dumpsys alarm | grep -A5 -B5 timesafari"
|
||||
```
|
||||
|
||||
### Check Logs
|
||||
```bash
|
||||
# Recent plugin activity
|
||||
adb logcat -d | grep -i "dailynotification"
|
||||
|
||||
# Real-time monitoring
|
||||
adb logcat | grep -i "dailynotification\|notification"
|
||||
```
|
||||
|
||||
## 🚀 Production Testing
|
||||
|
||||
### Real Device Testing
|
||||
- Test on multiple Android versions
|
||||
- Test on different OEMs (Samsung, Huawei, etc.)
|
||||
- Test with different battery optimization settings
|
||||
- Test under various network conditions
|
||||
|
||||
### Performance Testing
|
||||
- Test with multiple scheduled notifications
|
||||
- Test rapid scheduling/canceling
|
||||
- Test under memory pressure
|
||||
- Test battery impact
|
||||
|
||||
### Edge Case Testing
|
||||
- Test after device reboot
|
||||
- Test with low battery
|
||||
- Test with airplane mode
|
||||
- Test with timezone changes
|
||||
|
||||
---
|
||||
|
||||
**Remember**: Force-stop is not a real-world scenario. Focus testing on normal app closure and background operation! 🎯
|
||||
Reference in New Issue
Block a user