asViewAction

fun Any.asViewAction(delayMillis: Long = DEFAULT_VIEW_ACTION_DELAY_MILLIS)

Convert anything to a ViewAction by looping the main thread for at least delayMillis. This is useful when the trigger of an action isn't a regular Espresso ViewAction e.g. some external events, but needs to participate in Espresso's internal synchronisation mechanisms to prevent the next ViewAction or Matcher from executing too early.