fist test
This commit is contained in:
parent
b53e3cdc5a
commit
522ecae87a
8 changed files with 135 additions and 12 deletions
|
@ -65,6 +65,8 @@ dependencies {
|
|||
implementation "androidx.compose.ui:ui:$compose_version"
|
||||
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
|
||||
implementation 'androidx.compose.material:material:1.2.0'
|
||||
implementation 'androidx.test.ext:junit-ktx:1.1.5'
|
||||
implementation 'androidx.navigation:navigation-testing:2.5.3'
|
||||
|
||||
|
||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
||||
|
@ -96,13 +98,17 @@ dependencies {
|
|||
|
||||
// JUnit
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
||||
|
||||
// Coroutine testing
|
||||
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'
|
||||
|
||||
// Mocking
|
||||
testImplementation 'org.mockito.kotlin:mockito-kotlin:3.2.0'
|
||||
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.28.1'
|
||||
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
|
||||
|
||||
// Networking
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
|
@ -111,8 +117,6 @@ dependencies {
|
|||
testImplementation 'androidx.arch.core:core-testing:2.1.0'
|
||||
|
||||
// GUI testing
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
||||
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
||||
|
||||
//Firebase
|
||||
|
|
|
@ -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