Fix screenshot tests: freeze animation clock to prevent AppNotIdleException

Disable mainClock.autoAdvance in captureForDevice and captureMultiTheme
before calling onRoot(), so infinite animations (e.g. NiaLoadingWheel)
don't block Espresso idle synchronization in Compose 1.8.0.
pull/2064/head
Mercury Li 3 weeks ago
parent 0fe9f19b50
commit a367288706

@ -110,6 +110,9 @@ fun <A : ComponentActivity> AndroidComposeTestRule<ActivityScenarioRule<A>, A>.c
}
}
// Freeze animations so infinite transitions don't block Espresso idle sync
this.mainClock.autoAdvance = false
// Run Accessibility checks first so logging is included
val accessibilityException = try {
this.onRoot().checkRoboAccessibility(
@ -201,6 +204,9 @@ fun <A : ComponentActivity> AndroidComposeTestRule<ActivityScenarioRule<A>, A>.c
}
}
// Freeze animations so infinite transitions don't block Espresso idle sync
this.mainClock.autoAdvance = false
// Create permutations
darkModeValues.forEach { isDarkMode ->
darkMode = isDarkMode

Loading…
Cancel
Save