Search in sources :

Example 36 with UiObject2

use of android.support.test.uiautomator.UiObject2 in project platform_packages_apps_Settings by BlissRoms.

the class ExternalSourcesSettingsTest method findAndVerifySwitchState.

private UiObject2 findAndVerifySwitchState(boolean checked) {
    final BySelector switchSelector = By.clazz(Switch.class).res("android:id/switch_widget");
    final UiObject2 switchPref = mUiDevice.wait(Until.findObject(switchSelector), START_ACTIVITY_TIMEOUT);
    assertNotNull("Switch not shown", switchPref);
    assertTrue("Switch in invalid state", switchPref.isChecked() == checked);
    return switchPref;
}
Also used : BySelector(android.support.test.uiautomator.BySelector) Switch(android.widget.Switch) UiObject2(android.support.test.uiautomator.UiObject2)

Example 37 with UiObject2

use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.

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();
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2)

Example 38 with UiObject2

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

the class LifecycleEventHandlingTest method launchDashboard_shouldSeeFooter.

@Test
@Presubmit
public void launchDashboard_shouldSeeFooter() {
    new SubSettingLauncher(mContext).setDestination(FeatureFlagsDashboard.class.getName()).setSourceMetricsCategory(Instrumentable.METRICS_CATEGORY_UNKNOWN).addFlags(FLAG_ACTIVITY_NEW_TASK).launch();
    final String footerText = "Experimental";
    // Scroll to bottom
    final UiObject2 view = mDevice.wait(Until.findObject(By.res(mTargetPackage, "main_content")), TIMEOUT);
    view.scroll(Direction.DOWN, 100f);
    assertThat(mDevice.wait(Until.findObject(By.text(footerText)), TIMEOUT)).isNotNull();
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2) Presubmit(android.platform.test.annotations.Presubmit) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 39 with UiObject2

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

the class WifiTetherSettingsTest method launchWifiTetherActivity.

private void launchWifiTetherActivity() {
    mInstrumentation.startActivitySync(mTetherActivityIntent);
    onView(withText("Wi‑Fi hotspot")).perform();
    UiObject2 item = mDevice.wait(Until.findObject(By.text("Wi‑Fi hotspot")), TIMEOUT);
    item.click();
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2)

Example 40 with UiObject2

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

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();
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2)

Aggregations

UiObject2 (android.support.test.uiautomator.UiObject2)133 Test (org.junit.Test)30 BySelector (android.support.test.uiautomator.BySelector)18 MediumTest (android.test.suitebuilder.annotation.MediumTest)16 ListView (android.widget.ListView)8 MediumTest (androidx.test.filters.MediumTest)8 Switch (android.widget.Switch)7 Intent (android.content.Intent)6 RemoteException (android.os.RemoteException)6 LargeTest (android.support.test.filters.LargeTest)6 UiDevice (android.support.test.uiautomator.UiDevice)6 Presubmit (android.platform.test.annotations.Presubmit)4 SdkSuppress (android.support.test.filters.SdkSuppress)4 Activity (android.app.Activity)2 NfcAdapter (android.nfc.NfcAdapter)2 NfcManager (android.nfc.NfcManager)2 Bundle (android.os.Bundle)2 CancellationSignal (android.os.CancellationSignal)2 ParcelFileDescriptor (android.os.ParcelFileDescriptor)2 PrintAttributes (android.print.PrintAttributes)2