use of android.support.test.uiautomator.UiObject in project android_frameworks_base by DirtyUnicorns.
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)));
}
use of android.support.test.uiautomator.UiObject in project android_frameworks_base by DirtyUnicorns.
the class UiBot method setSearchQuery.
public void setSearchQuery(String query) throws UiObjectNotFoundException {
UiObject searchView = findSearchView();
assertTrue(searchView.exists());
UiObject searchTextField = findSearchViewTextField();
searchTextField.setText(query);
assertSearchTextField(true, query);
}
use of android.support.test.uiautomator.UiObject in project android_frameworks_base by DirtyUnicorns.
the class UiBot method findDialogOkButton.
public UiObject findDialogOkButton() {
UiObject object = findObject("android:id/content", "android:id/button1");
object.waitForExists(mTimeout);
return object;
}
use of android.support.test.uiautomator.UiObject in project android_frameworks_base by DirtyUnicorns.
the class UiBot method openOverflowMenu.
public UiObject openOverflowMenu() throws UiObjectNotFoundException {
UiObject obj = findMenuMoreOptions();
obj.click();
mDevice.waitForIdle(mTimeout);
return obj;
}
use of android.support.test.uiautomator.UiObject in project android_frameworks_base by DirtyUnicorns.
the class UiBot method assertSearchTextField.
public void assertSearchTextField(boolean isFocused, String query) throws UiObjectNotFoundException {
UiObject textField = findSearchViewTextField();
UiObject searchIcon = findSearchViewIcon();
assertFalse(searchIcon.exists());
assertTrue(textField.exists());
assertEquals(isFocused, textField.isFocused());
if (query != null) {
assertEquals(query, textField.getText());
}
}
Aggregations