Skip to content

Commit

Permalink
Fix #2587: testHomeActivity_allTopicsCompleted_displaysAllTopicCards(…
Browse files Browse the repository at this point in the history
…) test not working (#5330)

<!-- READ ME FIRST: Please fill in the explanation section below and
check off every point from the Essential Checklist! -->
## Explanation
<!--
- Explain what your PR does. If this PR fixes an existing bug, please
include
- "Fixes #bugnum:" in the explanation so that GitHub can auto-close the
issue
  - when this PR is merged.
  -->

Fix for #2587: split test method into 4 versions, [mobilePortrait,
mobileLandscape, tabletPortrait, tabletLandscape]

A. Mobile potrait test
<img width="782" alt="mobile-port"
src="https://github.com/oppia/oppia-android/assets/54560535/b98cbae0-d628-4d42-87d5-373561da703c">

B. Mobile Lanscape
<img width="799" alt="mobile-landscape"
src="https://github.com/oppia/oppia-android/assets/54560535/1dcd1e48-2f03-4017-bee3-c8c1668720de">

C. Tablet Portrait
<img width="830" alt="tablet-port"
src="https://github.com/oppia/oppia-android/assets/54560535/261d06d8-1bfb-4bde-8005-e5d08e07bd2c">

D. Tablet Landscape test.
<img width="954" alt="tablet-land"
src="https://github.com/oppia/oppia-android/assets/54560535/5491fad6-29a2-4187-a4f6-2e2e144774f5">



## Essential Checklist
<!-- Please tick the relevant boxes by putting an "x" in them. -->
- [X] The PR title and explanation each start with "Fix #bugnum: " (If
this PR fixes part of an issue, prefix the title with "Fix part of
#bugnum: ...".)
- [X] Any changes to
[scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets)
files have their rationale included in the PR explanation.
- [X] The PR follows the [style
guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide).
- [X] The PR does not contain any unnecessary code changes from Android
Studio
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)).
- [X] The PR is made from a branch that's **not** called "develop" and
is up-to-date with "develop".
- [X] The PR is **assigned** to the appropriate reviewers
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)).
  • Loading branch information
deonwaju authored Feb 8, 2024
1 parent 604b609 commit 1295328
Showing 1 changed file with 51 additions and 6 deletions.
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_mobilePortrait_displaysAllTopicCardsIn2Columns() {
fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_UPTIME_MILLIS)
storyProgressTestHelper.markAllTopicsAsCompleted(
profileId = profileId,
Expand All @@ -1344,11 +1345,55 @@ class HomeActivityTest {
launch<HomeActivity>(createHomeActivityIntent(internalProfileId)).use {
testCoroutineDispatchers.runCurrent()
scrollToPosition(position = 3)
if (context.resources.getBoolean(R.bool.isTablet)) {
verifyHomeRecyclerViewHasGridColumnCount(columnCount = 3)
} else {
verifyHomeRecyclerViewHasGridColumnCount(columnCount = 2)
}
verifyHomeRecyclerViewHasGridColumnCount(columnCount = 2)
}
}

@Config(qualifiers = "+land")
@Test
fun testHomeActivity_allTopicsCompleted_mobileLandscape_displaysAllTopicCardsIn3Columns() {
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-port")
@Test
fun testHomeActivity_allTopicsCompleted_tabletPortrait_displaysAllTopicCardsIn3Columns() {
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_tabletLandscape_displaysAllTopicCardsIn4Columns() {
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)
}
}

Expand Down

0 comments on commit 1295328

Please sign in to comment.