android - Detox 至少 75% 的 View 区域显示给用户

标签 android react-native android-espresso detox

我尝试使用 detox 检查该元素是否在 android 模拟器中可见。
我滚动页面并查看元素,但是当我使用 detox 检查元素是否可见时,我收到此错误:

 Test Failed: 'at least 75 percent of the view's area is displayed to the user.' doesn't match the selected view.
    Expected: at least 75 percent of the view's area is displayed to the user.
         Got: "ReactViewGroup{id=1227, visibility=VISIBLE, width=250, height=250, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.view.ViewGroup$LayoutParams@a376217, tag=test1, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=95.0, child-count=1}"
我尝试滚动更多以将元素放在屏幕中间,但没有区别。
await expect(element(by.id('test1')).atIndex('2')).toBeVisible();
我使用 react-native 所以它是相同的代码..,它与 iOS 完美配合,但在 android 中,我得到了我提到的错误。
*detox 是使用 android-espresso 的 react-native 的 e2e 测试库

最佳答案

就我而言,事实证明,我在本地拥有比 CI 更大的设备。因此,当我使用 --take-screenshots failing 截屏失败时我注意到,经过测试的 View 位于绝对 View 之下,并且被覆盖了。 IDK,如果它与上述问题有关,但也许它会帮助其他人。

关于android - Detox 至少 75% 的 View 区域显示给用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64278482/

相关文章:

android - 为android开发设置pc的问题

android - 此 RelativeLayout 布局或其 LinearLayout 父级无用

android - 在 libgdx 中构建一个一侧带有纹理的盒子 - 性能

javascript - react native 导航 onAuthStateChanged

react-native - 有没有办法保护数据不被 PWA 抓取?

android - 我可以使用 Espresso 测试状态栏色调/颜色吗?

android - 在ExoPlayer中复制音频ByteBuffer

android - 如果设备上缺少 HMS,防止@hmscore 显示初始弹出窗口

Android IllegalStateException 未注册仪器!必须在注册仪器下运行

android - ActivityTestRule实例化导致的java.lang.IncompatibleClassChangeError