# 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 - [ ] 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 is ready for use - 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! ๐ŸŽฏ