-
Notifications
You must be signed in to change notification settings - Fork 551
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 #2536: Introduce a central utility for matching item in RecyclerView #2957
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.oppia.android.testing | ||
|
||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPositionOnView | ||
|
||
class VerifyItemDisplayedInRecyclerView { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check We can make this class all about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto here. |
||
companion object { | ||
private fun verifyItemDisplayedOnRecyclerView( | ||
recyclerView: Int, | ||
itemPosition: Int, | ||
targetView: Int | ||
) { | ||
onView( | ||
atPositionOnView( | ||
recyclerViewId = recyclerView, | ||
position = itemPosition, | ||
targetViewId = targetView | ||
) | ||
).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.
@anandwana001 I am facing trouble while importing this. Please guide me on what changes should I make in
build.gradle
file so that theRecyclerViewMatcher
could be imported. I tried adding theapp
module to thetesting
module, but that doesn't seem to work.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 guess we can shift
RecyclerViewMatcher
to the testing module.Waiting for @rt4914 confirmation.
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.
Okay will do that after the confirmation.
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 talked to him, yes we are good to shift it.
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.
Shall I update the overall codebase to use this new central utility of RecyclerViewTest or only update the
AdministratorControlsActivityTest
?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 it will require updating all the files which are using
RecyclerViewMatcher
, as the import path will going to change for all.Check all the files using it and try to have a successful Gradle build.