Fixed
Status Update
Comments
pa...@google.com <pa...@google.com> #2
One thing to check here: Developers might be using different facilities to launch Activities rather than just ActivityTestRule. Example is ActivityScenario (https://developer.android.com/reference/androidx/test/core/app/ActivityScenario ). So we should make sure we don't enforce our solution to be used only with ActivityTestRule. Other option would be to have ComposeTestRule that does only synchronization (and can be used anywhere) and ActivityComposeTestRule that does what ComposeTestRule does now.
je...@google.com <je...@google.com> #3
Good point. For now I'll upload a CL that makes AndroidComposeTestRule accept an ActivityTestRule though, to at least accommodate some of our user base.
I agree that long term it should be what you propose though, in which case we can remove the special handling for ActivityTestRule again.
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit c67b052c109fc0abf5cbae0d5fe908fd44816be1
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Apr 09 12:03:55 2020
Supply your own ActivityTestRule to AndroidComposeTestRule
Make it possible to pass your own ActivityTestRule to
AndroidComposeTestRule. This allows testers to still use ComposeTestRule
when they need their own ActivityTestRule.
Bug: 153623653
Test: ./gradlew ui:ui-test:cC
Relnote: "You can now pass a custom ActivityTestRule to
AndroidComposeTestRule"
Change-Id: I38206d4d2fc4c9b21693132b4300f31d9f7e1b75
M ui/ui-test/api/0.1.0-dev10.txt
M ui/ui-test/api/current.txt
M ui/ui-test/api/public_plus_experimental_0.1.0-dev10.txt
M ui/ui-test/api/public_plus_experimental_current.txt
M ui/ui-test/api/restricted_0.1.0-dev10.txt
M ui/ui-test/api/restricted_current.txt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FirstDrawTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/MultipleActivitiesFirstDrawTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/SendClickTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/ComposeTestRule.kt
M ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestRule.kt
https://android-review.googlesource.com/1283933
Branch: androidx-master-dev
commit c67b052c109fc0abf5cbae0d5fe908fd44816be1
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Apr 09 12:03:55 2020
Supply your own ActivityTestRule to AndroidComposeTestRule
Make it possible to pass your own ActivityTestRule to
AndroidComposeTestRule. This allows testers to still use ComposeTestRule
when they need their own ActivityTestRule.
Bug: 153623653
Test: ./gradlew ui:ui-test:cC
Relnote: "You can now pass a custom ActivityTestRule to
AndroidComposeTestRule"
Change-Id: I38206d4d2fc4c9b21693132b4300f31d9f7e1b75
M ui/ui-test/api/0.1.0-dev10.txt
M ui/ui-test/api/current.txt
M ui/ui-test/api/public_plus_experimental_0.1.0-dev10.txt
M ui/ui-test/api/public_plus_experimental_current.txt
M ui/ui-test/api/restricted_0.1.0-dev10.txt
M ui/ui-test/api/restricted_current.txt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FirstDrawTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/MultipleActivitiesFirstDrawTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/SendClickTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/ComposeTestRule.kt
M ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestRule.kt
je...@google.com <je...@google.com> #5
General solution as proposed by @pavlis will be addressed in
je...@google.com <je...@google.com>
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 5b0bebd168fded3237342e7aa9e7f039c5182dd2
Author: Filip Pavlis <pavlis@google.com>
Date: Mon Nov 09 18:01:52 2020
Removed dependency on specific activity rule
This removes dependency on ActivityScenarioRule from
AndroidComposeTestRule. Meaning that compose test rule can be used with
any lauchner from now on.
Test: N/A
Bug: 153623653
Bug: 154135019
Relnote: "AndroidComposeTestRule can now accept custom activity
launchers"
Change-Id: Ib828876d918f3f091b622bbeb62dd1a31c75badb
M compose/test-utils/src/androidAndroidTest/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunnerTest.kt
M compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/TestRuleExtensions.kt
M compose/ui/ui-test-junit4/api/current.txt
M compose/ui/ui-test-junit4/api/public_plus_experimental_current.txt
M compose/ui/ui-test-junit4/api/restricted_current.txt
M compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/AndroidComposeTestRule.kt
M compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/ui/test/AndroidComposeTestRule.kt
D compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestRule.kt
https://android-review.googlesource.com/1492916
Branch: androidx-master-dev
commit 5b0bebd168fded3237342e7aa9e7f039c5182dd2
Author: Filip Pavlis <pavlis@google.com>
Date: Mon Nov 09 18:01:52 2020
Removed dependency on specific activity rule
This removes dependency on ActivityScenarioRule from
AndroidComposeTestRule. Meaning that compose test rule can be used with
any lauchner from now on.
Test: N/A
Bug: 153623653
Bug: 154135019
Relnote: "AndroidComposeTestRule can now accept custom activity
launchers"
Change-Id: Ib828876d918f3f091b622bbeb62dd1a31c75badb
M compose/test-utils/src/androidAndroidTest/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunnerTest.kt
M compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/TestRuleExtensions.kt
M compose/ui/ui-test-junit4/api/current.txt
M compose/ui/ui-test-junit4/api/public_plus_experimental_current.txt
M compose/ui/ui-test-junit4/api/restricted_current.txt
M compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/AndroidComposeTestRule.kt
M compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/ui/test/AndroidComposeTestRule.kt
D compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestRule.kt
Description
Sincehttps://r.android.com/1282381 it is mandatory to use ComposeTestRule. This can be a problem for teams that have a custom ActivityTestRule with which they want to control their app's Activity, since they are now forced to use the rule created by AndroidComposeTestRule.
Solve this by adding the ActivityTestRule as a parameter to the AndroidComposeTestRule.