0

After updating Kotlin to 2.2.0, my autotest started failing on the start screen with the following error in Espresso class on compose view:

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1

However, my autotest does not use any indexing operations. and this issue is not related to the UI. I also noticed that the application now loads more slowly. As a result, the autotest begins its checks before the app is fully loaded. Previously, this wasn’t a problem—the test would pass thanks to the built-in waits. text error:

java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at androidx.test.espresso.Espresso.onIdle(Espresso.java:357)
at androidx.test.espresso.Espresso.onIdle(Espresso.java:378)
at androidx.compose.ui.test.EspressoLink_androidKt.runEspressoOnIdle(EspressoLink.android.kt:88)
at androidx.compose.ui.test.EspressoLink.runUntilIdle(EspressoLink.android.kt:82)
at androidx.compose.ui.test.AndroidComposeUiTestEnvironment.waitForIdle(ComposeUiTest.android.kt:596)
at androidx.compose.ui.test.AndroidComposeUiTestEnvironment.access$waitForIdle(ComposeUiTest.android.kt:391)
at androidx.compose.ui.test.AndroidComposeUiTestEnvironment$AndroidTestOwner.getRoots(ComposeUiTest.android.kt:822)
at androidx.compose.ui.test.TestOwnerKt.getAllSemanticsNodes(TestOwner.kt:81)
at androidx.compose.ui.test.SemanticsNodeInteraction.fetchSemanticsNodes$ui_test_release(SemanticsNodeInteraction.kt:64)
at androidx.compose.ui.test.SemanticsNodeInteraction.fetchSemanticsNodes$ui_test_release$default(SemanticsNodeInteraction.kt:59)
at androidx.compose.ui.test.AndroidAssertions_androidKt.checkIsDisplayed(AndroidAssertions.android.kt:29)
at androidx.compose.ui.test.AssertionsKt.isDisplayed(Assertions.kt:351)
at androidx.compose.ui.test.AssertionsKt.assertIsDisplayed(Assertions.kt:33)
at io.github.kakaocup.compose.node.assertion.NodeAssertions$assertIsDisplayed$1.invoke(NodeAssertions.kt:13)
at io.github.kakaocup.compose.node.assertion.NodeAssertions$assertIsDisplayed$1.invoke(NodeAssertions.kt:13)
.......
5
  • This happened after updating androidx.compose:compose-bom:2025.09.01 Commented Nov 4 at 8:39
  • Do you happen to be using a LazyList/LazyGrid in the start screen? There appears to be a known bug from UI testing especially with a custom scroll to a specific item Commented Nov 5 at 7:44
  • You could try adding the standard test dispatcher to your Compose JUnit 4 rule as mentioned in the 9th comment of that issue (i.e. @get:Rule val rule = createComposeRule(StandardTestDispatcher())) Commented Nov 5 at 7:46
  • Also, that bug fix appears to have landed in Compose Foundation 1.10.0-beta01 (source: checked manually in the IDE) so you might want to try using that version Commented Nov 5 at 7:48
  • Upgrading the androidx-compose-foundation version to 1.10.0-beta01 actually helped. I’m not sure if the developers will allow me to use a beta version, but thank you! Do you know if there is any article about this issue? Commented Nov 6 at 7:50

1 Answer 1

0

Upgrading the androidx-compose-foundation version to 1.10.0-beta01 actually helped. I’m not sure if the developers will allow me to use a beta version, but thank you!
Do you know if there is any article about this issue?

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.