Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#2,196 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java

调研方向

从链接的示例项目中的 MainActivity 和 MainActivityTest 开始,然后在 API 31 和 API 32+ 设备上复现 ViewPager2 的 ViewActions.swipeRight。将手势行为与 swipeLeft 进行比较,并跟踪相关的 Espresso 入口点。完成标准是:在 API 32 及更高版本上,swipeRight 会让 ViewPager2 翻页,而不是触发返回操作。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Java
星标
1.2k
派生
342
平均合并
1 天 14 小时
30 天内合并 PR
5

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

android/android-test 的其他 Issue

查看 android/android-test 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。