This commit is contained in:
Rune Dyselinck 2023-05-15 21:53:04 +02:00
parent 74526bc984
commit 860fb5fac1
20 changed files with 1492 additions and 49 deletions

View file

@ -0,0 +1,68 @@
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.screens.profile.EditProfileActions
import be.ugent.sel.studeez.screens.profile.EditProfileScreen
import be.ugent.sel.studeez.screens.profile.ProfileEditUiState
import org.junit.Rule
import org.junit.Test
class ProfileEditScreenTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun profileEditScreenTest() {
var edit_save = false
var edit_cancel = false
var goback = false
composeTestRule.setContent {
EditProfileScreen(
goBack = {goback = true},
uiState = ProfileEditUiState(),
editProfileActions = EditProfileActions(
{},
{edit_save = true},
{edit_cancel = true}
)
)
}
composeTestRule.waitForIdle()
composeTestRule
.onNodeWithText(
text = "save",
substring = true,
ignoreCase = true
)
.assertExists()
.performClick()
composeTestRule
.onNodeWithText(
text = "delete",
substring = true,
ignoreCase = true
)
.assertExists()
.performClick()
composeTestRule
.onNodeWithContentDescription(
label = "go back",
substring = true,
ignoreCase = true
)
.assertExists()
.performClick()
assert(edit_cancel)
assert(edit_save)
assert(goback)
}
}