【发布时间】:2018-11-23 22:24:48
【问题描述】:
我正在尝试检查电话拨号器是否通过 Espresso 以正确的电话号码打开,但到目前为止还不能做到这一点。 我试过了:
Intents.init();
Intent stubIntent = new Intent();
Instrumentation.ActivityResult stubResult = new Instrumentation.ActivityResult(Activity.RESULT_OK, stubIntent);
intending(hasAction(Intent.ACTION_DIAL)).respondWith(stubResult);
intended(Matchers.allOf(hasAction(Intent.ACTION_DIAL), hasData(Uri.parse("+3531234567"))));
还有
Intents.init();
intended(allOf(hasAction(Intent.ACTION_DIAL), hasData(Uri.parse("+3531234567"))));
拨号器是通过我的 XML 上的 TextView 上的自动链接触发的,如果这有任何帮助吗?
android:autoLink="all"
那是 Espresso 打开的拨号器
非常感谢。
【问题讨论】:
标签: android android-intent android-espresso