Skip to content

Commit 3068c1c

Browse files
committed
Try adding composeTestRule.waitForIdle()
1 parent f6dad16 commit 3068c1c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ class StatsScreenTest {
9090
}
9191
}
9292
}
93+
94+
composeTestRule.waitForIdle()
9395
}
9496

9597
@Before
@@ -101,7 +103,6 @@ class StatsScreenTest {
101103
fun testVpnConnected() {
102104
renderScreen()
103105

104-
composeTestRule.waitForIdle()
105106
composeTestRule.onNodeWithText("Disconnect").assertIsDisplayed().assertIsEnabled()
106107
}
107108

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

152-
composeTestRule.waitForIdle()
153153
composeTestRule.onNodeWithText("Total Packets").assertIsDisplayed().onSibling().assertTextEquals(totalPacketCount.toString())
154154

155155
expectedValues.forEach { (testTag, label, count) ->
@@ -196,7 +196,6 @@ class StatsScreenTest {
196196
renderScreen()
197197

198198
composeTestRule.onNodeWithText("Disconnect").performClick()
199-
composeTestRule.waitForIdle()
200199

201200
verify { mockViewModel.disconnectVpn() }
202201
}
@@ -205,7 +204,6 @@ class StatsScreenTest {
205204
fun testVpnDisconnecting() {
206205
renderScreen(vpnConnectionState = VpnConnectionState.DISCONNECTING)
207206

208-
composeTestRule.waitForIdle()
209207
composeTestRule.onNodeWithText("Disconnecting...").assertIsDisplayed().assertIsNotEnabled()
210208
}
211209

0 commit comments

Comments
 (0)