Skip to content

Instantly share code, notes, and snippets.

@timusus
Created November 30, 2021 00:36
Show Gist options
  • Save timusus/07b4324045fc9d8d29962976b3746638 to your computer and use it in GitHub Desktop.
Save timusus/07b4324045fc9d8d29962976b3746638 to your computer and use it in GitHub Desktop.
Compose Elapsed Time Idling Resource
import androidx.compose.ui.test.IdlingResource
/**
* An [IdlingResource] which reports itself as idle until [waitingTime] has elapsed.
*/
class ElapsedTimeIdlingResource(private val waitingTime: Long) : IdlingResource {
var startTime: Long = System.currentTimeMillis()
override val isIdleNow: Boolean
get() = (System.currentTimeMillis() - startTime) >= waitingTime
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment