android - 执行“单击”时出错 - 在坐标处执行简单的单击操作
问题描述
我有一个看法。单击此按钮后,它会显示对话框,我想验证它是否已显示。在单击之前,我正在检查视图是否显示为 100% 并且它通过了正常。但是 onClick 由于某种原因不起作用。
测试代码
val scenario = ActivityScenario.launch(MyActivity::class.java)
scenario.moveToState(Lifecycle.State.RESUMED)
onView(withId(R.id.passwordLabel))
.check(matches(ViewMatchers.isCompletelyDisplayed()))
onView(withId(R.id.passwordLabel))
.perform(click())
错误
Error performing 'single click - At Coordinates: 75, 62 and precision: 16, 16' on view 'with id is <com.domain.dev:id/passwordLabel>'.
androidx.test.espresso.PerformException: Error performing 'single click - At Coordinates: 75, 62 and precision: 16, 16' on view 'with id is <com.domain.dev:id/passwordLabel>
造成的
Caused by: android.renderscript.RSDriverException: Failed to create RS context.
我的测试班
@ExperimentalCoroutinesApi
@HiltAndroidTest
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28])
@LooperMode(LooperMode.Mode.PAUSED)
class MyActivityTest {
解决方案
推荐阅读
- azure - 创建警报电子邮件时如何在 Azure 逻辑应用中获取动态内容对象事件的内部详细信息
- java - 如何授权 AutoCompleteTextView 字段对可用选项进行有限更改?
- html - 是否可以在 HTML `body` 元素上使用`resize` CSS 属性?
- puppeteer - `page.goto` 超时后 Puppeteer `page` 对象不起作用?
- swift - NSTableView 逐行滚动
- android - 字段_user尚未初始化 - Flutter
- ios - 尝试从 Swift iOS 中的地图打开商店位置时,Google 地图永远加载
- grpc - 持久的 grpc 流式 RPC 和退避策略
- paypal - Paypal 订阅用户:50% 的时间显示“我们无法处理您的定期付款”
- sql - 当值更改时重置行号