hoangsonww / hoangsonww/Diffuse-Native-Apps
Deepen the Android instrumentation suite — 15 device tests against 627 on Apple
- Dominant language
- Swift
- Stars
- 2
- Forks
- 0
- Avg merge
- 1h 53m
- Merged PRs (30d)
- 14
Description
## Motivation
The Android CI run on `c62d571` reports `Starting 15 tests on emulator-5554`. The Apple side runs 627. JaCoCo holds `com.diffuse.android.domain` at 90% line coverage, but that gate deliberately covers only the pure Kotlin engine — every genuinely Android-shaped behaviour is verified by those 15 instrumented tests.
That leaves the risky half thin: `AndroidCollectors.kt` is 437 lines of platform API calls, `MainActivity.kt` is 593 lines of Compose UI including adaptive navigation, dialogs, and the import/export surfaces, and `SnapshotWorker`/`CaptureCoordinator` own scheduling and failure isolation. The Apple family has explicit invariant suites for exactly these concerns; Android does not, so a regression in a collector or in the navigation rail would very likely ship.
## Proposed Solution
Grow `Android/app/src/androidTest/` to cover the behaviours the Apple invariant suites already pin. Priorities, roughly in order of risk: every collector returning a well-formed section with correct privacy classifications on its descriptors; `CaptureCoordinator` isolating a hanging or throwing collector into a section status rather than failing the snapshot; `SnapshotWorker` honouring the 15-minute floor and skip-if-unchanged; adaptive navigation crossing the 720dp bottom-bar/rail threshold in both directions; destructive confirmations actually cancelling; and import/export round-tripping a fixture.
Now that the emulator job finishes in under five minutes with KVM and AVD caching, there is headroom for a much larger suite.
## Acceptance Criteria
- [ ] Each collector in `collectors/` has an instrumented test asserting shape and privacy classification
- [ ] Collector failure and timeout isolation is proven on-device, not only in the JVM suite
- [ ] Scheduling floor and skip-if-unchanged are covered against real `WorkManager`
- [ ] Navigation, rotation, and the 720dp threshold are asserted in both directions
- [ ] Destructive confirmations verified to cancel without deleting
- [ ] Import/export round-trips a repository fixture on-device
- [ ] Suite stays under the job's 45-minute budget
## Additional Context
See `Documentation/Testing.md` for where a test belongs, and the README's "Design principles encoded in tests" for the invariants worth mirroring.
Contributor guide
Assessment
This issue has not been assessed yet.