test fixes

This commit is contained in:
brreynie 2023-05-16 00:41:24 +02:00
parent 8afeb38ab0
commit 629137249e
6 changed files with 42 additions and 21 deletions

View file

@ -2,11 +2,13 @@ package be.ugent.sel.studeez
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import be.ugent.sel.studeez.common.composable.drawer.DrawerActions
import be.ugent.sel.studeez.common.composable.navbar.NavigationBarActions
import be.ugent.sel.studeez.screens.profile.ProfileActions
import be.ugent.sel.studeez.screens.profile.ProfileScreen
import kotlinx.coroutines.flow.flowOf
import org.junit.Rule
import org.junit.Test
@ -17,10 +19,17 @@ class ProfileScreenTest {
@Test
fun profileScreenTest() {
var edit = false
var view_friends = false
composeTestRule.setContent {
ProfileScreen(
profileActions = ProfileActions({null}, {edit = true}),
profileActions = ProfileActions(
getUsername = {null},
onEditProfileClick = {edit = true},
getBiography = {null},
getAmountOfFriends = { flowOf(0) },
onViewFriendsClick = {view_friends = true}
),
drawerActions = DrawerActions({}, {}, {}, {}, {}),
navigationBarActions = NavigationBarActions({ false }, {}, {}, {}, {}, {}, {}, {})
)
@ -37,6 +46,16 @@ class ProfileScreenTest {
.assertExists()
.performClick()
composeTestRule
.onNodeWithText(
text = "friends",
substring = true,
ignoreCase = true,
)
.assertExists()
.performClick()
assert(edit)
assert(view_friends)
}
}