I am working with Nexus 5 and Cyanogen One plus devices with Lollipop android OS. I am trying to test various notifications of certain app. I was successfully able to test tray notification and lock screen notification with UiAutomator but I am not able to have any success with headsup notification. I tried following code but it failed to detect it.
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());
}
Is there a way to detect headsup notifications in UiAutomator as an object to look for when running automation?