Skip to content

Commit f6dad16

Browse files
committed
Try adding composeTestRule.waitForIdle()
1 parent 542106f commit f6dad16

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class StatsScreenTest {
101101
fun testVpnConnected() {
102102
renderScreen()
103103

104+
composeTestRule.waitForIdle()
104105
composeTestRule.onNodeWithText("Disconnect").assertIsDisplayed().assertIsEnabled()
105106
}
106107

@@ -148,6 +149,7 @@ class StatsScreenTest {
148149
Triple("UDPConn", "UDP", udpConnectionCount),
149150
)
150151

152+
composeTestRule.waitForIdle()
151153
composeTestRule.onNodeWithText("Total Packets").assertIsDisplayed().onSibling().assertTextEquals(totalPacketCount.toString())
152154

153155
expectedValues.forEach { (testTag, label, count) ->
@@ -194,6 +196,7 @@ class StatsScreenTest {
194196
renderScreen()
195197

196198
composeTestRule.onNodeWithText("Disconnect").performClick()
199+
composeTestRule.waitForIdle()
197200

198201
verify { mockViewModel.disconnectVpn() }
199202
}
@@ -202,6 +205,7 @@ class StatsScreenTest {
202205
fun testVpnDisconnecting() {
203206
renderScreen(vpnConnectionState = VpnConnectionState.DISCONNECTING)
204207

208+
composeTestRule.waitForIdle()
205209
composeTestRule.onNodeWithText("Disconnecting...").assertIsDisplayed().assertIsNotEnabled()
206210
}
207211

0 commit comments

Comments
 (0)