Created
November 30, 2021 00:36
-
-
Save timusus/07b4324045fc9d8d29962976b3746638 to your computer and use it in GitHub Desktop.
Compose Elapsed Time Idling Resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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