Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2811: Add label for OngoingTopicListActivity #3001

Closed
wants to merge 12 commits into from
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.ongoingtopiclist.OngoingTopicListActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
android:theme="@style/OppiaThemeWithoutActionBar"
android:label="@string/ongoing_topic_activity_label"/>
<activity
android:name=".app.options.AppLanguageActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<string name="topic_page">Topic page</string>
<string name="topic_name">Topic: %s</string>
<string name="topic">Topic</string>
<string name="ongoing_topic_activity_label">Ongoing Topic</string>
<string name="topic_story_progress_percentage">%s\%%</string>
<string name="topic_play_chapter_index">%s.</string>
<string name="chapter_name">Chapter %s: %s</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
import com.google.common.truth.Truth.assertThat
import dagger.Component
import org.hamcrest.CoreMatchers.containsString
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.R
Expand Down Expand Up @@ -93,10 +96,24 @@ class OngoingTopicListActivityTest {

@Inject
lateinit var storyProfileTestHelper: StoryProgressTestHelper
@get:Rule
val activityTestRule = ActivityTestRule(
OngoingTopicListActivity::class.java,
/*initialTouchMode= */ true,
/* launchActivity= */ false
)

@Inject
lateinit var testCoroutineDispatchers: TestCoroutineDispatchers

fun testCompletedOngoingTopicList_hasCorrectActivityLabel() {
activityTestRule.launchActivity(createOngoingTopicListActivityIntent(internalProfileId))
val title = activityTestRule.activity.title
// Verify that the activity label is correct as a proxy to verify TalkBack will announce the
// correct string when it's read out.
assertThat(title).isEqualTo(context.getString(R.string.ongoing_topic_activity_label))
}

@Inject
lateinit var fakeOppiaClock: FakeOppiaClock

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ class StoryActivityTest {
fun clickOnStory_intentsToExplorationActivity() {
launch<StoryActivity>(
createStoryActivityIntent(
internalProfileId,
TEST_TOPIC_ID_0,
TEST_STORY_ID_1
internalProfileId = internalProfileId,
topicId = TEST_TOPIC_ID_0,
storyId = TEST_STORY_ID_1
)
).use {
testCoroutineDispatchers.runCurrent()
Expand Down Expand Up @@ -141,10 +141,10 @@ class StoryActivityTest {
storyId: String
): Intent {
return StoryActivity.createStoryActivityIntent(
ApplicationProvider.getApplicationContext(),
internalProfileId,
topicId,
storyId
context = ApplicationProvider.getApplicationContext(),
internalProfileId = internalProfileId,
topicId = topicId,
storyId = storyId
)
}

Expand Down