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

Nit changes #740

Merged
merged 1 commit into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.oppia.app.administratorcontrols.administratorcontrolsitemviewmodel

/** [ViewModel] for the recycler view in [AdministratorControlsFragment]. */
/** [ViewModel] for the recycler view in [AdministratorControlsFragment]. */
class AdministratorControlsAccountActionsViewModel : AdministratorControlsItemViewModel()
Original file line number Diff line number Diff line change
Expand Up @@ -90,40 +90,100 @@ class AdministratorControlsActivityTest {
@Test
fun testAdministratorControlsFragment_loadFragment_displayGeneralAndProfileManagement() {
ActivityScenario.launch<AdministratorControlsActivity>(createAdministratorControlsActivityIntent(0)).use {
onView(atPositionOnView(R.id.administrator_controls_list, 0, R.id.general_text_view)).check(matches(isDisplayed()))
onView(atPositionOnView(R.id.administrator_controls_list, 0, R.id.edit_account_text_view)).check(matches(withText(context.resources.getString(R.string.administrator_controls_edit_account))))
onView(atPositionOnView(R.id.administrator_controls_list, 1, R.id.profile_management_text_view)).check(matches(isDisplayed()))
onView(atPositionOnView(R.id.administrator_controls_list, 1, R.id.edit_profiles_text_view)).check(matches(withText(context.resources.getString(R.string.administrator_controls_edit_profiles))))
onView(
atPositionOnView(
R.id.administrator_controls_list,
0,
R.id.general_text_view
)
).check(matches(isDisplayed()))
onView(atPositionOnView(R.id.administrator_controls_list, 0, R.id.edit_account_text_view)).check(
matches(
withText(
context.resources.getString(R.string.administrator_controls_edit_account)
)
)
)
onView(atPositionOnView(R.id.administrator_controls_list, 1, R.id.profile_management_text_view)).check(
matches(
isDisplayed()
)
)
onView(
atPositionOnView(
R.id.administrator_controls_list,
1,
R.id.edit_profiles_text_view
)
).check(matches(withText(context.resources.getString(R.string.administrator_controls_edit_profiles))))
}
}

@Test
fun testAdministratorControlsFragment_loadFragment_displayDownloadPermissionsAndSettings() {
ActivityScenario.launch<AdministratorControlsActivity>(createAdministratorControlsActivityIntent(0)).use {
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.download_permissions_text_view)).check(matches(withText(context.resources.getString(R.string.administrator_controls_download_permissions_label))))
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.topic_update_on_wifi_constraint_layout)).check(matches(isDisplayed()))
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.download_permissions_text_view)).check(
matches(
withText(context.resources.getString(R.string.administrator_controls_download_permissions_label))
)
)
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.topic_update_on_wifi_constraint_layout)).check(
matches(isDisplayed())
)
onView(withId(R.id.administrator_controls_list)).perform(scrollToPosition<RecyclerView.ViewHolder>(2))
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.auto_update_topic_constraint_layout)).check(matches(isDisplayed()))
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.auto_update_topic_constraint_layout)).check(
matches(isDisplayed())
)
}
}

@Test
fun testAdministratorControlsFragment_loadFragment_displayApplicationSettings() {
ActivityScenario.launch<AdministratorControlsActivity>(createAdministratorControlsActivityIntent(0)).use {
onView(withId(R.id.administrator_controls_list)).perform(scrollToPosition<RecyclerView.ViewHolder>(3))
onView(atPositionOnView(R.id.administrator_controls_list, 3, R.id.app_information_text_view)).check(matches(isDisplayed()))
onView(atPositionOnView(R.id.administrator_controls_list, 3, R.id.app_version_text_view)).check(matches(withText("App Version")))
onView(atPositionOnView(R.id.administrator_controls_list, 4, R.id.account_actions_text_view)).check(matches(isDisplayed()))
onView(atPositionOnView(R.id.administrator_controls_list, 4, R.id.log_out_text_view)).check(matches(withText("Log Out")))
onView(atPositionOnView(R.id.administrator_controls_list, 3, R.id.app_information_text_view)).check(
matches(
isDisplayed()
)
)
onView(
atPositionOnView(
R.id.administrator_controls_list,
3,
R.id.app_version_text_view
)
).check(matches(withText(context.resources.getString(R.string.administrator_controls_app_version))))
onView(atPositionOnView(R.id.administrator_controls_list, 4, R.id.account_actions_text_view)).check(
matches(
isDisplayed()
)
)
onView(
atPositionOnView(
R.id.administrator_controls_list,
4,
R.id.log_out_text_view
)
).check(matches(withText(context.resources.getString(R.string.administrator_controls_log_out))))
}
}

@Test
fun testAdministratorControlsFragment_loadFragment_topicUpdateOnWifiSwitchIsNotChecked_autoUpdateTopicSwitchIsChecked() {
ActivityScenario.launch<AdministratorControlsActivity>(createAdministratorControlsActivityIntent(0)).use {
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.topic_update_on_wifi_switch)).check(matches(not(isChecked())))
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.topic_update_on_wifi_switch)).check(
matches(
not(
isChecked()
)
)
)
onView(withId(R.id.administrator_controls_list)).perform(scrollToPosition<RecyclerView.ViewHolder>(2))
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.auto_update_topic_switch)).check(matches(isChecked()))
onView(atPositionOnView(R.id.administrator_controls_list, 2, R.id.auto_update_topic_switch)).check(
matches(
isChecked()
)
)
}
}

Expand Down