Repository navigation
Conversation
rcadeaux
force-pushed
the
rcadeaux/other-components
branch
from
November 11, 2026 19:51
ca91aab to
d7d6816
Compare
|
Readiness review confirmed:
Ready for Google review 👍 |
rcadeaux
force-pushed
the
rcadeaux/other-components
branch
from
November 20, 2026 20:36
8d7af13 to
d39b104
Compare
rcadeaux
force-pushed
the
rcadeaux/other-components
branch
from
November 21, 2026 05:59
d39b104 to
605c753
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR migrates 27 Kotlin testing code snippets from the Android services, modern UI Automator, and legacy UI Automator testing documentation guides into
:compose:snippetsundercom.example.compose.snippets.test.othercomponents.Pages updated:
List of modifications:
gradle/libs.versions.toml&compose/snippets/build.gradle.kts: Addedandroidx.test:rules(libs.androidx.test.rules) andcom.google.truth:truth(libs.truth), and updatedandroidx.test.uiautomator:uiautomator(libs.androidx.test.uiautomator) from2.3.0to2.4.1soServiceTestRuleand UI Automator snippets compile inandroidTest.compose/snippets/src/androidTest/java/com/example/compose/snippets/test/othercomponents/(ServiceSnippets.kt,UiAutomatorSnippets.kt, andUiAutomatorLegacySnippets.kt): Placed the 3 snippet files in thecom.example.compose.snippets.test.othercomponentssub-package so top-level helper declarations (MainActivity,SomeActivity,LocalService) remain isolated from other test snippet files, noted above eachandroidTest-only helper class that the real component normally lives insrc/main, and ran./gradlew :compose:snippets:spotlessApplyto re-indent 2-space blocks to 4-space Kotlin style (including wrappinggetLaunchIntentForPackage(inandroid_testing_other_components_ui_automator_legacy_home_screen).compose/snippets/src/androidTest/java/com/example/compose/snippets/test/othercomponents/UiAutomatorSnippets.kt(android_testing_other_components_ui_automator_lifecycleandandroid_testing_other_components_ui_automator_permission_watcher): UpdatedclearAppData("com.example.targetapp")toclearAppData()andstartIntent(myIntent)tostartActivityIntent(myIntent)to match theUiAutomatorTestScopesignatures inandroidx.test.uiautomator:uiautomator:2.4.1, commented the printed// import androidx.test.uiautomator.PermissionDialogstatement verbatim insideandroid_testing_other_components_ui_automator_permission_watcherwhile importing the realandroidx.test.uiautomator.watcher.PermissionDialogat the top of the file (flagged for the documentation team to decide whether to update the printed import in the guide page), and added trailing periods to natural-language comments.compose/snippets/src/androidTest/java/com/example/compose/snippets/test/othercomponents/UiAutomatorSnippets.kt(android_testing_other_components_ui_automator_wait_stableandandroid_testing_other_components_ui_automator_screenshots): Fixeduiautomator {typo touiAutomator {inandroid_testing_other_components_ui_automator_screenshots, updatedactiveWindow()todevice.activeWindow()to matchUiDevice.activeWindow()inandroidx.test.uiautomator:uiautomator:2.4.1, and added trailing periods to natural-language comments. (Note for documentation prose follow-up on/training/testing/other-components/ui-automator: the migration reference table at the bottom of the guide page still listsactiveWindow().waitForStable()without thedevice.receiver, and the Macrobenchmark prose mentionsstartIntent()instead ofstartActivityIntent().)compose/snippets/src/androidTest/java/com/example/compose/snippets/test/othercomponents/UiAutomatorSnippets.kt(android_testing_other_components_ui_automator_scope,android_testing_other_components_ui_automator_on_element,android_testing_other_components_ui_automator_on_element_or_null,android_testing_other_components_ui_automator_on_elements,android_testing_other_components_ui_automator_chained,android_testing_other_components_ui_automator_timeout,android_testing_other_components_ui_automator_interact,android_testing_other_components_ui_automator_wait_visible,android_testing_other_components_ui_automator_pip_window, andandroid_testing_other_components_ui_automator_results_reporter): Added trailing periods to natural-language comments.compose/snippets/src/androidTest/java/com/example/compose/snippets/test/othercomponents/UiAutomatorLegacySnippets.kt(android_testing_other_components_ui_automator_legacy_home_screenandandroid_testing_other_components_ui_automator_legacy_calculator_setup): Replaced the deprecatedandroidx.test.runner.AndroidJUnit4runner withandroidx.test.ext.junit.runners.AndroidJUnit4(both the real import and the commented printed import inandroid_testing_other_components_ui_automator_legacy_home_screen) without@Suppress("DEPRECATION"), commented printedimportstatements and...elision markers with real imports at the top of the file, used null-safe?.applyonPackageManager.getLaunchIntentForPackage(...)(Intent?) soaddFlags(...)compiles, and added trailing periods to natural-language comments.compose/snippets/src/androidTest/java/com/example/compose/snippets/test/othercomponents/UiAutomatorLegacySnippets.kt(android_testing_other_components_ui_automator_legacy_system_clock): Fixed Java variable syntaxUiObject2 clock = ...inside the Kotlin block toval clock: UiObject2 = ....compose/snippets/src/androidTest/java/com/example/compose/snippets/test/othercomponents/UiAutomatorLegacySnippets.kt(android_testing_other_components_ui_automator_legacy_calculator_testandandroid_testing_other_components_ui_automator_legacy_turn_off_dnd): Added trailing periods to natural-language comments.Snippets not migrated:
/training/testing/other-components/content-providers: 1 deprecatedProviderTestCase2Kotlin snippet (setUp(), left hardcoded on the guide page for a follow-up migration rather than suppressing deprecation warnings or adding legacyandroid.test.*libraries) and 1 obsolete Java counterpart (setUp())./training/testing/other-components/services: 2 obsolete Java counterparts (serviceRuleandtestWithBoundService())./training/testing/other-components/ui-automator: 2 Gradle dependency configuration snippets (build.gradle.ktsandbuild.gradleandroidTestImplementation)./training/testing/other-components/ui-automator-legacy: 2 Gradle dependency configuration snippets, 1 CLI shell invocation ($ uiautomatorviewer), and 11 obsolete Java counterparts (6 in the main guide page and 5 in the included system settings section).