fist test
This commit is contained in:
parent
b53e3cdc5a
commit
522ecae87a
8 changed files with 135 additions and 12 deletions
|
@ -0,0 +1,70 @@
|
|||
package be.ugent.sel.studeez
|
||||
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.performClick
|
||||
import be.ugent.sel.studeez.data.local.models.SessionReport
|
||||
import be.ugent.sel.studeez.screens.session_recap.SessionRecapActions
|
||||
import be.ugent.sel.studeez.screens.session_recap.SessionRecapScreen
|
||||
import com.google.firebase.Timestamp
|
||||
import org.junit.Assert
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
|
||||
class SessionScreenTest {
|
||||
@get:Rule
|
||||
val composeTestRule = createComposeRule()
|
||||
|
||||
@Test
|
||||
fun SessionRecapTest() {
|
||||
var saveCalled = false
|
||||
var discardCalled = false
|
||||
|
||||
composeTestRule.setContent {
|
||||
SessionRecapScreen(
|
||||
Modifier,
|
||||
SessionRecapActions(
|
||||
{
|
||||
SessionReport(
|
||||
"",
|
||||
0,
|
||||
Timestamp(0, 0),
|
||||
"")
|
||||
},
|
||||
{ saveCalled = true },
|
||||
{ discardCalled = true }
|
||||
)
|
||||
)
|
||||
}
|
||||
composeTestRule
|
||||
.onNodeWithText(
|
||||
"You studied",
|
||||
substring = true,
|
||||
ignoreCase = true
|
||||
)
|
||||
.assertExists()
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(
|
||||
"save",
|
||||
substring = true,
|
||||
ignoreCase = true
|
||||
)
|
||||
.assertExists()
|
||||
.performClick()
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(
|
||||
"discard",
|
||||
substring = true,
|
||||
ignoreCase = true
|
||||
)
|
||||
.assertExists()
|
||||
.performClick()
|
||||
|
||||
Assert.assertTrue(saveCalled)
|
||||
Assert.assertTrue(discardCalled)
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ import be.ugent.sel.studeez.data.SelectedTimer
|
|||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalCustomTimer
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalEndlessTimer
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer
|
||||
import be.ugent.sel.studeez.domain.LogService
|
||||
import be.ugent.sel.studeez.domain.implementation.LogServiceImpl
|
||||
import be.ugent.sel.studeez.screens.session.InvisibleSessionManager
|
||||
import be.ugent.sel.studeez.screens.session.SessionViewModel
|
||||
|
|
Reference in a new issue