Files
daily-notification-plugin/docs/testing/QUICK_REFERENCE.md
Matthew Raymer eb1fc9f220 feat(docs): complete P2.6 type safety cleanup and P2.7 system invariants
P2.6: Type Safety Cleanup
- Replaced 'any' return types in vite-plugin.ts with concrete types (UserConfig, transform return type)
- Documented TypeScript mixin 'any[]' exception in PlatformServiceMixin.ts
- Audit confirmed: zero 'any' in codebase except documented TS mixin limitation
- All external boundaries use 'unknown', all data payloads use 'Record<string, unknown>'

P2.7: System Invariants Documentation
- Created SYSTEM_INVARIANTS.md documenting all 6 enforced invariants
- Added to docs/00-INDEX.md under Policy & Contracts section
- Each invariant includes: What, Why, How, Where

Progress Docs Updates:
- Updated 00-STATUS.md: marked P2.6/P2.7 complete, added type safety invariant note
- Updated 01-CHANGELOG-WORK.md: added 2025-12-22 entries for P2.6/P2.7
- Updated 03-TEST-RUNS.md: added P2.6 type safety audit test run
- Updated P2-DESIGN.md: marked P2.6 acceptance criteria complete
- Updated SYSTEM_INVARIANTS.md: added Type Safety Notes section

Baseline Tag:
- Created v1.0.11-p0-p1.4-p1.5-p2.6-p2.7-complete

TypeScript compilation:  PASSES
Build:  PASSES
CI:  All checks pass
2025-12-22 10:56:00 +00:00

5.6 KiB

DailyNotification Testing Quick Reference

Note: For P0 production-grade features testing, see QUICK_REFERENCE_V2.md

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