-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from snuhcs-course/frontend_api_finish
Frontend api finish
- Loading branch information
Showing
25 changed files
with
718 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
frontend/app/src/androidTest/java/com/team13/fooriend/BottomBarTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.team13.fooriend | ||
|
||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.test.assert | ||
import androidx.compose.ui.test.assertIsFocused | ||
import androidx.compose.ui.test.assertIsNotSelected | ||
import androidx.compose.ui.test.assertIsOn | ||
import androidx.compose.ui.test.assertIsSelected | ||
import androidx.compose.ui.test.assertIsToggleable | ||
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 androidx.navigation.compose.ComposeNavigator | ||
import androidx.navigation.testing.TestNavHostController | ||
import com.team13.fooriend.core.graph.AuthScreen | ||
import com.team13.fooriend.core.graph.RootNavigationGraph | ||
import com.team13.fooriend.ui.component.BottomBar | ||
import com.team13.fooriend.ui.component.BottomNavigation | ||
import com.team13.fooriend.ui.navigation.BottomNavItem | ||
import org.junit.Assert | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class BottomBarTest { | ||
@get:Rule | ||
val composeTestRule = createComposeRule() | ||
lateinit var navController: TestNavHostController | ||
|
||
@Before | ||
fun setUpNavHost(){ | ||
composeTestRule.setContent { | ||
navController = TestNavHostController(LocalContext.current) | ||
navController.navigatorProvider.addNavigator(ComposeNavigator()) | ||
BottomBar(navController = navController, context = LocalContext.current, showBottomBar = true) | ||
} | ||
} | ||
|
||
@Test | ||
fun verify_StartDestinationIsHomeScreen(){ | ||
composeTestRule | ||
.onNodeWithText("Home") | ||
.assertIsSelected() | ||
composeTestRule | ||
.onNodeWithText("Social") | ||
.assertIsNotSelected() | ||
composeTestRule | ||
.onNodeWithText("MyPage") | ||
.assertIsNotSelected() | ||
} | ||
// 이후부터는 스마트폰 필요 | ||
@Test | ||
fun performClick_OnSocialIcon_navigatesToSocialScreen(){ | ||
composeTestRule | ||
.onNodeWithText("Social") | ||
.performClick() | ||
} | ||
|
||
@Test | ||
fun performClick_OnMyPageIcon_navigatesToMyPageScreen(){ | ||
composeTestRule | ||
.onNodeWithText("MyPage") | ||
.assertIsNotSelected() | ||
} | ||
|
||
@Test | ||
fun test3(){ | ||
composeTestRule | ||
.onNodeWithText("MyPage") | ||
.assertIsNotSelected() | ||
} | ||
|
||
|
||
|
||
} |
88 changes: 88 additions & 0 deletions
88
frontend/app/src/androidTest/java/com/team13/fooriend/LogInScreenTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.team13.fooriend | ||
|
||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import androidx.compose.ui.test.performTextInput | ||
import androidx.navigation.compose.ComposeNavigator | ||
import androidx.navigation.testing.TestNavHostController | ||
import com.team13.fooriend.core.graph.AuthScreen | ||
import com.team13.fooriend.core.graph.Graph | ||
import com.team13.fooriend.core.graph.RootNavigationGraph | ||
import org.junit.Assert | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class LogInScreenTest { | ||
|
||
@get:Rule | ||
val composeTestRule = createComposeRule() | ||
lateinit var navController: TestNavHostController | ||
|
||
@Before | ||
fun setUpNavHost(){ | ||
composeTestRule.setContent { | ||
navController = TestNavHostController(LocalContext.current) | ||
navController.navigatorProvider.addNavigator(ComposeNavigator()) | ||
RootNavigationGraph(navController = navController, context = LocalContext.current) | ||
} | ||
} | ||
|
||
@Test | ||
fun verify_StartDestinationIsLoginScreen(){ | ||
composeTestRule | ||
.onNodeWithText("LOGIN") | ||
.assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun performClick_OnSignUpButton_navigatesToSignUpScreen(){ | ||
composeTestRule | ||
.onNodeWithText("SIGN UP") | ||
.performClick() | ||
val route = navController.currentBackStackEntry?.destination?.route | ||
Assert.assertEquals(route, AuthScreen.SignUp.route) | ||
} | ||
|
||
@Test | ||
fun performClick_OnLogInButton_withEmptyIDandPWD(){ | ||
composeTestRule | ||
.onNodeWithText("LOGIN") | ||
.performClick() | ||
val route = navController.currentBackStackEntry?.destination?.route | ||
Assert.assertEquals(route, AuthScreen.Login.route) | ||
} | ||
|
||
@Test | ||
fun performClick_OnLogInButton_withWrongIDorPWD(){ | ||
composeTestRule | ||
.onNodeWithText("ID") | ||
.performTextInput("admin") | ||
composeTestRule | ||
.onNodeWithText("PASSWORD") | ||
.performTextInput("admin") // please change wrong pwd | ||
composeTestRule | ||
.onNodeWithText("LOGIN") | ||
.performClick() | ||
val route = navController.currentBackStackEntry?.destination?.route | ||
Assert.assertEquals(route, AuthScreen.Login.route) | ||
} | ||
|
||
@Test | ||
fun performClick_OnLogInButton_withCorrectIDandPWD(){ | ||
composeTestRule | ||
.onNodeWithText("ID") | ||
.performTextInput("admin") | ||
composeTestRule | ||
.onNodeWithText("PASSWORD") | ||
.performTextInput("admin") | ||
composeTestRule | ||
.onNodeWithText("LOGIN") | ||
.performClick() | ||
val route = navController.currentBackStackEntry?.destination?.route | ||
Assert.assertEquals(route, Graph.HOME) | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
frontend/app/src/androidTest/java/com/team13/fooriend/MyPageScreenTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.team13.fooriend | ||
|
||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.test.assert | ||
import androidx.compose.ui.test.hasParent | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithContentDescription | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.onRoot | ||
import androidx.compose.ui.test.performClick | ||
import androidx.compose.ui.test.printToLog | ||
import androidx.navigation.compose.ComposeNavigator | ||
import androidx.navigation.testing.TestNavHostController | ||
import com.team13.fooriend.core.graph.AuthScreen | ||
import com.team13.fooriend.core.graph.HomeNavGraph | ||
import com.team13.fooriend.core.graph.RootNavigationGraph | ||
import org.junit.Assert | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class MyPageScreenTest { | ||
@get:Rule | ||
val composeTestRule = createComposeRule() | ||
lateinit var navController: TestNavHostController | ||
|
||
@Before | ||
fun setUpNavHost(){ | ||
composeTestRule.setContent { | ||
navController = TestNavHostController(LocalContext.current) | ||
navController.navigatorProvider.addNavigator(ComposeNavigator()) | ||
HomeNavGraph(navController = navController, context = LocalContext.current) | ||
|
||
} | ||
} | ||
|
||
@Test | ||
fun performClick_OnSettingButton_navigatesToMyInformationScreen(){ | ||
composeTestRule | ||
.onNodeWithContentDescription("My Info") | ||
|
||
composeTestRule.onRoot().printToLog("test1234") | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.