-
Notifications
You must be signed in to change notification settings - Fork 28
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 scroll #42
base: main
Are you sure you want to change the base?
fix scroll #42
Conversation
We can merge this if this is urgent but I'd rather not rely upon presence of espresso classes as a way to enable a feature or not. Mocks of those classes can go into an app even outside of a testing context. An alternative approach is we can define a property to enable/disable this explicitly. The property can be |
@@ -35,6 +35,15 @@ public class ProductCatalogFragment extends BaseFragment implements View.OnClick | |||
ProductsAdapter adapter; | |||
ProductCatalogViewModel viewModel; | |||
|
|||
public static boolean isRunningEspressoTest() { |
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 would like to understand if this check is actually needed. I mean, why can't we just enable nested scrolling android:nestedScrollingEnabled="true"
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 a better approach indeed. If it works, please ignore my alternative solution (accessing activity reference in test code) above.
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 would like to understand if this check is actually needed. I mean, why can't we just enable nested scrolling
android:nestedScrollingEnabled="true"
As I mentioned in description, scrolling down time to time ends up with scrolling up which breaks taking full page screenshot in our tests. The issue is fixed after turning off nestedScrollingEnabled
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.
Thanks!
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.
Then please create a function in the fragment that does this:
binding.productRV.setNestedScrollingEnabled(true);
and call that function explicitly in the test class so that you can safely remove isRunningEspressoTest()
from the fragment entirely.
Because of nested scrollable element time to time scroll down (swipe up) will end up with going into wrong direction. I did a fix to make scroll works for native full page screenshot test in visual e2e repo.