Search in sources :

Example 46 with UiObject

use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.

the class DirectoryListBot method openDocument.

public void openDocument(String label) throws UiObjectNotFoundException {
    int toolType = Configurator.getInstance().getToolType();
    Configurator.getInstance().setToolType(MotionEvent.TOOL_TYPE_FINGER);
    UiObject doc = findDocument(label);
    doc.click();
    Configurator.getInstance().setToolType(toolType);
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 47 with UiObject

use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.

the class DirectoryListBot method assertMessageTextView.

public void assertMessageTextView(String message) throws UiObjectNotFoundException {
    UiObject messageTextView = findMessageTextView();
    assertTrue(messageTextView.exists());
    String msg = String.valueOf(message);
    assertEquals(String.format(msg, "TEST_ROOT_0"), messageTextView.getText());
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 48 with UiObject

use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.

the class DirectoryListBot method assertDocumentsCountOnList.

public void assertDocumentsCountOnList(boolean exists, int count) throws UiObjectNotFoundException {
    UiObject docsList = findDocumentsList();
    assertEquals(exists, docsList.exists());
    if (docsList.exists()) {
        assertEquals(count, docsList.getChildCount());
    }
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 49 with UiObject

use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.

the class RootsListBot method findRoot.

private UiObject findRoot(String label) throws UiObjectNotFoundException {
    final UiSelector rootsList = new UiSelector().resourceId("com.android.documentsui:id/container_roots").childSelector(new UiSelector().resourceId(ROOTS_LIST_ID));
    // We might need to expand drawer if not visible
    if (!new UiObject(rootsList).waitForExists(mTimeout)) {
        Log.d(TAG, "Failed to find roots list; trying to expand");
        final UiSelector hamburger = new UiSelector().resourceId("com.android.documentsui:id/toolbar").childSelector(new UiSelector().className("android.widget.ImageButton").clickable(true));
        new UiObject(hamburger).click();
    }
    // Wait for the first list item to appear
    new UiObject(rootsList.childSelector(new UiSelector())).waitForExists(mTimeout);
    // Now scroll around to find our item
    new UiScrollable(rootsList).scrollIntoView(new UiSelector().text(label));
    return new UiObject(rootsList.childSelector(new UiSelector().text(label)));
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector) UiScrollable(android.support.test.uiautomator.UiScrollable)

Example 50 with UiObject

use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.

the class DirectoryListBot method assertDocumentsCount.

public void assertDocumentsCount(int count) throws UiObjectNotFoundException {
    UiObject docsList = findDocumentsList();
    assertEquals(count, docsList.getChildCount());
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

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