-
Notifications
You must be signed in to change notification settings - Fork 520
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 #657: Lowfi Admin Controls (Part 1) #665
Fix #657: Lowfi Admin Controls (Part 1) #665
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have taken an overview look at this. PTAL, I will review it in detail later on. Thanks.
app/src/main/java/org/oppia/app/drawer/NavigationDrawerFragmentPresenter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/drawer/NavigationDrawerFragmentPresenter.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a very good implementation. Thanks. I have requested some changes. Also, once you open the Administrator Controls
on back click it is going to ProfileChooser instead it should go to HOME
app/src/main/java/org/oppia/app/administratorcontrols/AdministratorControlsActivity.kt
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/drawer/NavigationDrawerFragmentPresenter.kt
Outdated
Show resolved
Hide resolved
companion object { | ||
fun createHelpActivityIntent(context: Context, profileId: Int?): Intent { | ||
val intent = Intent(context, HelpActivity::class.java) | ||
intent.putExtra(KEY_HOME_PROFILE_ID, profileId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required in HELP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rt4914 I have done this implementation and also changed both the intent calls in NavigationDrawerFragmentPresenter
because otherwise Administrator Controls option won't be visible when we move to Help Activity and then open nav. drawer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replied above
app/src/sharedTest/java/org/oppia/app/testing/NavigationDrawerTestActivityTest.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/app/testing/NavigationDrawerTestActivityTest.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can change the HelpActivity intent implementation, we don't need profileId in that. Also you have missed my earlier comment: #665 (review)
This looks like a very good implementation. Thanks. I have requested some changes. Also, once you open the Administrator Controls on back click it is going to ProfileChooser instead it should go to HOME and also write test case for checking this.
Along with this non-flaky
tests are failing, maybe merge this PR with develop to get latest code.
app/src/main/java/org/oppia/app/drawer/NavigationDrawerFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/drawer/NavigationDrawerFragmentPresenter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/drawer/NavigationDrawerFragmentPresenter.kt
Show resolved
Hide resolved
…s, opens HomeActivity implemented and test-case for that is also written.
@rt4914 I have written a testcase, actually extended the code in a test-case which was opening the AdminControlsActivity, there I have put backPressed and checked if recyclerView from homeActivity is visible or not. The test-case is passing successfully. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one change regarding the test case.
app/src/sharedTest/java/org/oppia/app/testing/NavigationDrawerTestActivityTest.kt
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Test | ||
fun testNavigationDrawerTestActivity_withAdminProfile_openNavigationDrawer_clickAdministratorControls_checkOpensAdministratorControlsActivity_onBackPressed_showsHomeActivity() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this test case is correct but this test case is not a functionality of NavigationDrawer, instead it is the functionality of AdministratorControlsActivity. So please create a new dedicated test file AdministratorControlsActivityTest
and in this file write this test case. Also, note that the function name will be updated accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made a new test file and written same testcase in it. Test is passing successfully. and changed this test-case so that it will now only check for AdministratorActivity opened or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one final Nit. Also, always self-review your PR to make your PR merge ready faster. Thanks
@Test | ||
fun testAdministratorControlsActivity_withAdminProfile_openAdministratorControlsActivityFromNavigationDrawer_onBackPressed_showsHomeActivity() { | ||
ActivityScenario.launch<NavigationDrawerTestActivity>(createNavigationDrawerActivityIntent(0)).use { | ||
Espresso.onView(withContentDescription(R.string.drawer_open_content_description)).perform(click()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit about imports:
onView(withContentDescription(R.string.drawer_open_content_description)).perform(click())
onView(withId(R.id.administrator_controls_linear_layout)).check(matches(isDisplayed())).perform(click())
intended(hasComponent(AdministratorControlsActivity::class.java.name))
intended(hasExtra(AdministratorControlsActivity.getIntentKey(), 0))
onView(isRoot()).perform(pressBack())
onView(withId(R.id.home_recycler_view)).check(matches(isDisplayed()))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Explanation
Fix: #657 : Lowfi Admin Controls (Part 1) - Show/hide admin controls option in navigation drawer.
Checklist