Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / clock / WEAR_E2E.md
| 1 | # Wear e2e (androidTest) — why there is no FullE2eTest yet |
| 2 | |
| 3 | Investigated 2026-11-25 for the (then separate) clock-wear module and |
| 4 | notes-wear. A wear `FullE2eTest` was **not** added, because it could not |
| 5 | compile or run honestly today. Clock has since merged into the single |
| 6 | `:clock` APK; the wear-AVD gaps below still block an on-watch e2e: |
| 7 | |
| 8 | 1. **No wear AVD.** `./test` hardcodes `EMULATOR_AVD=Medium_Phone` |
| 9 | (phone form factor, `hw.device.name=medium_phone`) and |
| 10 | `ensure_emulator_running` boots only that AVD. The SDK has one |
| 11 | system image (`android-36/google_apis/x86_64`) and no wear image, |
| 12 | and no `Wear_*`/round AVD exists in `~/.android/avd/`. |
| 13 | 2. **A phone AVD is not a watch run.** The merged `:clock` APK declares |
| 14 | the watch feature `required="false"` so it installs on both, but the |
| 15 | phone AVD does not report the watch feature, so `FormFactor` routes |
| 16 | it to the phone experience there; Wear Compose UI also assumes a |
| 17 | round/square watch viewport, so a phone run would not be a wear run. |
| 18 | 3. **No androidTest wiring in the wear convention.** |
| 19 | `build-logic/.../common-conventions-wear.gradle.kts` declares no |
| 20 | `testInstrumentationRunner` and no `androidTestImplementation` |
| 21 | (uiautomator/test runner) dependencies, unlike |
| 22 | `common-conventions-app` (lines ~547-563). An androidTest source set |
| 23 | in a wear module would not compile as-is. |
| 24 | 4. **The runner misclassifies wear modules.** `./test`'s |
| 25 | `is_app_module` only greps for `common-conventions-app`, so wear |
| 26 | modules fall into the library branch (`assembleDebug` / |
| 27 | library test-package naming) — wrong APK/test-APK handling for a |
| 28 | wear app. Wear modules also reuse the phone app's |
| 29 | `applicationId` (e.g. clock-wear = `com.vayunmathur.clock`) for the |
| 30 | WearLink signing handshake, so installing a wear APK onto the phone |
| 31 | AVD would collide with/replace the phone app. |
| 32 | |
| 33 | ## What would be needed |
| 34 | |
| 35 | - A wear system image + a round Wear AVD (e.g. `Wear_Small_Round`) |
| 36 | in the SDK/`~/.android/avd/`, and `./test` support for selecting it |
| 37 | per-module (wear modules → wear AVD, never Medium_Phone). |
| 38 | - `testInstrumentationRunner` + the same androidTest dependencies as |
| 39 | `common-conventions-app` in `common-conventions-wear`. |
| 40 | - `./test` treating `common-conventions-wear` as an app module with |
| 41 | the wear AVD (and not session-installing over the phone package on |
| 42 | a phone device). |
| 43 | |
| 44 | With those three, the representative journeys are ready to write in |
| 45 | the repo's UiAutomator-polling pattern: clock-wear launch → home |
| 46 | (alarms/timers/world-clock/stopwatch entries, empty-synced state |
| 47 | "No world clocks synced yet…") and notes-wear launch → |
| 48 | "No notes synced yet…" empty list → New note editor. Until then the |
| 49 | wear modules are covered by their JVM unit tests |
| 50 | (`:clock:wear:testDebugUnitTest`, notes-wear `src/test`) and Compose |
| 51 | screenshot tests, not by a faked phone-AVD run. |