Search in sources :

Example 61 with UiSelector

use of android.support.test.uiautomator.UiSelector 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 62 with UiSelector

use of android.support.test.uiautomator.UiSelector 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 63 with UiSelector

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

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 64 with UiSelector

use of android.support.test.uiautomator.UiSelector 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 65 with UiSelector

use of android.support.test.uiautomator.UiSelector 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)

Aggregations

UiSelector (android.support.test.uiautomator.UiSelector)124 UiObject (android.support.test.uiautomator.UiObject)104 Test (org.junit.Test)46 UiScrollable (android.support.test.uiautomator.UiScrollable)28 Intent (android.content.Intent)26 SmallTest (android.support.test.filters.SmallTest)18 KeyguardManager (android.app.KeyguardManager)14 UiObjectNotFoundException (android.support.test.uiautomator.UiObjectNotFoundException)9 UiDevice (android.support.test.uiautomator.UiDevice)4 Context (android.content.Context)2 SmallTest (androidx.test.filters.SmallTest)2 Account (android.accounts.Account)1 AccountManager (android.accounts.AccountManager)1 Activity (android.app.Activity)1 Preference (android.preference.Preference)1 ViewInteraction (android.support.test.espresso.ViewInteraction)1 MediumTest (android.support.test.filters.MediumTest)1 BySelector (android.support.test.uiautomator.BySelector)1 UiCollection (android.support.test.uiautomator.UiCollection)1 UiObject2 (android.support.test.uiautomator.UiObject2)1