【发布时间】:2015-04-11 06:11:49
【问题描述】:
我正在使用带有 Lollipop android 操作系统的 Nexus 5 和 Cyanogen One plus 设备。我正在尝试测试某些应用程序的各种通知。我成功地使用 UiAutomator 测试了托盘通知和锁定屏幕通知,但我无法通过提示通知取得任何成功。我尝试了以下代码,但未能检测到。
public void test_HeadsupTitle() throws InterruptedException, UiObjectNotFoundException, IOException
{
//some code to bring up headsup notification
UiObject maxHeadsUp = new UiObject(new UiSelector().packageName("com.android.systemui").resourceId("android:id/status_bar_latest_event_content"));
// code to add sleep so that it waits for heads up notification to show up
assertTrue(maxHeadsUp.exists());
}
有没有办法将 UiAutomator 中的提示通知检测为运行自动化时要查找的对象?
【问题讨论】:
-
出于好奇,您是如何测试托盘通知和锁屏通知的?我现在也需要这样做……
标签: android notifications android-notifications android-uiautomator heads-up-notifications