Search in sources :

Example 91 with UiObject

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

the class FilesActivityUiTest method testDownload_RetryUnsuccessful.

@Suppress
public void testDownload_RetryUnsuccessful() throws Exception {
    DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
    // This downloads fails! But it'll still show up.
    dm.enqueue(new Request(Uri.parse("http://www.google.com/hamfancy")));
    bots.roots.openRoot("Downloads");
    UiObject doc = bots.directory.findDocument("Unsuccessful");
    doc.waitForExists(TIMEOUT);
    int toolType = Configurator.getInstance().getToolType();
    Configurator.getInstance().setToolType(MotionEvent.TOOL_TYPE_FINGER);
    doc.click();
    Configurator.getInstance().setToolType(toolType);
    assertTrue(bots.main.findDownloadRetryDialog().exists());
    // to clear the dialog.
    device.pressBack();
}
Also used : UiObject(android.support.test.uiautomator.UiObject) Request(android.app.DownloadManager.Request) DownloadManager(android.app.DownloadManager) Suppress(android.test.suitebuilder.annotation.Suppress)

Example 92 with UiObject

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

the class UiBot method openSearchView.

public void openSearchView() throws UiObjectNotFoundException {
    UiObject searchView = findSearchView();
    searchView.click();
    assertTrue(searchView.exists());
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 93 with UiObject

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

the class UiBot method findDownloadRetryDialog.

public UiObject findDownloadRetryDialog() {
    UiSelector selector = new UiSelector().text("Couldn't download");
    UiObject title = mDevice.findObject(selector);
    title.waitForExists(mTimeout);
    return title;
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector)

Example 94 with UiObject

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

the class UiBot method assertInActionMode.

public void assertInActionMode(boolean inActionMode) {
    UiObject actionModeBar = findActionModeBar();
    assertEquals(inActionMode, actionModeBar.exists());
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 95 with UiObject

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

the class UiBot method findDialogCancelButton.

public UiObject findDialogCancelButton() {
    UiObject object = findObject("android:id/content", "android:id/button2");
    object.waitForExists(mTimeout);
    return object;
}
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