Skip to content

test(screenshot): Roborazzi screenshot testing — Phase 1 (Status) - #6

Merged
Kanyandula merged 1 commit into
mainfrom
feat/screenshot-testing-phase1
Jul 20, 2026
Merged

test(screenshot): Roborazzi screenshot testing — Phase 1 (Status)#6
Kanyandula merged 1 commit into
mainfrom
feat/screenshot-testing-phase1

Conversation

@Kanyandula

Copy link
Copy Markdown
Owner

What

Phase 1 proof-of-concept for visual regression testing: Roborazzi (JVM/Robolectric, no emulator), covering the Status screen. Reuses the existing Robolectric + isIncludeAndroidResources setup, so it runs inside the current build-and-test job.

Implements the strategy in docs/screenshot-testing-strategy.md (included).

Changes

  • Tooling: Roborazzi 1.32.0 — version catalog (3 libs + plugin), root/app build wiring, Compose BOM added to the test config.
  • Entrypoint: StatusContent promoted privateinternal so app/src/test can render it (the public StatusScreen(nav) pulls in Hilt/Nav).
  • Harness (ScreenshotTest): pins Locale.US + Europe/Dublin and provides a real English AssetJsonLanguage — the default LocalLanguage echoes dictionary keys, not text.
  • StatusScreenScreenshotTest: 5 baselines — all four ConnectionState chips (CONNECTED / CONNECTING / ERROR / DISCONNECTED) + redacted-recent.
  • Baselines: 5 PNGs committed under app/src/test/screenshots/ (1080×2340, dark theme).
  • CI: verifyRoborazziDebug added to the quality gate; diff images uploaded on failure.
  • Refreshed the StatusContent detekt baseline ID after the visibility change.

Determinism

Times render from fixed postTime + pinned locale/timezone; app icons resolve to null under Robolectric → deterministic fallback (no injection needed).

Verified

assembleDebug testDebugUnitTest verifyRoborazziDebug detekt lintDebug all green locally. ~14s added, no emulator.

Known risk

Baselines were recorded on macOS (Intel). Linux CI may render fonts slightly differently and fail verifyRoborazziDebug on first run. If so, the fix is to re-record baselines from CI (the Phase-2/3 "record on CI" decision) — not a code change. This PR is the deliberate test of that.

Scope (intentionally deferred)

Other 6 screens, component-level tests, font-scale/locale variants, branch-protection enforcement, CI-side baseline recording — Phases 2–4.

Introduce JVM/Robolectric screenshot testing via Roborazzi, reusing the
existing Robolectric + isIncludeAndroidResources setup — no emulator.

- Promote StatusContent to internal so app/src/test can render it.
- Shared ScreenshotTest harness pins Locale/TimeZone and provides a real
  English AssetJsonLanguage (the LocalLanguage default echoes keys).
- StatusScreenScreenshotTest: 5 baselines covering all four ConnectionState
  chips plus the redacted-recent variant.
- Wire verifyRoborazziDebug into the CI quality gate; upload diff images.
- Refresh the StatusContent detekt baseline ID after the internal change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant