Files
daily-notification-plugin/docs/testing-quick-reference.md
Matthew Raymer f746434b6b refactor(plugin): remove echo test method and references
- Remove echo() method from DailyNotificationPlugin.java
- Update Android test app to show 'Plugin is loaded and ready!' instead of echo test
- Update web test app to remove echo method call
- Update iOS test app to remove echo method call
- Update documentation to remove echo test references
- Replace echo test with simple plugin availability check

The echo test was only used for initial plugin verification and is no longer
needed since the plugin now has comprehensive notification functionality.
This simplifies the codebase and removes unnecessary test code.
2025-10-14 06:31:07 +00:00

5.5 KiB

DailyNotification Testing Quick Reference

🚀 Quick Start

Manual Testing

# 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

# 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

# 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

# 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

# Check scheduled alarms
adb shell "dumpsys alarm | grep timesafari"

# Check exact alarm permissions
adb shell "dumpsys alarm | grep SCHEDULE_EXACT_ALARM"

Logging

# 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

# Is app running?
adb shell "ps | grep timesafari"

# What's the app doing?
adb shell "dumpsys activity activities | grep timesafari"

Check Notifications

# Are notifications enabled?
adb shell "dumpsys notification | grep timesafari"

# What notifications are active?
adb shell "cmd notification list"

Check Alarms

# Are alarms scheduled?
adb shell "dumpsys alarm | grep timesafari"

# What alarms are pending?
adb shell "dumpsys alarm | grep -A5 -B5 timesafari"

Check Logs

# 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! 🎯