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

Support for viewpager,resource idling #345

Open
GauravP123 opened this issue May 16, 2020 · 1 comment
Open

Support for viewpager,resource idling #345

GauravP123 opened this issue May 16, 2020 · 1 comment

Comments

@GauravP123
Copy link

GauravP123 commented May 16, 2020

Can we have support for viewpager with tablayout.
Use cases are-

  • Current active tab
  • Change tab selection as per index

Also, can we have something related to resource idling
the use case for this

  • Click on tab layout index
  • Wait till the list is visible (waitTillViewIsVisible)
  • Click on 2nd pos

`fun waitTillViewIsVisible(matcher: Matcher): ViewAction = object : ViewAction {

override fun getConstraints(): Matcher<View> {
    return Matchers.any(View::class.java)
}

override fun getDescription(): String {
    return StringDescription().let {
        matcher.describeTo(it)
        "wait until: $it"
    }
}

override fun perform(uiController: UiController, view: View) {
    if (!matcher.matches(view)) {
        ViewPropertyChangeCallback(matcher, view).run {
            try {
                IdlingRegistry.getInstance().register(this)
                view.viewTreeObserver.addOnDrawListener(this)
           } finally {
                view.viewTreeObserver.removeOnDrawListener(this)
                IdlingRegistry.getInstance().unregister(this)
            }
        }
    }
}}`
@alorma
Copy link
Member

alorma commented Jul 1, 2021

Hi @GauravP123 .

On theory Espresso already waits until the view changes are done before doing any other interaction.

If you are able to replicate the case in a test we can check from there.

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

No branches or pull requests

2 participants