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 part of #3602: Add accessibility label for ProfileEditActivity #4894

Merged
merged 15 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.settings.profile.ProfileEditActivity"
android:label="@string/profile_edit_activity_label"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.settings.profile.ProfileListActivity"
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 @@ -351,6 +351,7 @@
<!-- ProfileListActivity -->
<string name="profile_list_activity_title">Profiles</string>
<!-- ProfileEditActivity -->
<string name="profile_edit_activity_label">Edit Profile</string>
<string name="profile_edit_created">Created on %s</string>
<string name="profile_last_used">Last used </string>
<string name="profile_edit_rename">Rename</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule
import org.oppia.android.app.application.testing.TestingBuildFlavorModule
import org.oppia.android.app.devoptions.DeveloperOptionsModule
import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.ScreenName
import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule
import org.oppia.android.app.shim.ViewBindingShimModule
Expand Down Expand Up @@ -161,18 +160,15 @@ class ProfileEditActivityTest {

@Test
fun testProfileEditActivity_hasCorrectActivityLabel() {
profileManagementController.updateName(
ProfileId.newBuilder().setInternalId(1).build(),
newName = "Yash"
)
launch<ProfileEditActivity>(
ProfileEditActivity.createProfileEditActivity(
context = context,
profileId = 1
)
).use {
testCoroutineDispatchers.runCurrent()
onView(withId(R.id.profile_edit_toolbar)).check(matches(hasDescendant(withText("Yash"))))
onView(withId(R.id.profile_edit_toolbar)).check(
matches(hasDescendant(withText(context.getString(R.string.profile_edit_activity_label))))
)
}
}

Expand Down Expand Up @@ -282,7 +278,6 @@ class ProfileEditActivityTest {
)
).use {
testCoroutineDispatchers.runCurrent()
onView(withId(R.id.profile_edit_toolbar)).check(matches(hasDescendant(withText("Ben"))))
onView(withId(R.id.profile_edit_name)).check(matches(withText("Ben")))
onView(withId(R.id.profile_edit_allow_download_heading)).check(matches(not(isDisplayed())))
onView(withId(R.id.profile_edit_allow_download_sub)).check(matches(not(isDisplayed())))
Expand All @@ -301,7 +296,6 @@ class ProfileEditActivityTest {
).use {
testCoroutineDispatchers.runCurrent()
onView(isRoot()).perform(orientationLandscape())
onView(withId(R.id.profile_edit_toolbar)).check(matches(hasDescendant(withText("Admin"))))
onView(withId(R.id.profile_edit_name)).check(matches(withText("Admin")))
onView(withId(R.id.profile_edit_allow_download_heading)).check(matches(not(isDisplayed())))
onView(withId(R.id.profile_edit_allow_download_sub)).check(matches(not(isDisplayed())))
Expand All @@ -320,7 +314,6 @@ class ProfileEditActivityTest {
).use {
testCoroutineDispatchers.runCurrent()
onView(isRoot()).perform(orientationLandscape())
onView(withId(R.id.profile_edit_toolbar)).check(matches(hasDescendant(withText("Ben"))))
onView(withId(R.id.profile_edit_name)).check(matches(withText("Ben")))
onView(withId(R.id.profile_edit_allow_download_sub)).check(matches(not(isDisplayed())))
onView(withId(R.id.profile_edit_allow_download_switch)).check(matches(not(isDisplayed())))
Expand All @@ -337,7 +330,6 @@ class ProfileEditActivityTest {
)
).use {
testCoroutineDispatchers.runCurrent()
onView(withId(R.id.profile_edit_toolbar)).check(matches(hasDescendant(withText("Admin"))))
onView(withId(R.id.profile_edit_name)).check(matches(withText("Admin")))
onView(withId(R.id.profile_edit_allow_download_heading)).check(matches(not(isDisplayed())))
onView(withId(R.id.profile_edit_allow_download_sub)).check(matches(not(isDisplayed())))
Expand All @@ -346,24 +338,6 @@ class ProfileEditActivityTest {
}
}

@Test
fun testProfileEdit_updateName_checkNewNameDisplayed() {
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
profileManagementController.updateName(
ProfileId.newBuilder().setInternalId(1).build(),
newName = "Akshay"
)
launch<ProfileEditActivity>(
ProfileEditActivity.createProfileEditActivity(
context = context,
profileId = 1
)
).use {
testCoroutineDispatchers.runCurrent()
onView(withId(R.id.profile_edit_toolbar)).check(matches(hasDescendant(withText("Akshay"))))
onView(withId(R.id.profile_edit_name)).check(matches(withText("Akshay")))
}
}

// 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 @@ -6,7 +6,6 @@ exempted_activity: "app/src/main/java/org/oppia/android/app/devoptions/viewevent
exempted_activity: "app/src/main/java/org/oppia/android/app/devoptions/testing/DeveloperOptionsTestActivity"
exempted_activity: "app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedActivity"
exempted_activity: "app/src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivity"
exempted_activity: "app/src/main/java/org/oppia/android/app/settings/profile/ProfileEditActivity"
exempted_activity: "app/src/main/java/org/oppia/android/app/testing/AppCompatCheckBoxBindingAdaptersTestActivity"
exempted_activity: "app/src/main/java/org/oppia/android/app/testing/AudioFragmentTestActivity"
exempted_activity: "app/src/main/java/org/oppia/android/app/testing/BindableAdapterTestActivity"
Expand Down