| name | test-apk |
| description | Test and debug Android APK features using a local Android emulator. Manages emulator lifecycle, builds/installs the APK, runs instrumentation tests, captures logcat diagnostics, and debugs WebView automation (imgur, postimages uploads). Use when the user asks to test APK, debug Android, test uploads, run emulator tests, or says "test-apk". |
Test APK on Android Emulator
Overview
Delegates APK testing to the dedicated test-apk subagent to keep the main context clean.
That subagent manages the emulator, builds and installs only when needed, executes the requested tests, and returns structured diagnostics.
Workflow
Step 1: Collect Test Requirements
Ask the user (or infer from context) what to test. Common scenarios:
| Scenario | What to run |
|---|
| WebView upload debugging (imgur/postimages) | Instrumentation tests + logcat |
| Live upload test | yarn live:postimages:auto or custom instrumentation |
| Full connected test suite | yarn android:connectedTest |
| Specific instrumentation class | Custom ./gradlew connectedDebugAndroidTest with class filter |
| Manual APK interaction | Build, install, launch, capture logcat |
| Contract tests (fixtures) | yarn contract:postimages |
Step 2: Delegate to the test-apk Subagent
Spawn the test-apk subagent with the prompt template below, filling in {TEST_DESCRIPTION} with the user's requirements and any exact commands or classes you want run.
Use the Task tool:
subagent_type: "test-apk"
prompt: <see Prompt Template below>