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

@ -7,7 +7,7 @@ plugins {
id 'com.google.dagger.hilt.android' id 'com.google.dagger.hilt.android'
// Protobuf // Protobuf
id 'com.google.protobuf' version '0.9.0' id 'com.google.protobuf' version '0.8.17'
// Firebase // Firebase
id 'com.google.gms.google-services' id 'com.google.gms.google-services'

View file

@ -25,7 +25,6 @@ class HomeScreenTest {
composeTestRule.setContent { composeTestRule.setContent {
HomeScreen( HomeScreen(
open = {},
drawerActions = DrawerActions({}, {}, {}, {}, {}), drawerActions = DrawerActions({}, {}, {}, {}, {}),
navigationBarActions = NavigationBarActions({false}, {}, {}, {}, {}, {}, {}, {}), navigationBarActions = NavigationBarActions({false}, {}, {}, {}, {}, {}, {}, {}),
feedUiState = FeedUiState.Succes(mapOf( feedUiState = FeedUiState.Succes(mapOf(
@ -39,7 +38,8 @@ class HomeScreenTest {
) )
)), )),
continueTask = {_, _ -> continueTask = true }, continueTask = {_, _ -> continueTask = true },
onEmptyFeedHelp = {} onEmptyFeedHelp = {},
onViewFriendsClick = {},
) )
} }
@ -67,7 +67,6 @@ class HomeScreenTest {
composeTestRule.setContent { composeTestRule.setContent {
HomeScreen( HomeScreen(
open = {},
drawerActions = DrawerActions( drawerActions = DrawerActions(
{homebuttontest = true}, {homebuttontest = true},
{timersbuttontest = true}, {timersbuttontest = true},
@ -78,7 +77,8 @@ class HomeScreenTest {
navigationBarActions = NavigationBarActions({false}, {}, {}, {}, {}, {}, {}, {}), navigationBarActions = NavigationBarActions({false}, {}, {}, {}, {}, {}, {}, {}),
feedUiState = FeedUiState.Succes(mapOf()), feedUiState = FeedUiState.Succes(mapOf()),
continueTask = {_, _ -> }, continueTask = {_, _ -> },
onEmptyFeedHelp = {} onEmptyFeedHelp = {},
onViewFriendsClick = {},
) )
} }
@ -145,7 +145,6 @@ class HomeScreenTest {
composeTestRule.setContent { composeTestRule.setContent {
HomeScreen( HomeScreen(
open = {},
drawerActions = DrawerActions({}, {}, {}, {}, {}), drawerActions = DrawerActions({}, {}, {}, {}, {}),
navigationBarActions = NavigationBarActions( navigationBarActions = NavigationBarActions(
{false}, {false},
@ -157,7 +156,8 @@ class HomeScreenTest {
), ),
feedUiState = FeedUiState.Succes(mapOf()), feedUiState = FeedUiState.Succes(mapOf()),
continueTask = {_, _ -> }, continueTask = {_, _ -> },
onEmptyFeedHelp = {} onEmptyFeedHelp = {},
onViewFriendsClick = {},
) )
} }

View file

@ -1,12 +1,13 @@
package be.ugent.sel.studeez package be.ugent.sel.studeez
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performClick
import be.ugent.sel.studeez.screens.profile.EditProfileActions import be.ugent.sel.studeez.screens.profile.edit_profile.EditProfileActions
import be.ugent.sel.studeez.screens.profile.EditProfileScreen import be.ugent.sel.studeez.screens.profile.edit_profile.EditProfileScreen
import be.ugent.sel.studeez.screens.profile.ProfileEditUiState import be.ugent.sel.studeez.screens.profile.edit_profile.ProfileEditUiState
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
@ -17,18 +18,19 @@ class ProfileEditScreenTest {
@Test @Test
fun profileEditScreenTest() { fun profileEditScreenTest() {
var edit_save = false var edit_save = false
var edit_cancel = false
var goback = false var goback = false
var delete_click = false
composeTestRule.setContent { composeTestRule.setContent {
EditProfileScreen( EditProfileScreen(
goBack = {goback = true}, goBack = {goback = true},
uiState = ProfileEditUiState(), uiState = ProfileEditUiState(),
editProfileActions = EditProfileActions( editProfileActions = EditProfileActions(
{}, onUserNameChange = {},
{edit_save = true}, onBiographyChange = {},
{edit_cancel = true} onSaveClick = {edit_save = true},
) onDeleteClick = { delete_click = true },
),
) )
} }
@ -61,8 +63,8 @@ class ProfileEditScreenTest {
.assertExists() .assertExists()
.performClick() .performClick()
assert(edit_cancel)
assert(edit_save) assert(edit_save)
assert(goback) assert(goback)
assert(delete_click)
} }
} }

View file

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

View file

@ -9,13 +9,13 @@ buildscript {
dependencies { dependencies {
classpath 'com.google.gms:google-services:4.3.15' classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.android.tools.build:gradle:8.0.0' classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
} }
}// Top-level build file where you can add configuration options common to all sub-projects/modules. }// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '8.0.0' apply false id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '8.0.0' apply false id 'com.android.library' version '7.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
// Hilt // Hilt

View file

@ -1,6 +1,6 @@
#Sat Mar 25 16:03:50 CET 2023 #Sat Mar 25 16:03:50 CET 2023
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME