Skip to content

Commit ed2c380

Browse files
committed
Fix broken tests
1 parent 0afe58e commit ed2c380

2 files changed

Lines changed: 68 additions & 70 deletions

File tree

features/feature-credit/src/androidTest/java/com/sample/tmdb/credit/CreditScreenTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import androidx.compose.ui.test.assertIsDisplayed
66
import androidx.compose.ui.test.junit4.createAndroidComposeRule
77
import androidx.compose.ui.test.onNodeWithContentDescription
88
import androidx.compose.ui.test.onNodeWithText
9-
import com.sample.tmdb.common.R as commonR
9+
import com.sample.tmdb.common.R
1010
import com.sample.tmdb.common.model.Gender
1111
import com.sample.tmdb.common.model.placeholderIcon
1212
import com.sample.tmdb.domain.model.Cast
@@ -23,19 +23,19 @@ class CreditScreenTest {
2323
val person = Cast("role", "name", null, Gender.MALE, 1)
2424
setContent {
2525
CreditScreen(
26-
R.string.biography,
26+
R.string.movies,
2727
{},
2828
{},
2929
listOf(person),
3030
rememberVectorPainter(person.gender.placeholderIcon),
3131
)
3232
}
33-
onNodeWithText(activity.getString(R.string.biography)).assertIsDisplayed()
33+
onNodeWithText(activity.getString(R.string.movies)).assertIsDisplayed()
3434
onNodeWithText("name").assertIsDisplayed()
3535
onNodeWithText("role").assertIsDisplayed()
3636
onNodeWithContentDescription(
3737
activity.getString(
38-
commonR.string.person_content_description,
38+
R.string.person_content_description,
3939
"name",
4040
"role",
4141
),

features/feature-feed/src/androidTest/java/com/sample/tmdb/feed/FeedScreenTest.kt

Lines changed: 64 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import androidx.compose.ui.test.assertIsDisplayed
77
import androidx.compose.ui.test.junit4.createAndroidComposeRule
88
import androidx.compose.ui.test.onAllNodesWithText
99
import androidx.compose.ui.test.onNodeWithText
10-
import androidx.navigation.compose.rememberNavController
11-
import com.sample.tmdb.domain.R as domainR
1210
import com.sample.tmdb.domain.model.FeedWrapper
1311
import com.sample.tmdb.domain.model.Movie
1412
import com.sample.tmdb.domain.model.SortType
@@ -17,6 +15,7 @@ import org.junit.Test
1715
import org.mockito.ArgumentMatchers.anyDouble
1816
import org.mockito.ArgumentMatchers.anyInt
1917
import org.mockito.ArgumentMatchers.anyString
18+
import com.sample.tmdb.domain.R as domainR
2019

2120
class FeedScreenTest {
2221
@get:Rule
@@ -27,44 +26,44 @@ class FeedScreenTest {
2726
with(composeTestRule) {
2827
setContent {
2928
FeedCollectionList(
30-
navController = rememberNavController(),
3129
collection =
32-
listOf(
33-
FeedWrapper(
34-
feeds =
35-
listOf(
36-
Movie(
37-
anyInt(),
38-
anyString(),
39-
anyString(),
40-
anyString(),
41-
anyString(),
42-
"title",
43-
anyDouble(),
44-
anyInt(),
45-
),
30+
listOf(
31+
FeedWrapper(
32+
feeds =
33+
listOf(
34+
Movie(
35+
anyInt(),
36+
anyString(),
37+
anyString(),
38+
anyString(),
39+
anyString(),
40+
"title",
41+
anyDouble(),
42+
anyInt(),
43+
),
44+
),
45+
domainR.string.text_trending,
46+
SortType.TRENDING,
4647
),
47-
domainR.string.text_trending,
48-
SortType.TRENDING,
49-
),
50-
FeedWrapper(
51-
feeds =
52-
listOf(
53-
Movie(
54-
anyInt(),
55-
anyString(),
56-
anyString(),
57-
anyString(),
58-
anyString(),
59-
"name",
60-
anyDouble(),
61-
anyInt(),
62-
),
48+
FeedWrapper(
49+
feeds =
50+
listOf(
51+
Movie(
52+
anyInt(),
53+
anyString(),
54+
anyString(),
55+
anyString(),
56+
anyString(),
57+
"name",
58+
anyDouble(),
59+
anyInt(),
60+
),
61+
),
62+
domainR.string.text_popular,
63+
SortType.MOST_POPULAR,
6364
),
64-
domainR.string.text_popular,
65-
SortType.MOST_POPULAR,
6665
),
67-
),
66+
{},
6867
) {}
6968
}
7069
onNodeWithText(activity.getString(domainR.string.text_trending)).assertIsDisplayed()
@@ -81,24 +80,24 @@ class FeedScreenTest {
8180
setContent {
8281
PagerTMDbItemContainer(
8382
feedWrapper =
84-
FeedWrapper(
85-
feeds =
86-
listOf(
87-
Movie(
88-
anyInt(),
89-
anyString(),
90-
anyString(),
91-
anyString(),
92-
anyString(),
93-
"title",
94-
anyDouble(),
95-
anyInt(),
96-
),
83+
FeedWrapper(
84+
feeds =
85+
listOf(
86+
Movie(
87+
anyInt(),
88+
anyString(),
89+
anyString(),
90+
anyString(),
91+
anyString(),
92+
"title",
93+
anyDouble(),
94+
anyInt(),
95+
),
96+
),
97+
domainR.string.text_popular,
98+
SortType.MOST_POPULAR,
9799
),
98-
domainR.string.text_popular,
99-
SortType.MOST_POPULAR,
100-
),
101-
navController = rememberNavController(),
100+
{},
102101
) {}
103102
}
104103
onNodeWithText(activity.getString(domainR.string.text_popular)).assertIsDisplayed()
@@ -144,8 +143,7 @@ class FeedScreenTest {
144143
domainR.string.text_popular,
145144
SortType.MOST_POPULAR,
146145
),
147-
navController = rememberNavController(),
148-
)
146+
) {}
149147
}
150148
onNodeWithText(activity.getString(domainR.string.text_popular)).assertIsDisplayed()
151149
onNodeWithText("More").assertIsDisplayed()
@@ -158,18 +156,18 @@ class FeedScreenTest {
158156
setContent {
159157
Feeds(
160158
feeds =
161-
listOf(
162-
Movie(
163-
anyInt(),
164-
anyString(),
165-
anyString(),
166-
anyString(),
167-
anyString(),
168-
"title",
169-
anyDouble(),
170-
anyInt(),
159+
listOf(
160+
Movie(
161+
anyInt(),
162+
anyString(),
163+
anyString(),
164+
anyString(),
165+
anyString(),
166+
"title",
167+
anyDouble(),
168+
anyInt(),
169+
),
171170
),
172-
),
173171
onFeedClick = {},
174172
index = 0,
175173
)

0 commit comments

Comments
 (0)