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 #2825: Added label for profile rename activity #2928

Closed
wants to merge 9 commits into from
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.settings.profile.ProfileRenameActivity"
android:label="@string/profile_rename_title"
rt4914 marked this conversation as resolved.
Show resolved Hide resolved
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
rt4914 marked this conversation as resolved.
Show resolved Hide resolved
android:name=".app.settings.profile.ProfileResetPinActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ 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.android.material.textfield.TextInputLayout
import com.google.common.truth.Truth.assertThat
import dagger.Component
import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.not
Expand All @@ -31,6 +33,7 @@ import org.hamcrest.Matcher
import org.hamcrest.TypeSafeMatcher
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 @@ -102,6 +105,11 @@ class ProfileRenameActivityTest {
@Inject
lateinit var editTextInputAction: EditTextInputAction

@get:Rule
val activityTestRule: ActivityTestRule<ProfileRenameActivity> = ActivityTestRule(
ProfileRenameActivity::class.java, true, false
rt4914 marked this conversation as resolved.
Show resolved Hide resolved
)

@Before
fun setUp() {
Intents.init()
Expand All @@ -118,6 +126,19 @@ class ProfileRenameActivityTest {
ApplicationProvider.getApplicationContext<TestApplication>().inject(this)
}

@Test
fun testProfileRenameActivity_hasCorrectActivityLabel() {
activityTestRule.launchActivity(
rt4914 marked this conversation as resolved.
Show resolved Hide resolved
ProfileRenameActivity.createProfileRenameActivity(
context = context,
profileId = 1
)
)

val title = activityTestRule.activity.title
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment above this like the one listed here to provide some context about what this check is attempting to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justdvnsh The comment that you added does not match with the one mentioned in the reference. Please use same comment for better clarity and consistency.

assertThat(title).isEqualTo(context.getString(R.string.profile_rename_title))
}

@Test
fun testProfileRenameActivity_inputNewName_clickSave_checkProfileEditActivityIsOpen() {
launch<ProfileRenameActivity>(
Expand Down