Search in sources :

Example 6 with UiObject2

use of android.support.test.uiautomator.UiObject2 in project android_frameworks_base by ResurrectionRemix.

the class UiBot method findMenuWithName.

UiObject2 findMenuWithName(String label) {
    List<UiObject2> menuItems = mDevice.findObjects(By.clazz("android.widget.LinearLayout"));
    Iterator<UiObject2> it = menuItems.iterator();
    UiObject2 menuItem = null;
    while (it.hasNext()) {
        menuItem = it.next();
        UiObject2 text = menuItem.findObject(By.text(label));
        if (text != null) {
            break;
        }
    }
    return menuItem;
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2)

Example 7 with UiObject2

use of android.support.test.uiautomator.UiObject2 in project android_frameworks_base by ResurrectionRemix.

the class UiBot method assertMenuEnabled.

public void assertMenuEnabled(int id, boolean enabled) {
    UiObject2 menu = findMenuWithName(mContext.getString(id));
    assertNotNull(menu);
    assertEquals(enabled, menu.isEnabled());
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2)

Example 8 with UiObject2

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

the class BaseBot method assertHasFocus.

/**
     * Asserts that the specified view or one of its descendents has focus.
     */
protected void assertHasFocus(String resourceName) {
    UiObject2 candidate = mDevice.findObject(By.res(resourceName));
    assertNotNull("Expected " + resourceName + " to have focus, but it didn't.", candidate.findObject(By.focused(true)));
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2)

Example 9 with UiObject2

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

the class UiBot method findMenuWithName.

UiObject2 findMenuWithName(String label) {
    List<UiObject2> menuItems = mDevice.findObjects(By.clazz("android.widget.LinearLayout"));
    Iterator<UiObject2> it = menuItems.iterator();
    UiObject2 menuItem = null;
    while (it.hasNext()) {
        menuItem = it.next();
        UiObject2 text = menuItem.findObject(By.text(label));
        if (text != null) {
            break;
        }
    }
    return menuItem;
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2)

Example 10 with UiObject2

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

the class UiBot method assertMenuEnabled.

public void assertMenuEnabled(int id, boolean enabled) {
    UiObject2 menu = findMenuWithName(mContext.getString(id));
    assertNotNull(menu);
    assertEquals(enabled, menu.isEnabled());
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2)

Aggregations

UiObject2 (android.support.test.uiautomator.UiObject2)29 Test (org.junit.Test)5 UiDevice (android.support.test.uiautomator.UiDevice)4 SdkSuppress (android.support.test.filters.SdkSuppress)2 LargeTest (android.test.suitebuilder.annotation.LargeTest)1