# Enhanced Test Apps Setup Guide ## Overview This guide creates minimal Capacitor test apps for validating the Daily Notification Plugin across all target platforms with robust error handling and clear troubleshooting. ## Prerequisites ### Required Software - **Node.js 18+**: Download from [nodejs.org](https://nodejs.org/) - **npm**: Comes with Node.js - **Git**: For version control ### Platform-Specific Requirements #### Android - **Android Studio**: Download from [developer.android.com/studio](https://developer.android.com/studio) - **Android SDK**: Installed via Android Studio - **Java Development Kit (JDK)**: Version 11 or higher #### iOS (macOS only) - **Xcode**: Install from Mac App Store - **Xcode Command Line Tools**: `xcode-select --install` - **iOS Simulator**: Included with Xcode #### Electron - **No additional requirements**: Works on any platform with Node.js ## Quick Start ### Option 1: Automated Setup (Recommended) ```bash # Navigate to test-apps directory cd test-apps # Setup all platforms (run from test-apps directory) ./setup-android.sh ./setup-ios.sh ./setup-electron.sh ``` ### Option 2: Manual Setup #### Android Manual Setup ```bash cd test-apps/android-test # Install dependencies npm install # Install Capacitor CLI globally npm install -g @capacitor/cli # Initialize Capacitor npx cap init "Daily Notification Android Test" "com.timesafari.dailynotification.androidtest" # Add Android platform npx cap add android # Build web assets npm run build # Sync to native npx cap sync android ``` #### iOS Manual Setup ```bash cd test-apps/ios-test # Install dependencies npm install # Install Capacitor CLI globally npm install -g @capacitor/cli # Initialize Capacitor npx cap init "Daily Notification iOS Test" "com.timesafari.dailynotification.iostest" # Add iOS platform npx cap add ios # Build web assets npm run build # Sync to native npx cap sync ios ``` #### Electron Manual Setup ```bash cd test-apps/electron-test # Install dependencies npm install # Build web assets npm run build-web ``` ## Common Issues and Solutions ### Issue: "Unknown command: cap" **Solution**: Install Capacitor CLI globally ```bash npm install -g @capacitor/cli ``` ### Issue: "android platform has not been added yet" **Solution**: Add the Android platform first ```bash npx cap add android ``` ### Issue: "Failed to add Android platform" **Solutions**: 1. Install Android Studio and Android SDK 2. Set `ANDROID_HOME` environment variable 3. Add Android SDK tools to your PATH ### Issue: "Failed to add iOS platform" **Solutions**: 1. Install Xcode from Mac App Store 2. Install Xcode Command Line Tools: `xcode-select --install` 3. Ensure you're running on macOS ### Issue: Build failures **Solutions**: 1. Check Node.js version: `node --version` (should be 18+) 2. Clear npm cache: `npm cache clean --force` 3. Delete `node_modules` and reinstall: `rm -rf node_modules && npm install` ## Platform-Specific Setup ### Android Setup Verification ```bash # Check Android Studio installation which studio # Check Android SDK echo $ANDROID_HOME # Check Java java -version ``` **Required Environment Variables**: ```bash export ANDROID_HOME=/path/to/android/sdk export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools ``` ### iOS Setup Verification ```bash # Check Xcode installation xcodebuild -version # Check iOS Simulator xcrun simctl list devices # Check Command Line Tools xcode-select -p ``` ### Electron Setup Verification ```bash # Check Node.js version node --version # Check npm npm --version # Test Electron installation npx electron --version ``` ## Running the Test Apps ### Android ```bash cd test-apps/android-test # Web development server (for testing) npm run dev # Open in Android Studio npx cap open android # Run on device/emulator npx cap run android ``` ### iOS ```bash cd test-apps/ios-test # Web development server (for testing) npm run dev # Open in Xcode npx cap open ios # Run on device/simulator npx cap run ios ``` ### Electron ```bash cd test-apps/electron-test # Run Electron app npm start # Run in development mode npm run dev # Build and run npm run electron ``` ## Testing Workflow ### 1. Web Testing (Recommended First) ```bash # Test each platform's web version first cd test-apps/android-test && npm run dev cd test-apps/ios-test && npm run dev cd test-apps/electron-test && npm start ``` ### 2. Native Testing ```bash # After web testing succeeds, test native platforms cd test-apps/android-test && npx cap run android cd test-apps/ios-test && npx cap run ios ``` ### 3. Integration Testing - Test plugin configuration - Test notification scheduling - Test platform-specific features - Test error handling - Test performance metrics ## Troubleshooting Checklist ### General Issues - [ ] Node.js 18+ installed - [ ] npm working correctly - [ ] Capacitor CLI installed globally - [ ] Dependencies installed (`npm install`) ### Android Issues - [ ] Android Studio installed - [ ] Android SDK configured - [ ] `ANDROID_HOME` environment variable set - [ ] Java JDK 11+ installed - [ ] Android platform added (`npx cap add android`) ### iOS Issues - [ ] Xcode installed (macOS only) - [ ] Xcode Command Line Tools installed - [ ] iOS Simulator available - [ ] iOS platform added (`npx cap add ios`) ### Electron Issues - [ ] Node.js working correctly - [ ] Dependencies installed - [ ] Web assets built (`npm run build-web`) ## Development Tips ### Web Development - Use `npm run dev` for hot reloading - Test plugin APIs in browser console - Use browser dev tools for debugging ### Native Development - Use `npx cap sync` after making changes - Check native logs for detailed errors - Test on both physical devices and simulators ### Debugging - Check console logs for errors - Use `npx cap doctor` to diagnose issues - Verify platform-specific requirements ## Next Steps 1. **Run Setup Scripts**: Execute platform-specific setup 2. **Test Web Versions**: Validate basic functionality 3. **Test Native Platforms**: Verify platform-specific features 4. **Integration Testing**: Test with actual plugin implementation 5. **Performance Validation**: Monitor metrics and optimizations ## Support If you encounter issues not covered in this guide: 1. Check the [Capacitor Documentation](https://capacitorjs.com/docs) 2. Verify platform-specific requirements 3. Check console logs for detailed error messages 4. Ensure all prerequisites are properly installed