Search in sources :

Example 71 with UiObject

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

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 72 with UiObject

use of android.support.test.uiautomator.UiObject in project cw-omnibus by commonsguy.

the class ListTests method openActivity.

private void openActivity() throws UiObjectNotFoundException {
    device.pressHome();
    UiObject allAppsButton = device.findObject(new UiSelector().description("Apps"));
    allAppsButton.clickAndWaitForNewWindow();
    UiObject appsTab = device.findObject(new UiSelector().text("Apps"));
    appsTab.click();
    UiScrollable appViews = new UiScrollable(new UiSelector().scrollable(true));
    appViews.setAsHorizontalList();
    UiObject ourApp = appViews.getChildByText(new UiSelector().className("android.widget.TextView"), "Action Bar Fragment Demo");
    ourApp.clickAndWaitForNewWindow();
    UiObject appValidation = device.findObject(new UiSelector().packageName("com.commonsware.android.abf"));
    Assert.assertTrue("Could not open test app", appValidation.exists());
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector) UiScrollable(android.support.test.uiautomator.UiScrollable)

Example 73 with UiObject

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

the class InitialTest method clickByDescription.

/**
     * Helper to click on objects that match the content-description text
     *
     * @param text
     * @throws UiObjectNotFoundException
     */
private void clickByDescription(String text) throws UiObjectNotFoundException {
    UiObject obj = new UiObject(new UiSelector().description(text));
    obj.clickAndWaitForNewWindow();
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector)

Example 74 with UiObject

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

the class InitialTest method clickByText.

/**
     * Helper to click on object that match the text value
     *
     * @param text
     * @throws UiObjectNotFoundException
     */
private void clickByText(String text) throws UiObjectNotFoundException {
    UiObject obj = new UiObject(new UiSelector().text(text));
    obj.clickAndWaitForNewWindow();
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector)

Example 75 with UiObject

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

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)

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