Status Update
Comments
ti...@google.com <ti...@google.com>
as...@google.com <as...@google.com> #2
You can provide your own regex to By.text()
.
For example, By.text(Pattern.compile("All albums.*", Pattern.DOTALL))
should be equivalent to a multi-line startsWith.
ms...@hubspot.com <ms...@hubspot.com> #3
I'm probably dumb but why would it be the default and wanted behavior if not documented properly?
Every known startWith / contains function in Java/Kotlin are multiline, the javadoc says: A UI element will be considered a match if its text value starts with the substring parameter
Many people will fall into this non standard default behavior and loose tons of time trying to figure out why.
If you still consider this default is the correct one, then please document it.
bl...@gmail.com <bl...@gmail.com> #4
Branch: androidx-main
commit 1625e615b9aed44323029da2726a57390956e4ab
Author: Daniel Peykov <peykov@google.com>
Date: Wed Nov 02 21:46:28 2022
Support multiline text and description matching
* Fixes inconsistency between UiSelector (partial support) and
BySelector, and clarifies the case sensitivity of related methods.
* Also, reorganizes byselector_test_activity to decrease its height
which was right up to the limit on some device types.
Bug: 255787130
Test: ./gradlew :test:uiautomator:integration-tests:t:cAT
Change-Id: Ied9eff43ce4ce6f2ace2889a55b0382e71604b61
M test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/BySelectorTest.java
M test/uiautomator/integration-tests/testapp/src/main/res/layout/byselector_test_activity.xml
M test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/BySelector.java
M test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiSelector.java
M test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/Until.java
ms...@hubspot.com <ms...@hubspot.com> #5
Will be fixed in version 2.3.0-alpha02.
To clarify
However, looking at this again, it was inconsistent between UiSelector and BySelector, and users are unlikely to be relying on single line matching.
as...@google.com <as...@google.com> #6
Thanks a lot for the change.
I understand legacy and everything, it was just the close without discussion about proper solution (including doc that would have worked too) that was strange.
Seeing the $ in the regexp took me time, and it's good to avoid this to other users when improvement is possible.
ms...@hubspot.com <ms...@hubspot.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.test.uiautomator:uiautomator:2.3.0-alpha02
ys...@google.com <ys...@google.com> #8
Able to reproduce it with a commit to a github project.
Similar issue
Fails with
HansieClockTest > DeviceClockScreenshotTest > ClockScreenshotTest
Works with
HansieClockTest > ClockScreenshotTest
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit 7b2229e4d21425ca60a72478032d0f773a8766f9
Author: Andrei Shikov <ashikov@google.com>
Date: Mon Mar 04 11:46:23 2024
Remap composable type on overridden functions of all dependencies
Compose compiler remaps types of immediately overridden function, but doesn't do so for base functions.
Fixes: 316196500
Test: add a cross module compilation test
Change-Id: I2c9f96f279736034e968bd20032c50e6de39f096
M compose/compiler/compiler-hosted/integration-tests/src/androidUnitTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposeCrossModuleTests.kt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposableTypeRemapper.kt
pr...@google.com <pr...@google.com> #10
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.compiler:compiler-hosted:1.5.11
Description
Jetpack Compose component(s) used: compiler, ui, ui-test, ui-tooling
Android Studio Build:2023.2.1 Canary 14
Kotlin version:1.9.21
Steps to Reproduce or Code Sample to Reproduce:
We use paparazzi for screenshot testing, this is setup with a base test class which accepts a composable lambda.
Since updating compose-compiler, this function throws a ClassCastException
Stack trace (if applicable):
```
FullScreenPreviewTopBarScreenshotTest > testFullScreenPreviewTopBar[PIXEL_5_LIGHT_LARGE_FONT] FAILED
java.lang.ClassCastException: class androidx.compose.runtime.internal.ComposableLambdaImpl cannot be cast to class kotlin.jvm.functions.Function0 (androidx.compose.runtime.internal.ComposableLambdaImpl and kotlin.jvm.functions.Function0 are in unnamed module of loader 'app')
at com.x.android.files.preview.composables.FullScreenPreviewTopBarScreenshotTest.testFullScreenPreviewTopBar(FullScreenPreviewTopBarScreenshotTest.kt:10)
```
Test function
```
@Test
fun testFullScreenPreviewTopBar() =
runScreenshotTest {
FullScreenPreviewTopBarPreview()
}
```
Base class function
```
fun runScreenshotTest(content: @Composable () -> Unit) =
runTest(UnconfinedTestDispatcher()) {
paparazzi.snapshot {
CompositionLocalProvider(LocalInspectionMode provides true) {
CanvasTheme(
content = wrapInTestSurface(content),
darkTheme = config.deviceConfig.nightMode == NightMode.NIGHT,
)
}
}
}
```