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

Add a sleep after every pager swipe? #335

Open
rocboronat opened this issue Dec 10, 2019 · 3 comments
Open

Add a sleep after every pager swipe? #335

rocboronat opened this issue Dec 10, 2019 · 3 comments

Comments

@rocboronat
Copy link
Member

When running tests on Firebases's real devices like the Samsung S9, I see that it doesn't wait after doing a swipe on a pager. So, if you make three swipes and then tap a button in the screen, the tap will be lost.

I solve it by adding sleeps after the swipes in the test. What about doing those sleeps in Barista?

It will make everyone's tests a bit slower, but it will save some headaches.

@rozautd
Copy link

rozautd commented Jan 16, 2020

You can add loops for clickOn(). I wrote my own tryInLoop for click (asserts to) and now when the test wants to click Id it does it in a loop (for 5 second the test tries to click every second)

@rocboronat
Copy link
Member Author

Sounds good! Thanks for the idea @rozautd 😀

@VictorIreri
Copy link

VictorIreri commented Oct 5, 2021

Perhaps you could implement an IdlingResource that checks the state of the ViewPager?
Just had a look at the docs and the way to check the state is via ViewPager.OnPageChangeListener. More specifically if you override the onPageScrollStateChanged method, you can wait for the state SCROLL_STATE_IDLE which is described as follows:

Indicates that the pager is in an idle, settled state. The current page is fully in view and no animation is in progress.

There is an example here of using an IdlingResource to check the state of a Snackbar to give you an idea.

Hope that helps.

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

3 participants