gpt4 book ai didi

安卓 Espresso : How to test whether a button click migrates to a new screen?

转载 作者:太空狗 更新时间:2023-10-29 14:00:04 26 4
gpt4 key购买 nike

onView(withId(R.id.BUTTON))
.perform(click())
.check(matches(withContentDescription(R.id.my_layout)));
onView(withId(R.id.tp_layout))
.check(matches(isDisplayed()));

我正在尝试测试按钮点击是否会迁移到下一个屏幕..我该如何匹配,只有第一个测试正在运行并且它显示测试失败。

最佳答案

您可以使用 Espresso 扩展 - Espresso-Intents。

Here is the official tutorial .

快速报价:

Espresso-Intents is an extension to Espresso, which enables validationand stubbing of intents sent out by the application under test. It’slike Mockito, but for Android Intents.

If your app delegates functionality to other apps or the platform, youcan use Espresso-Intents to focus on your own app's logic whileassuming that other apps or the platform will function correctly. WithEspresso-Intents, you can match and validate your outgoing intents oreven provide stub responses in place of actual intent responses.

关于安卓 Espresso : How to test whether a button click migrates to a new screen?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36372072/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com