Skip to content

Commit

Permalink
split test method into 4 versions, ensuring tests pass for mobile[por…
Browse files Browse the repository at this point in the history
…trait, landscape] and tablets[portrait, landscape].
  • Loading branch information
deonwaju committed Feb 4, 2024
1 parent 3ced7e1 commit 415f08b
Showing 1 changed file with 54 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1333,8 +1333,9 @@ class HomeActivityTest {
}
}

@Config(qualifiers = "+port")
@Test
fun testHomeActivity_allTopicsCompleted_displaysAllTopicCards() {
fun testHomeActivity_allTopicsCompleted_mobilePortraitDisplaysAllTopicCardsIn2Columns() {
fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_UPTIME_MILLIS)
storyProgressTestHelper.markAllTopicsAsCompleted(
profileId = profileId,
Expand All @@ -1352,6 +1353,58 @@ class HomeActivityTest {
}
}

@Config(qualifiers = "+land")
@Test
fun testHomeActivity_allTopicsCompleted_mobileLandscapeDisplaysAllTopicCardsIn3Columns() {
fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_UPTIME_MILLIS)
storyProgressTestHelper.markAllTopicsAsCompleted(
profileId = profileId,
timestampOlderThanOneWeek = false
)
logIntoAdminTwice()
launch<HomeActivity>(createHomeActivityIntent(internalProfileId)).use {
testCoroutineDispatchers.runCurrent()
scrollToPosition(position = 3)
if (context.resources.getBoolean(R.bool.isTablet)) {
verifyHomeRecyclerViewHasGridColumnCount(columnCount = 4)
} else {
verifyHomeRecyclerViewHasGridColumnCount(columnCount = 3)
}
}
}

@Config(qualifiers = "+sw600dp-port")
@Test
fun testHomeActivity_allTopicsCompleted_tabletPortraitDisplaysAllTopicCardsIn3Columns() {
fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_UPTIME_MILLIS)
storyProgressTestHelper.markAllTopicsAsCompleted(
profileId = profileId,
timestampOlderThanOneWeek = false
)
logIntoAdminTwice()
launch<HomeActivity>(createHomeActivityIntent(internalProfileId)).use {
testCoroutineDispatchers.runCurrent()
scrollToPosition(position = 3)
verifyHomeRecyclerViewHasGridColumnCount(columnCount = 3)
}
}

@Config(qualifiers = "+sw600dp-land")
@Test
fun testHomeActivity_allTopicsCompleted_tabletLandscapeDisplaysAllTopicCardsIn4Columns() {
fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_UPTIME_MILLIS)
storyProgressTestHelper.markAllTopicsAsCompleted(
profileId = profileId,
timestampOlderThanOneWeek = false
)
logIntoAdminTwice()
launch<HomeActivity>(createHomeActivityIntent(internalProfileId)).use {
testCoroutineDispatchers.runCurrent()
scrollToPosition(position = 3)
verifyHomeRecyclerViewHasGridColumnCount(columnCount = 4)
}
}

@Test
fun testHomeActivity_noTopicsCompleted_displaysAllTopicsHeader() {
// Only new users will have no progress for any topics.
Expand Down

0 comments on commit 415f08b

Please sign in to comment.