Skip to content

Commit

Permalink
Fix #4352: Spelling mistake when setting up pin in "Enter a New Pin" …
Browse files Browse the repository at this point in the history
…dialog box (#4487)

* added test and localised string

* changed test name

* fixed lint checks

* fixed lint checks

* changed test name

* updated test

* fixed CI checks

* fixed lint check

* fix CI checks
  • Loading branch information
pratyaksh1610 authored Oct 5, 2022
1 parent 0d0c49c commit fc6c881
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ class ResetPinDialogFragmentPresenter @Inject constructor(
val dialog = AlertDialog.Builder(activity, R.style.OppiaAlertDialogTheme)
.setTitle(R.string.reset_pin_enter)
.setView(binding.root)
.setMessage("This PIN wil be $name's new PIN and will be required when signing in.")
.setMessage(
resourceHandler.getStringInLocaleWithWrapping(
R.string.reset_pin_enter_dialog_message, name
)
)
.setPositiveButton(R.string.admin_settings_submit, null)
.setNegativeButton(R.string.admin_settings_cancel) { dialog, _ ->
dialog.dismiss()
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 @@ -326,6 +326,7 @@
<string name="admin_settings_enter_user_new_pin">%1$s\'s New PIN.</string>
<!-- ResetPinDialogFragment -->
<string name="reset_pin_enter">Enter a New Pin</string>
<string name="reset_pin_enter_dialog_message">This PIN will be %s\'s new PIN and will be required when signing in.</string>
<!-- MyDownloadsActivity -->
<string name="my_downloads_activity_title">My Downloads</string>
<string name="tab_downloads">Downloads</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.test.rule.ActivityTestRule
import com.google.android.material.textfield.TextInputEditText
import com.google.common.truth.Truth.assertThat
import dagger.Component
import org.hamcrest.CoreMatchers.containsString
import org.hamcrest.Matchers.allOf
import org.junit.After
import org.junit.Before
Expand Down Expand Up @@ -1136,6 +1137,37 @@ class PinPasswordActivityTest {
}
}

@Test
fun testPinPassword_clickForgotPin_enterAdminPin_clickSubmit_dialogMessageIsCorrect() {
ActivityScenario.launch<PinPasswordActivity>(
PinPasswordActivity.createPinPasswordActivityIntent(
context = context,
adminPin = adminPin,
profileId = userId
)
).use {
onView(withId(R.id.forgot_pin)).perform(click())
onView(
allOf(
withId(R.id.admin_settings_input_pin_edit_text),
isDescendantOfA(withId(R.id.admin_settings_input_pin))
)
).inRoot(isDialog())
.perform(editTextInputAction.appendText("12345"), closeSoftKeyboard())
onView(withText(context.getString(R.string.admin_settings_submit)))
.inRoot(isDialog())
.perform(click())
testCoroutineDispatchers.runCurrent()
onView(
withText(
containsString(
context.resources.getString(R.string.reset_pin_enter_dialog_message, "Ben")
)
)
).inRoot(isDialog()).check(matches(isDisplayed()))
}
}

private fun getAppName(): String = context.resources.getString(R.string.app_name)

private fun getPinPasswordForgotMessage(): String =
Expand Down

0 comments on commit fc6c881

Please sign in to comment.