Skip to content

Commit dab40be

Browse files
committed
Try rendering inside of test method
1 parent 0e7e143 commit dab40be

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,27 @@ class StatsScreenTest {
225225

226226
@Test
227227
fun testVpnDisconnecting() {
228-
renderScreen(vpnConnectionState = VpnConnectionState.DISCONNECTING)
228+
val vpnConnectionStateLiveData = MutableLiveData(VpnConnectionState.DISCONNECTING)
229+
every { mockViewModel.vpnConnectionState } returns vpnConnectionStateLiveData
230+
// renderScreen(vpnConnectionState = VpnConnectionState.DISCONNECTING)
231+
232+
composeTestRule.setContent {
233+
ToyVpnPcapPlusPlusTheme {
234+
val navController = rememberNavController()
235+
236+
NavHost(
237+
navController = navController,
238+
startDestination = "stats_screen",
239+
) {
240+
composable("stats_screen") {
241+
StatsScreen(navController, mockViewModel)
242+
}
243+
composable("connect_screen") {
244+
Text("Connect Screen")
245+
}
246+
}
247+
}
248+
}
229249

230250
composeTestRule.waitUntil(timeoutMillis = 10000) {
231251
try {

0 commit comments

Comments
 (0)