Skip to content

Commit

Permalink
Fix part of #3602: Add label for Walk Through Activity (#3983)
Browse files Browse the repository at this point in the history
* Add lable for Wal Through Activity

* Add Test WalkthroughActivityLabelTest for  adding label to Activity

* Remove WalkthroughActivityLabelTest and add the test case in WalkthroughActivityTest

* Fix failing accessibiltiy failure and clean up acivity scenario

* Add new Line to proto file

* Fix Test Cases for Walk Through label change
  • Loading branch information
priyatanu authored Jan 8, 2022
1 parent 8a86210 commit 87a7acc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.walkthrough.WalkthroughActivity"
android:label="@string/walkthrough_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity android:name=".app.testing.LessonThumbnailImageViewTestActivity" />
<activity
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 @@ -381,6 +381,7 @@
<!-- CompletedStoryListActivity -->
<string name="completed_story_list_activity_title">Stories Completed</string>
<!-- WalkthroughActivity -->
<string name="walkthrough_activity_title">App walkthrough</string>
<string name="walkthrough_welcome_description">Learn new math skills with stories that show you how to use them in your daily life</string>
<string name="welcome">"Welcome %s!"</string>
<!-- WalkthroughTopicListFragment -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.oppia.android.app.walkthrough

import android.app.Application
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import androidx.test.core.app.ActivityScenario.launch
import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.pressBack
import androidx.test.espresso.action.ViewActions.click
Expand All @@ -14,8 +16,10 @@ 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 com.google.common.truth.Truth.assertThat
import dagger.Component
import org.hamcrest.CoreMatchers.allOf
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand Down Expand Up @@ -77,6 +81,7 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule
import org.oppia.android.util.parser.image.ImageParsingModule
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
import javax.inject.Inject
import javax.inject.Singleton

/** Tests for [WalkthroughActivity]. */
Expand All @@ -90,8 +95,19 @@ class WalkthroughActivityTest {
@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()

@Inject
lateinit var context: Context
// TODO(#3367): Use AccessibilityTestRule

@Before
fun setUp() {
setUpTestApplicationComponent()
}

private fun setUpTestApplicationComponent() {
ApplicationProvider.getApplicationContext<TestApplication>().inject(this)
}

@Test
fun testWalkthroughActivity_defaultProgressWorksCorrectly() {
launch(WalkthroughActivity::class.java).use {
Expand Down Expand Up @@ -173,6 +189,16 @@ class WalkthroughActivityTest {
}
}

@Test
fun testWalkthroughActivity_hasCorrectActivityLabel() {
launch(WalkthroughActivity::class.java).use { scenario ->
scenario.onActivity { activity ->
val title = activity.title
assertThat(title).isEqualTo(context.getString(R.string.walkthrough_activity_title))
}
}
}

// TODO(#59): Figure out a way to reuse modules instead of needing to re-declare them.
@Singleton
@Component(
Expand Down
1 change: 0 additions & 1 deletion scripts/assets/accessibility_label_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ exempted_activity: "app/src/main/java/org/oppia/android/app/testing/TopicTestAct
exempted_activity: "app/src/main/java/org/oppia/android/app/testing/TopicTestActivityForStory"
exempted_activity: "app/src/main/java/org/oppia/android/app/testing/ViewBindingAdaptersTestActivity"
exempted_activity: "app/src/main/java/org/oppia/android/app/testing/activity/TestActivity"
exempted_activity: "app/src/main/java/org/oppia/android/app/walkthrough/WalkthroughActivity"

0 comments on commit 87a7acc

Please sign in to comment.