Skip to content

Commit dffdff8

Browse files
committed
Try waitUntil
1 parent 3068c1c commit dffdff8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/src/androidTest/java/com/pcapplusplus/toyvpn/StatsScreenTest.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.pcapplusplus.toyvpn
33
import androidx.compose.material3.Text
44
import androidx.compose.ui.test.assertIsDisplayed
55
import androidx.compose.ui.test.assertIsEnabled
6-
import androidx.compose.ui.test.assertIsNotEnabled
76
import androidx.compose.ui.test.assertTextEquals
87
import androidx.compose.ui.test.junit4.createComposeRule
98
import androidx.compose.ui.test.onNodeWithTag
@@ -204,7 +203,14 @@ class StatsScreenTest {
204203
fun testVpnDisconnecting() {
205204
renderScreen(vpnConnectionState = VpnConnectionState.DISCONNECTING)
206205

207-
composeTestRule.onNodeWithText("Disconnecting...").assertIsDisplayed().assertIsNotEnabled()
206+
composeTestRule.waitUntil(timeoutMillis = 10000) {
207+
try {
208+
composeTestRule.onNodeWithText("Disconnecting...").fetchSemanticsNode()
209+
true
210+
} catch (ex: AssertionError) {
211+
false
212+
}
213+
}
208214
}
209215

210216
@Test

0 commit comments

Comments
 (0)