test(home): 팔로잉 탭 후속 UI 검증을 보강한다
This commit is contained in:
@@ -65,7 +65,7 @@ class HomeFollowingFragmentSourceTest {
|
|||||||
.substringBefore("\n private fun")
|
.substringBefore("\n private fun")
|
||||||
|
|
||||||
assertTrue(source.contains("onFollowingSectionMoreClick("))
|
assertTrue(source.contains("onFollowingSectionMoreClick("))
|
||||||
assertTrue(source.contains("binding.viewHomeFollowingCreatorsTitle"))
|
assertFalse(source.contains("binding.viewHomeFollowingCreatorsTitle"))
|
||||||
assertTrue(source.contains("binding.viewHomeFollowingOnAirTitle"))
|
assertTrue(source.contains("binding.viewHomeFollowingOnAirTitle"))
|
||||||
assertTrue(source.contains("binding.viewHomeFollowingRecentChatsTitle"))
|
assertTrue(source.contains("binding.viewHomeFollowingRecentChatsTitle"))
|
||||||
assertTrue(source.contains("binding.viewHomeFollowingMonthlySchedulesTitle"))
|
assertTrue(source.contains("binding.viewHomeFollowingMonthlySchedulesTitle"))
|
||||||
@@ -109,7 +109,7 @@ class HomeFollowingFragmentSourceTest {
|
|||||||
val newsAdapter = projectFile(
|
val newsAdapter = projectFile(
|
||||||
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/ui/HomeFollowingNewsAdapter.kt"
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/ui/HomeFollowingNewsAdapter.kt"
|
||||||
).readText()
|
).readText()
|
||||||
val newsLayout = projectFile("app/src/main/res/layout/item_home_following_news_content.xml").readText()
|
val newsLayout = projectFile("app/src/main/res/layout/view_feed_content.xml").readText()
|
||||||
|
|
||||||
assertTrue(liveLayout.contains("@+id/tv_home_following_live_started_at"))
|
assertTrue(liveLayout.contains("@+id/tv_home_following_live_started_at"))
|
||||||
assertTrue(liveAdapter.contains("startedAtText.text"))
|
assertTrue(liveAdapter.contains("startedAtText.text"))
|
||||||
@@ -122,11 +122,94 @@ class HomeFollowingFragmentSourceTest {
|
|||||||
assertTrue(scheduleAdapter.contains("item.isOnAir"))
|
assertTrue(scheduleAdapter.contains("item.isOnAir"))
|
||||||
assertTrue(scheduleAdapter.contains("R.string.screen_home_following_on_air"))
|
assertTrue(scheduleAdapter.contains("R.string.screen_home_following_on_air"))
|
||||||
|
|
||||||
assertTrue(newsLayout.contains("@+id/tv_home_following_news_label"))
|
assertTrue(newsLayout.contains("@+id/tv_feed_content_category"))
|
||||||
assertTrue(newsLayout.contains("@+id/tv_home_following_news_title"))
|
assertTrue(newsLayout.contains("@+id/tv_feed_content_title"))
|
||||||
assertTrue(newsAdapter.contains("labelText.setText(content.labelResId)"))
|
assertTrue(newsAdapter.contains("contentTitle = content.title"))
|
||||||
assertTrue(newsAdapter.contains("titleText.text = content.title"))
|
assertTrue(newsAdapter.contains("createdAtText = content.visibleFromText"))
|
||||||
assertTrue(newsAdapter.contains("createdAtText.text = content.visibleFromText"))
|
assertTrue(newsAdapter.contains("creatorImageUrl = content.creatorProfileImageUrl"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `following recent news hides chevron and reuses feed widgets by item type`() {
|
||||||
|
val layout = homeMainLayoutSource()
|
||||||
|
val recentNewsSection = layout.substringAfter("@+id/ll_home_following_recent_news_section")
|
||||||
|
.substringBefore("</LinearLayout>")
|
||||||
|
val fragment = homeMainFragmentSource()
|
||||||
|
val adapter = projectFile(
|
||||||
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/ui/HomeFollowingNewsAdapter.kt"
|
||||||
|
).readText()
|
||||||
|
|
||||||
|
assertTrue(fragment.contains("binding.viewHomeFollowingRecentNewsTitle.setTitle("))
|
||||||
|
assertFalse(
|
||||||
|
fragment.contains(
|
||||||
|
"binding.viewHomeFollowingRecentNewsTitle.setTitle(\n" +
|
||||||
|
" R.string.screen_home_following_recent_news_title,\n" +
|
||||||
|
" showMore = true"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
assertFalse(fragment.contains("binding.viewHomeFollowingRecentNewsTitle.ivSectionTitleChevron"))
|
||||||
|
assertTrue(recentNewsSection.contains("view_home_following_recent_news_title"))
|
||||||
|
assertTrue(adapter.contains("FollowingNewsType.COMMUNITY_POST -> VIEW_TYPE_COMMUNITY"))
|
||||||
|
assertTrue(adapter.contains("is HomeFollowingNewsUiItem.Ranking -> VIEW_TYPE_RANKING"))
|
||||||
|
assertTrue(adapter.contains("R.layout.view_feed_community"))
|
||||||
|
assertTrue(adapter.contains("R.layout.view_feed_rank"))
|
||||||
|
assertTrue(adapter.contains("R.layout.view_feed_content"))
|
||||||
|
assertTrue(adapter.contains("FeedCommunityView"))
|
||||||
|
assertTrue(adapter.contains("FeedRankView"))
|
||||||
|
assertTrue(adapter.contains("FeedContentView"))
|
||||||
|
assertTrue(adapter.contains("FeedItem.Community"))
|
||||||
|
assertTrue(adapter.contains("FeedItem.Rank"))
|
||||||
|
assertTrue(adapter.contains("FeedItem.Content"))
|
||||||
|
assertFalse(adapter.contains("R.layout.item_home_following_news_content"))
|
||||||
|
assertFalse(adapter.contains("R.layout.item_home_following_news_rank"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `following creators section has no header and uses figma simple profile size`() {
|
||||||
|
val layout = homeMainLayoutSource()
|
||||||
|
val section = layout.substringAfter("@+id/ll_home_following_creators_section")
|
||||||
|
.substringBefore("@+id/ll_home_following_on_air_section")
|
||||||
|
val itemLayout = projectFile("app/src/main/res/layout/item_home_following_creator.xml").readText()
|
||||||
|
|
||||||
|
assertFalse(section.contains("view_home_following_creators_title"))
|
||||||
|
assertTrue(itemLayout.contains("android:layout_width=\"75dp\""))
|
||||||
|
assertTrue(itemLayout.contains("android:layout_height=\"75dp\""))
|
||||||
|
assertTrue(itemLayout.contains("@style/Typography.Body5"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `following recent chats section is horizontal box list`() {
|
||||||
|
val layout = homeMainLayoutSource()
|
||||||
|
val section = layout.substringAfter("@+id/rv_home_following_recent_chats")
|
||||||
|
.substringBefore("@+id/ll_home_following_monthly_schedules_section")
|
||||||
|
val fragment = homeMainFragmentSource()
|
||||||
|
|
||||||
|
assertTrue(section.contains("android:orientation=\"horizontal\""))
|
||||||
|
assertTrue(fragment.contains("rvHomeFollowingRecentChats.apply"))
|
||||||
|
assertTrue(fragment.contains("LinearLayoutManager.HORIZONTAL"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `following recent chat item matches figma box fields`() {
|
||||||
|
val adapter = projectFile(
|
||||||
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/ui/HomeFollowingChatAdapter.kt"
|
||||||
|
).readText()
|
||||||
|
val itemLayout = projectFile("app/src/main/res/layout/item_home_following_chat.xml").readText()
|
||||||
|
|
||||||
|
assertTrue(itemLayout.contains("android:layout_width=\"284dp\""))
|
||||||
|
assertTrue(itemLayout.contains("android:layout_width=\"62dp\""))
|
||||||
|
assertTrue(itemLayout.contains("android:layout_height=\"62dp\""))
|
||||||
|
assertTrue(itemLayout.contains("@+id/tv_home_following_chat_direct_badge"))
|
||||||
|
assertTrue(itemLayout.contains("@drawable/bg_chat_direct_badge"))
|
||||||
|
assertTrue(itemLayout.contains("@string/screen_chat_direct_badge"))
|
||||||
|
val messageText = itemLayout.substringAfter("@+id/tv_home_following_chat_message")
|
||||||
|
.substringBefore("@+id/tv_home_following_chat_creator_nickname")
|
||||||
|
assertTrue(messageText.contains("android:maxLines=\"1\""))
|
||||||
|
assertTrue(messageText.contains("android:ellipsize=\"end\""))
|
||||||
|
assertFalse(adapter.contains("ViewGroup.LayoutParams.MATCH_PARENT"))
|
||||||
|
assertTrue(adapter.contains("recyclerItemLayoutParams(parent)"))
|
||||||
|
assertTrue(adapter.contains("directBadgeText.visibility = if (item.showDirectBadge)"))
|
||||||
|
assertTrue(adapter.contains("formatChatRoomLastMessageTime(itemView.context, item.lastMessageAt)"))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun homeMainFragmentSource(): String {
|
private fun homeMainFragmentSource(): String {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class HomeFollowingViewModelTest {
|
|||||||
setImmediateRxSchedulers()
|
setImmediateRxSchedulers()
|
||||||
SharedPreferenceManager.resetForTest()
|
SharedPreferenceManager.resetForTest()
|
||||||
SharedPreferenceManager.init(context)
|
SharedPreferenceManager.init(context)
|
||||||
SharedPreferenceManager.token = "test-token"
|
SharedPreferenceManager.token = ""
|
||||||
api = FakeHomeFollowingApi()
|
api = FakeHomeFollowingApi()
|
||||||
viewModel = HomeFollowingViewModel(
|
viewModel = HomeFollowingViewModel(
|
||||||
repository = HomeFollowingRepository(api),
|
repository = HomeFollowingRepository(api),
|
||||||
|
|||||||
Reference in New Issue
Block a user