Search in sources :

Example 1 with UiSelector

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

the class GestureSettingsTest method getDozeSwitch.

private UiObject getDozeSwitch() throws Exception {
    UiScrollable settings = navigateToAmbientDisplay();
    UiObject dozeSwitch = null;
    UiSelector relativeLayoutSelector = new UiSelector().className(RelativeLayout.class.getName());
    String titleDoze = mTargetContext.getResources().getString(R.string.doze_title);
    for (int i = 0; i <= settings.getChildCount(relativeLayoutSelector); i++) {
        UiObject relativeLayout = settings.getChild(relativeLayoutSelector.instance(i));
        if (relativeLayout.getChildCount() != 2) {
            continue;
        }
        UiObject obj1 = relativeLayout.getChild(new UiSelector().index(0));
        if (obj1.getText() == titleDoze) {
            return relativeLayout.getFromParent(new UiSelector().className(Switch.class.getName()));
        }
    }
    return null;
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector) RelativeLayout(android.widget.RelativeLayout) UiScrollable(android.support.test.uiautomator.UiScrollable)

Example 2 with UiSelector

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

the class GestureSettingsTest method navigateToAmbientDisplay.

private UiScrollable navigateToAmbientDisplay() throws Exception {
    UiScrollable settings = new UiScrollable(new UiSelector().packageName(mTargetPackage).scrollable(true));
    String titleDisplay = mTargetContext.getResources().getString(R.string.display_settings_title);
    settings.scrollTextIntoView(titleDisplay);
    mDevice.findObject(new UiSelector().text(titleDisplay)).click();
    settings.scrollTextIntoView(mTargetContext.getResources().getString(R.string.doze_title));
    return settings;
}
Also used : UiSelector(android.support.test.uiautomator.UiSelector) UiScrollable(android.support.test.uiautomator.UiScrollable)

Example 3 with UiSelector

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

the class GestureSettingsTest method testGestureSettingsExists.

@Test
public void testGestureSettingsExists() throws Exception {
    launchMoves();
    UiObject titleObj = mDevice.findObject(new UiSelector().text(mTargetContext.getResources().getString(R.string.gesture_preference_title)));
    assertNotNull(titleObj);
    assertTrue(titleObj.exists());
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test)

Example 4 with UiSelector

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

the class GestureSettingsTest method navigateToMovesSetting.

private void navigateToMovesSetting(String title) throws Exception {
    launchMoves();
    UiScrollable moves = new UiScrollable(new UiSelector().packageName(mTargetPackage).scrollable(true));
    moves.scrollTextIntoView(title);
}
Also used : UiSelector(android.support.test.uiautomator.UiSelector) UiScrollable(android.support.test.uiautomator.UiScrollable)

Example 5 with UiSelector

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

the class UiBot method findDownloadRetryDialog.

public UiObject findDownloadRetryDialog() {
    UiSelector selector = new UiSelector().text("Couldn't download");
    UiObject title = mDevice.findObject(selector);
    title.waitForExists(mTimeout);
    return title;
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector)

Aggregations

UiSelector (android.support.test.uiautomator.UiSelector)124 UiObject (android.support.test.uiautomator.UiObject)104 Test (org.junit.Test)46 UiScrollable (android.support.test.uiautomator.UiScrollable)28 Intent (android.content.Intent)26 SmallTest (android.support.test.filters.SmallTest)18 KeyguardManager (android.app.KeyguardManager)14 UiObjectNotFoundException (android.support.test.uiautomator.UiObjectNotFoundException)9 UiDevice (android.support.test.uiautomator.UiDevice)4 Context (android.content.Context)2 SmallTest (androidx.test.filters.SmallTest)2 Account (android.accounts.Account)1 AccountManager (android.accounts.AccountManager)1 Activity (android.app.Activity)1 Preference (android.preference.Preference)1 ViewInteraction (android.support.test.espresso.ViewInteraction)1 MediumTest (android.support.test.filters.MediumTest)1 BySelector (android.support.test.uiautomator.BySelector)1 UiCollection (android.support.test.uiautomator.UiCollection)1 UiObject2 (android.support.test.uiautomator.UiObject2)1