chore(test): migrate v1 createComposeRule/createAndroidComposeRule usages to v2 #458

Merged
JMR-dev merged 1 commits from chore-385-compose-rule-v2 into main 2026-07-08 20:35:00 +00:00
JMR-dev commented 2026-07-08 20:05:02 +00:00 (Migrated from github.com)

What

Migrates the deprecated v1 Compose test-rule factory createAndroidComposeRule to its v2 equivalent (androidx.compose.ui.test.junit4.v2) across the entire androidTest source set, clearing the Compose BOM 2026.06.00 deprecation warnings.

Why

Small chore under #373. Compose BOM 2026.06.00 deprecates the v1 test-rule factories in androidx.compose.ui.test.junit4 in favour of the ...junit4.v2 package. v2 composes on StandardTestDispatcher (consistent with runTest) instead of v1's UnconfinedTestDispatcher. The JVM (test) source set already migrated to the v2 createComposeRule in PR #375; this sweeps the remaining androidTest usages.

Changes

  • 30 androidTest classes: import swap only —
    androidx.compose.ui.test.junit4.createAndroidComposeRule →
    androidx.compose.ui.test.junit4.v2.createAndroidComposeRule.
  • v2's createAndroidComposeRule<A>() returns the same AndroidComposeTestRule<ActivityScenarioRule<A>, A> type, so every createAndroidComposeRule<ComponentActivity>() call site is unchanged.

Behaviour / dispatcher note

The v2 rule queues composition effects (StandardTestDispatcher) rather than running them eagerly. The migrated tests already wait on async state via waitUntil(...) / waitForIdle() (and all finders/assertions call waitForIdle() internally), and none manipulate mainClock/autoAdvance. So no test semantics needed adjusting.

Verification

Windows fast gate — all green (BUILD SUCCESSFUL in 3m 17s):
assembleDebug, testDebugUnitTest, jacocoTestCoverageVerification, compileDebugAndroidTestKotlin, lintDebug, ktlintCheck, detekt.

Instrumented E2E is validated by CI's multi-API matrix (the authoritative gate for a test-infra change).

Closes #385

## What Migrates the deprecated **v1** Compose test-rule factory `createAndroidComposeRule` to its **v2** equivalent (`androidx.compose.ui.test.junit4.v2`) across the entire `androidTest` source set, clearing the Compose BOM 2026.06.00 deprecation warnings. ## Why Small chore under #373. Compose BOM 2026.06.00 deprecates the v1 test-rule factories in `androidx.compose.ui.test.junit4` in favour of the `...junit4.v2` package. v2 composes on `StandardTestDispatcher` (consistent with `runTest`) instead of v1's `UnconfinedTestDispatcher`. The JVM (`test`) source set already migrated to the v2 `createComposeRule` in PR #375; this sweeps the remaining `androidTest` usages. ## Changes - **30 `androidTest` classes**: import swap only — `androidx.compose.ui.test.junit4.createAndroidComposeRule` → `androidx.compose.ui.test.junit4.v2.createAndroidComposeRule`. - v2's `createAndroidComposeRule<A>()` returns the **same** `AndroidComposeTestRule<ActivityScenarioRule<A>, A>` type, so every `createAndroidComposeRule<ComponentActivity>()` call site is unchanged. ## Behaviour / dispatcher note The v2 rule queues composition effects (StandardTestDispatcher) rather than running them eagerly. The migrated tests already wait on async state via `waitUntil(...)` / `waitForIdle()` (and all finders/assertions call `waitForIdle()` internally), and **none** manipulate `mainClock`/`autoAdvance`. So **no test semantics needed adjusting**. ## Verification Windows fast gate — all green (`BUILD SUCCESSFUL in 3m 17s`): `assembleDebug`, `testDebugUnitTest`, `jacocoTestCoverageVerification`, `compileDebugAndroidTestKotlin`, `lintDebug`, `ktlintCheck`, `detekt`. Instrumented E2E is validated by CI's multi-API matrix (the authoritative gate for a test-infra change). Closes #385
mergify[bot] commented 2026-07-08 20:29:28 +00:00 (Migrated from github.com)

Merge Queue Status

  • ✅ Entered queue — 2026-07-08 20:29 UTC · Rule: default · triggered by merge protections
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-07-08 20:35 UTC · at 2c35301756dd7ab9f9f27b736492fbc827922c37 · merge

This pull request spent 5 minutes 35 seconds in the queue, including 4 seconds running CI.

Required conditions to merge
<!--- DO NOT EDIT -*- Mergify Payload -*- {"version": 1, "state": "merged", "queue_rule_name": "default", "queued_at": "2026-07-08T20:29:26.009148+00:00", "estimated_time_of_merge": null, "speculative_check_pr": null, "required_conditions": []} -*- Mergify Payload End -*- --> # Merge Queue Status - ✅ **Entered queue** — `2026-07-08 20:29 UTC` · Rule: `default` · triggered by merge protections - ✅ **Checks skipped** · PR is already up-to-date - ✅ **Merged** — `2026-07-08 20:35 UTC` · at `2c35301756dd7ab9f9f27b736492fbc827922c37` · merge This pull request spent **5 minutes 35 seconds** in the queue, including **4 seconds** running CI. <details> <summary>Required conditions to merge</summary> - `-conflict` - [X] #458 - `-draft` - [X] #458 - [X] `base = main` - [X] `check-success = CI passed` - `github-review-approved` [🛡 GitHub repository ruleset rule `main`] - [X] #458 - `label != broken` - [X] #458 - [X] any of [🛡 GitHub branch protection]: - [X] `check-success = Debug build` - [ ] `check-neutral = Debug build` - [ ] `check-skipped = Debug build` - [X] any of [🛡 GitHub branch protection]: - [X] `check-success = Unit tests` - [ ] `check-neutral = Unit tests` - [ ] `check-skipped = Unit tests` - [X] any of [🛡 GitHub branch protection]: - [X] `check-success = CI passed` - [ ] `check-neutral = CI passed` - [ ] `check-skipped = CI passed` - [X] any of [🛡 GitHub repository ruleset rule `main`]: - [X] `check-success = @github-actions/CI passed` - [ ] `check-neutral = @github-actions/CI passed` - [ ] `check-skipped = @github-actions/CI passed` </details>
Sign in to join this conversation.