mattermost-push-plugin/docs/android-test-environment.md
toki 538e8d0d78 update roadmap and documentation
- Update README.md and example/README.md
- Update agent-ops/roadmap/current.md and PHASE.md
- Archive self-contained-test-harness.md milestone
- Add docs/ directory
2026-05-25 21:55:31 +09:00

104 lines
3 KiB
Markdown

# Android Test Environment
This repository can use `toki@toki-labs.com` as a separate Android test
environment when the local machine does not have an Android SDK, device, or
emulator.
## Remote Host
- SSH target: `toki@toki-labs.com`
- Flutter SDK: `/Users/toki/SDK/flutter/bin/flutter`
- Android SDK: `/Users/toki/Library/Android/sdk`
- Known usable AVD: `Pixel_6_Pro_API_34`
Use these environment variables for every remote Android test session:
```sh
export PATH="$HOME/SDK/flutter/bin:$HOME/Library/Android/sdk/emulator:$HOME/Library/Android/sdk/platform-tools:$HOME/Library/Android/sdk/cmdline-tools/latest/bin:$PATH"
export ANDROID_HOME="$HOME/Library/Android/sdk"
export ANDROID_SDK_ROOT="$ANDROID_HOME"
```
## Sync A Working Copy
From the local repository root, copy the current working tree to an isolated
remote directory. This is useful when local changes are not committed yet.
```sh
REMOTE_DIR='$HOME/tmp/mattermost-push-plugin-codex-test'
tar \
--exclude='./.git' \
--exclude='./.dart_tool' \
--exclude='./build' \
--exclude='./example/.dart_tool' \
--exclude='./example/build' \
--exclude='./example/android/.gradle' \
--exclude='./android/.gradle' \
--exclude='./.gradle' \
-czf - . \
| ssh toki@toki-labs.com "rm -rf \"$REMOTE_DIR\" && mkdir -p \"$REMOTE_DIR\" && tar -xzf - -C \"$REMOTE_DIR\""
```
## Start The Android Emulator
Connect to the host and start the Android emulator if no Android device is
already connected.
```sh
ssh toki@toki-labs.com
export PATH="$HOME/SDK/flutter/bin:$HOME/Library/Android/sdk/emulator:$HOME/Library/Android/sdk/platform-tools:$HOME/Library/Android/sdk/cmdline-tools/latest/bin:$PATH"
export ANDROID_HOME="$HOME/Library/Android/sdk"
export ANDROID_SDK_ROOT="$ANDROID_HOME"
flutter emulators
flutter emulators --launch Pixel_6_Pro_API_34
```
For non-interactive sessions, a headless launch also works:
```sh
nohup emulator -avd Pixel_6_Pro_API_34 -no-window -no-audio -no-boot-anim -gpu swiftshader_indirect > "$HOME/tmp/pixel6pro-api34-emulator.log" 2>&1 &
```
Wait until the emulator is ready:
```sh
adb wait-for-device
until [ "$(adb shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')" = "1" ]; do sleep 2; done
adb devices
```
## Run The Checks
Run the deterministic Flutter checks:
```sh
cd "$HOME/tmp/mattermost-push-plugin-codex-test"
flutter analyze
flutter test
cd example
flutter analyze
flutter test
flutter test integration_test -d emulator-5554
```
Run Android Gradle unit tests:
```sh
cd "$HOME/tmp/mattermost-push-plugin-codex-test/example/android"
./gradlew testDebugUnitTest
```
## Interpreting Results
- `flutter test integration_test -d emulator-5554` verifies plugin registration,
method-channel calls, EventChannel delivery, and opened-routing through the
Android host app.
- `./gradlew testDebugUnitTest` verifies the Android unit-test layer and proves
the Android SDK path is usable.
- Real Firebase FCM delivery, Mattermost ACK delivery, inline reply, and dismiss
behavior remain manual smoke checks because they require external service
configuration.