You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
6.0 KiB
6.0 KiB
Test Apps Setup Guide
Overview
This guide creates minimal Capacitor test apps for validating the Daily Notification Plugin across all target platforms.
Directory Structure
test-apps/
├── android-test/ # Android test app
├── ios-test/ # iOS test app
├── electron-test/ # Electron test app
├── test-api/ # Test API server
├── setup-android.sh # Android setup script
├── setup-ios.sh # iOS setup script
├── setup-electron.sh # Electron setup script
├── check-environment.sh # Environment verification
├── SETUP_GUIDE.md # Enhanced setup guide
└── README.md # This guide
Prerequisites
- Node.js 18+
- Capacitor CLI:
npm install -g @capacitor/cli
- Android Studio (for Android)
- Xcode (for iOS)
- Platform-specific SDKs
Quick Start
Option 1: Automated Setup (Recommended)
# Navigate to test-apps directory first
cd test-apps
# Setup all platforms (run from test-apps directory)
./setup-android.sh
./setup-ios.sh
./setup-electron.sh
⚠️ Important: Run setup scripts from the test-apps
directory, not from individual platform directories.
Option 2: Manual Setup
See Enhanced Setup Guide for detailed manual setup instructions and troubleshooting.
Prerequisites Check
# Check your environment before setup
./check-environment.sh
Required Software:
- Node.js 18+: Required for all platforms
- Android Studio: Required for Android testing
- Xcode: Required for iOS testing (macOS only)
- No additional requirements: For Electron testing
Test App Features
Each test app includes:
- Plugin Configuration: Test shared SQLite, TTL, prefetch settings
- Notification Scheduling: Basic daily notification setup
- Platform-Specific Features:
- Android: Exact alarm permissions, reboot recovery
- iOS: Rolling window management, BGTaskScheduler
- Electron: Mock implementations, IPC communication
- Performance Monitoring: Metrics collection and display
- Error Handling: Comprehensive error testing
- Debug Information: Platform-specific debug data
Test API Server
A mock REST API server (test-api/
) provides endpoints for testing the plugin's network functionality:
Quick Start
# Start the test API server
cd test-apps/test-api
npm install
npm start
# Test the API
npm run demo
Key Features
- Content Endpoints: Generate mock notification content
- ETag Support: Full HTTP caching with conditional requests
- Error Simulation: Test various error scenarios
- Metrics: Monitor API usage and performance
- CORS Enabled: Cross-origin requests supported
API Endpoints
GET /health
- Health checkGET /api/content/:slotId
- Get notification contentGET /api/error/:type
- Simulate errorsGET /api/metrics
- API metricsPUT /api/content/:slotId
- Update contentDELETE /api/content
- Clear all content
Platform-Specific URLs
- Web/Electron:
http://localhost:3001
- Android Emulator:
http://10.0.2.2:3001
- iOS Simulator:
http://localhost:3001
- Physical Devices:
http://[YOUR_IP]:3001
Platform-Specific Testing
Android Test App
- Exact Alarm Status: Check permission and capability
- Permission Requests: Test exact alarm permission flow
- Performance Metrics: Monitor Android-specific optimizations
- Reboot Recovery: Validate system restart handling
iOS Test App
- Rolling Window: Test notification limit management
- Background Tasks: Validate BGTaskScheduler integration
- Performance Metrics: Monitor iOS-specific optimizations
- Memory Management: Test object pooling and cleanup
Electron Test App
- Mock Implementations: Test web platform compatibility
- IPC Communication: Validate Electron-specific APIs
- Development Workflow: Test plugin integration
- Debug Information: Platform-specific status display
Running the Test Apps
Android
cd android-test
npm run dev # Web development server
npx cap open android # Open in Android Studio
npx cap run android # Run on device/emulator
iOS
cd ios-test
npm run dev # Web development server
npx cap open ios # Open in Xcode
npx cap run ios # Run on device/simulator
Electron
cd electron-test
npm start # Run Electron app
npm run dev # Run in development mode
Testing Checklist
Core Functionality
- Plugin configuration works
- Notification scheduling succeeds
- Error handling functions properly
- Performance metrics are accurate
Platform-Specific
- Android exact alarm permissions
- iOS rolling window management
- Electron mock implementations
- Cross-platform API consistency
Integration
- Plugin loads without errors
- Configuration persists across sessions
- Performance optimizations active
- Debug information accessible
Troubleshooting
Common Issues
- "Unknown command: cap" → Install Capacitor CLI:
npm install -g @capacitor/cli
- "android platform has not been added yet" → Run
npx cap add android
first - Build failures → Check Node.js version (18+) and clear cache:
npm cache clean --force
- Platform errors → Verify platform-specific SDKs are installed
Quick Fixes
# Check environment
./check-environment.sh
# Reinstall dependencies
rm -rf node_modules && npm install
# Clear Capacitor cache
npx cap clean
# Re-sync platforms
npx cap sync
Detailed Help
See Enhanced Setup Guide for comprehensive troubleshooting and platform-specific solutions.
Next Steps
- Run Setup Scripts: Execute platform-specific setup
- Test Core Features: Validate basic functionality
- Test Platform Features: Verify platform-specific capabilities
- Integration Testing: Test with actual plugin implementation
- Performance Validation: Monitor metrics and optimizations