android / android/android-test
Espresso ViewActions.swipeRight doesn't work for ViewPager2 on device with API 32+
- Vorherrschende Sprache
- Java
- Sterne
- 1.2k
- Forks
- 342
- Ø Merge
- 11 Std. 29 Min.
- Gemergte PRs (30 T.)
- 2
Beschreibung
### 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
https://github.com/android/android-test/assets/43886303/c1ffedd4-4b8d-42d7-9093-532f9a9f5655
### Actual Results
Back press.
Demo on emulator device with API 32
https://github.com/android/android-test/assets/43886303/690e5456-5622-4ba3-82be-8170cdbb5e2a
### 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
Beitragsleitfaden
Rechercherichtung
Beginne mit MainActivity und MainActivityTest des verlinkten Beispielprojekts und reproduziere anschließend ViewActions.swipeRight auf ViewPager2 auf Geräten mit API 31 und API 32+. Vergleiche das Gestenverhalten mit swipeLeft und verfolge den relevanten Espresso-Einstiegspunkt. Als abgeschlossen gilt die Aufgabe, wenn swipeRight auf API 32 und neuer durch ViewPager2 blättert, anstatt die Zurück-Aktion auszulösen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- mobile-dev, testing
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100