Skip to content

Commit d3f21d0

Browse files
committed
Try waitUntil in another test
1 parent dffdff8 commit d3f21d0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.pcapplusplus.toyvpn
22

33
import androidx.compose.material3.Text
44
import androidx.compose.ui.test.assertIsDisplayed
5-
import androidx.compose.ui.test.assertIsEnabled
65
import androidx.compose.ui.test.assertTextEquals
76
import androidx.compose.ui.test.junit4.createComposeRule
87
import androidx.compose.ui.test.onNodeWithTag
@@ -102,7 +101,14 @@ class StatsScreenTest {
102101
fun testVpnConnected() {
103102
renderScreen()
104103

105-
composeTestRule.onNodeWithText("Disconnect").assertIsDisplayed().assertIsEnabled()
104+
composeTestRule.waitUntil(timeoutMillis = 10000) {
105+
try {
106+
composeTestRule.onNodeWithText("Disconnect").assertExists()
107+
true
108+
} catch (ex: AssertionError) {
109+
false
110+
}
111+
}
106112
}
107113

108114
@Test
@@ -205,7 +211,7 @@ class StatsScreenTest {
205211

206212
composeTestRule.waitUntil(timeoutMillis = 10000) {
207213
try {
208-
composeTestRule.onNodeWithText("Disconnecting...").fetchSemanticsNode()
214+
composeTestRule.onNodeWithText("Disconnecting...").assertExists()
209215
true
210216
} catch (ex: AssertionError) {
211217
false

0 commit comments

Comments
 (0)