use of android.support.test.uiautomator.UiObject2 in project android_frameworks_base by crdroidandroid.
the class UiBot method assertWindowTitle.
public void assertWindowTitle(String expected) {
// Turns out the title field on a window does not have
// an id associated with it at runtime (which confuses the hell out of me)
// In code we address this via "android.R.id.title".
UiObject2 o = find(By.text(expected));
// It's a bit of a conceit that we then *assert* that the title
// is the value that we used to identify the UiObject2.
// If the preceeding lookup fails, this'll choke with an NPE.
// But given the issue described in the comment above, we're
// going to do it anyway. Because we shouldn't be looking up
// the uiobject by it's expected content :|
assertEquals(expected, o.getText());
}
use of android.support.test.uiautomator.UiObject2 in project android_frameworks_base by crdroidandroid.
the class UiBot method assertMenuEnabled.
public void assertMenuEnabled(int id, boolean enabled) {
UiObject2 menu = findMenuWithName(mContext.getString(id));
assertNotNull(menu);
assertEquals(enabled, menu.isEnabled());
}
use of android.support.test.uiautomator.UiObject2 in project android_frameworks_base by crdroidandroid.
the class Utils method waitForActivity.
private static UiObject2 waitForActivity(Instrumentation instrumentation, BySelector selector) {
UiDevice device = UiDevice.getInstance(instrumentation);
UiObject2 window = device.wait(Until.findObject(selector), WAIT_FOR_ACTIVITY_TIMEOUT);
if (window == null) {
throw new RuntimeException(selector.toString() + " has not been started.");
}
// Get root object.
while (window.getParent() != null) {
window = window.getParent();
}
return window;
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by LineageOS.
the class WifiTetherSettingsTest method launchWifiTetherActivity.
private void launchWifiTetherActivity() {
mInstrumentation.startActivitySync(mTetherActivityIntent);
onView(withText("Portable Wi‑Fi hotspot")).perform();
UiObject2 item = mDevice.wait(Until.findObject(By.text("Portable Wi‑Fi hotspot")), TIMEOUT);
item.click();
}
use of android.support.test.uiautomator.UiObject2 in project platform_frameworks_base by android.
the class Utils method waitForActivity.
private static UiObject2 waitForActivity(Instrumentation instrumentation, BySelector selector) {
UiDevice device = UiDevice.getInstance(instrumentation);
UiObject2 window = device.wait(Until.findObject(selector), WAIT_FOR_ACTIVITY_TIMEOUT);
if (window == null) {
throw new RuntimeException(selector.toString() + " has not been started.");
}
// Get root object.
while (window.getParent() != null) {
window = window.getParent();
}
return window;
}
Aggregations