use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by DirtyUnicorns.
the class TestUtils method setEditTextWithValue.
/**
* Find {@link android.widget.EditText} with {@code res} and set its {@code value}
*/
public static void setEditTextWithValue(UiDevice uiDevice, String res, long value) {
final UiObject2 editText = uiDevice.findObject(By.res(res));
assertWithMessage("Cannot find editText with res: " + res).that(editText).isNotNull();
editText.setText(String.valueOf(value));
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by DirtyUnicorns.
the class TestUtils method clickButton.
/**
* Find {@link android.widget.Button} with {@code res} and click it
*/
public static void clickButton(UiDevice uiDevice, String res) {
final UiObject2 button = uiDevice.findObject(By.res(res));
assertWithMessage("Cannot find button with res: " + res).that(button).isNotNull();
button.click();
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by DirtyUnicorns.
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 android_packages_apps_Settings by crdroidandroid.
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 android-testing-templates by googlesamples.
the class UiAutomatorTest method findViewPerformActionAndCheckAssertion.
@Test
public void findViewPerformActionAndCheckAssertion() {
// Click on Button with content description
final String btnContentDescription = InstrumentationRegistry.getTargetContext().getString(R.string.content_desc_hello_android_testing);
mDevice.findObject(By.desc(btnContentDescription)).click();
// Verify that correct text is displayed
final String textViewResId = "text_view_rocks";
UiObject2 androidRocksTextView = mDevice.wait(Until.findObject(By.res(TARGET_PACKAGE, textViewResId)), 500);
assertThat(androidRocksTextView, notNullValue());
final String androidTestingRocksText = InstrumentationRegistry.getTargetContext().getString(R.string.android_testing_rocks);
assertThat(androidRocksTextView.getText(), is(equalTo(androidTestingRocksText)));
}
Aggregations