Search in sources :

Example 86 with UiObject

use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.

the class BugreportReceiverTest method waitForScreenshotButtonEnabled.

private UiObject waitForScreenshotButtonEnabled(boolean expectedEnabled) throws Exception {
    UiObject screenshotButton = getScreenshotButton();
    int maxAttempts = SAFE_SCREENSHOT_DELAY;
    int i = 0;
    do {
        boolean enabled = screenshotButton.isEnabled();
        if (enabled == expectedEnabled) {
            return screenshotButton;
        }
        i++;
        Log.v(TAG, "Sleeping for 1 second while waiting for screenshot.enable to be " + expectedEnabled + " (attempt " + i + ")");
        Thread.sleep(DateUtils.SECOND_IN_MILLIS);
    } while (i <= maxAttempts);
    fail("screenshot.enable didn't change to " + expectedEnabled + " in " + maxAttempts + "s");
    return screenshotButton;
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 87 with UiObject

use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.

the class UiBot method getVisibleObject.

/**
     * Gets an object which is guaranteed to be present in the current UI.
     *
     * @param text Object's text as displayed by the UI.
     */
public UiObject getVisibleObject(String text) {
    UiObject uiObject = mDevice.findObject(new UiSelector().text(text));
    assertTrue("could not find object with text '" + text + "'", uiObject.exists());
    return uiObject;
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector)

Example 88 with UiObject

use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.

the class UiBot method clickJustOnce.

private void clickJustOnce() {
    boolean gotIt = mDevice.wait(Until.hasObject(By.res("android", "button_once")), mTimeout);
    assertTrue("'Just Once' button not visible yet", gotIt);
    UiObject justOnce = mDevice.findObject(new UiSelector().resourceId("android:id/button_once"));
    assertTrue("'Just Once' button not found", justOnce.exists());
    click(justOnce, "Just Once");
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector)

Example 89 with UiObject

use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.

the class UiBot method clickOnNotification.

/**
     * Opens the system notification and clicks a given notification.
     *
     * @param text Notificaton's text as displayed by the UI.
     */
public void clickOnNotification(String text) {
    UiObject notification = getNotification(text);
    click(notification, "bug report notification");
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 90 with UiObject

use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.

the class UiBot method getVisibleObjectById.

/**
     * Gets an object which is guaranteed to be present in the current UI.
     *
     * @param text Object's text as displayed by the UI.
     */
public UiObject getVisibleObjectById(String id) {
    UiObject uiObject = mDevice.findObject(new UiSelector().resourceId(id));
    assertTrue("could not find object with id '" + id + "'", uiObject.exists());
    return uiObject;
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector)

Aggregations

UiObject (android.support.test.uiautomator.UiObject)140 UiSelector (android.support.test.uiautomator.UiSelector)44 UiScrollable (android.support.test.uiautomator.UiScrollable)13 UiObjectNotFoundException (android.support.test.uiautomator.UiObjectNotFoundException)7 DownloadManager (android.app.DownloadManager)5 Request (android.app.DownloadManager.Request)5 Bundle (android.os.Bundle)5 Suppress (android.test.suitebuilder.annotation.Suppress)5 NumberFormat (java.text.NumberFormat)5 Test (org.junit.Test)3 MediumTest (android.support.test.filters.MediumTest)2 UiDevice (android.support.test.uiautomator.UiDevice)2 RelativeLayout (android.widget.RelativeLayout)1