最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to do Idling resource when instrumental testing with Jetpack Compose - Stack Overflow

programmeradmin11浏览0评论

So, I have use Espresso library's waitUntilDoesNotExist which take two arguments SemanticsMatcher and timeoutMillis. By default, timeoutMillis is 1000ms but in my case i have to increase it 2000ms because it takes more time then 1000ms to complete the network call to register.

@get: Rule
val composeRule = createAndroidComposeRule<MainActivity>()

@OptIn(ExperimentalTestApi::class)
@Test
fun validateRegisterFormButtonIsClickAndShowEmailAlreadyExits() {
    composeRule.apply {
        onNodeWithTag("RegistrationForm").assertIsDisplayed()
        onNodeWithTag("User Name").assertIsDisplayed().performTextInput("Nizam")
        onNodeWithTag("Email").assertIsDisplayed().performTextInput("[email protected]")
        onNodeWithTag("Password").assertIsDisplayed().performTextInput("Nizam@123")
        onNodeWithTag("Confirm Password").assertIsDisplayed().performTextInput("Nizam@123")
        onNodeWithTag("Register").assertIsDisplayed().performClick()
        waitUntilDoesNotExist(hasTestTag("progress"),2000)
        onNodeWithText("([email protected])-email already exists").assertIsDisplayed()
    }
}

I know this is very flaky solution, but can you help to Idle the resource just until network API response comes.

发布评论

评论列表(0)

  1. 暂无评论