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 #2536: Introduce a central utility for matching item in RecyclerView #2957

Closed
wants to merge 1 commit into from
Closed

Fix #2536: Introduce a central utility for matching item in RecyclerView #2957

wants to merge 1 commit into from

Conversation

Sparsh1212
Copy link
Contributor

Explanation

Fixes #2536: Introduce a central utility for matching item in RecyclerView

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

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
Copy link
Contributor Author

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 the RecyclerViewMatcher could be imported. I tried adding the app module to the testing module, but that doesn't seem to work.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

@Sparsh1212 Sparsh1212 Mar 22, 2021

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 ?

Copy link
Contributor

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.

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
Copy link
Contributor

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.

import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPositionOnView

class VerifyItemDisplayedInRecyclerView {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check EditTextInputAction for reference.

We can make this class all about RecyclerView testing. So, it's not only about testing item at the position. In future, we can have things like item string checking or anything that comes up we can use this class as a central utility for all types of testing for RecyclerView.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here.

@Sparsh1212
Copy link
Contributor Author

Closing this PR, as the discussion is completed.

@Sparsh1212 Sparsh1212 closed this Mar 22, 2021
@Sparsh1212 Sparsh1212 deleted the add-central-testing-utility branch March 22, 2021 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce a central utility for matching item in RecyclerView [Testing]
3 participants