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

Espresso ViewActions.swipeRight doesn't work for ViewPager2 on device with API 32+ #2196

Open
alecarnevale opened this issue Apr 17, 2024 · 0 comments

Comments

@alecarnevale
Copy link

Description

As the title says, ViewActions.swipeRight doesn't work on devices with API >= 32 when called on ViewPager2.

Calling a swipeRight on a ViewPager2 triggers a back instead of a swiping on the ViewPager2 itself.

Steps to Reproduce

In the sample project linked below you can find a simple activity MainActivity with a ViewPager2, and a MainActivityTest.

The test just swipes on the view pager using Espresso ViewActions: swipeLeft/swipeRight.
Launching the test on a device with API <= 31 passes, but fails on devices with API 32 and above.

swipeLeft instead, works in any case.

Expected Results

Performing swiping actions on the view pager.

Demo on emulator device with API 31

api-31.mp4

Actual Results

Back press.

Demo on emulator device with API 32

api-32.mp4

AndroidX Test and Android OS Versions

  • agp = "8.3.2"
  • kotlin = "1.9.0"
  • activity = "1.8.2"
  • appcompat = "1.6.1"
  • viewpager2 = "1.0.0"
  • espressoCore = "3.5.1"
  • testCore = "1.5.0"
  • testJunit = "1.1.5"

Link to a public git repo demonstrating the problem:

https://github.com/alecarnevale/EspressoSwipeRightIssue/tree/master

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

1 participant