Android: Expand notification bar in android cucumber

28 Views Asked by At

Below code used for Expand notification Bar and

notificationHeader!!.swipe(Direction.DOWN, 0.05f)

This code used for wipe down the notification bar but not working correctly so Is there any other way to Swipe down the notification? and

other question is Is there any way to re-try same line of code 2-3 iteration ?

private fun expandNotificationBar(AppName: String) {
    private lateinit var device: UiDevice
    val selector = By.textStartsWith(AppName)
    Assert.assertNotNull(selector)
    var notificationHeader = device.wait(Until.findObject(selector), VISIBILITY_TIMEOUT)
    if (notificationHeader == null) {
        for (i in 0..9) {
            notificationHeader = device.wait(Until.findObject(selector), VISIBILITY_TIMEOUT)
            if (notificationHeader != null) {
                break
            }
        }
    }
    Assert.assertNotNull(notificationHeader)
    // TODO below code used for wipe down the notification bar but not working correctly so Is there any other way to Swipe down the notification?
    notificationHeader!!.swipe(Direction.DOWN, 0.05f)
}

Thanks in advance!!

0

There are 0 best solutions below