androidx.ui.test.android

Exceptions

ComposeNotIdleException

Thrown in cases where Compose can't get idle in Espresso's defined time limit.

Top-level functions summary

AndroidComposeTestRule<T>
createAndroidComposeRule(disableTransitions: Boolean = false, disableBlinkingCursor: Boolean = true)

Factory method to provide android specific implementation of createComposeRule, for a given activity class type T.

AndroidComposeTestRule<T>
createAndroidComposeRule(activityClass: Class<T>, disableTransitions: Boolean = false, disableBlinkingCursor: Boolean = true)

Factory method to provide android specific implementation of createComposeRule, for a given activityClass.

Unit

Register compose's idling check to Espresso.

Unit

Registers the given clock so Espresso can await the animations subscribed to that clock.

Unit

Unregisters resource registered as part of registerComposeWithEspresso.

Unit

Unregisters the clock that was registered with registerTestClock.

Top-level functions

createAndroidComposeRule

inline fun <reified T : ComponentActivity> createAndroidComposeRule(
    disableTransitions: Boolean = false,
    disableBlinkingCursor: Boolean = true
): AndroidComposeTestRule<T>

Deprecated.

Factory method to provide android specific implementation of createComposeRule, for a given activity class type T.

This method is useful for tests that require a custom Activity. This is usually the case for app tests. Make sure that you add the provided activity into your app's manifest file (usually in main/AndroidManifest.xml).

If you don't care about specific activity and just want to test composables in general, see createComposeRule.

createAndroidComposeRule

fun <T : ComponentActivity> createAndroidComposeRule(
    activityClass: Class<T>,
    disableTransitions: Boolean = false,
    disableBlinkingCursor: Boolean = true
): AndroidComposeTestRule<T>

Deprecated.

Factory method to provide android specific implementation of createComposeRule, for a given activityClass.

This method is useful for tests that require a custom Activity. This is usually the case for app tests. Make sure that you add the provided activity into your app's manifest file (usually in main/AndroidManifest.xml).

If you don't care about specific activity and just want to test composables in general, see createComposeRule.

registerComposeWithEspresso

fun registerComposeWithEspresso(): Unit

Register compose's idling check to Espresso.

This makes sure that Espresso is able to wait for any pending changes in Compose. This resource is automatically registered when any compose testing APIs are used including createAndroidComposeRule. If you for some reasons want to only use Espresso but still have it wait for Compose being idle you can use this function.

registerTestClock

fun registerTestClock(clock: TestAnimationClock): Unit

Registers the given clock so Espresso can await the animations subscribed to that clock.

unregisterComposeFromEspresso

fun unregisterComposeFromEspresso(): Unit

Unregisters resource registered as part of registerComposeWithEspresso.

unregisterTestClock

fun unregisterTestClock(clock: TestAnimationClock): Unit

Unregisters the clock that was registered with registerTestClock.