Search in sources :

Example 26 with UiSelector

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

the class UiBot method clickJustOnce.

private void clickJustOnce() {
    boolean gotIt = mDevice.wait(Until.hasObject(By.res("android", "button_once")), mTimeout);
    assertTrue("'Just Once' button not visible yet", gotIt);
    UiObject justOnce = mDevice.findObject(new UiSelector().resourceId("android:id/button_once"));
    assertTrue("'Just Once' button not found", justOnce.exists());
    click(justOnce, "Just Once");
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector)

Example 27 with UiSelector

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

the class UiBot method getVisibleObjectById.

/**
     * Gets an object which is guaranteed to be present in the current UI.
     *
     * @param text Object's text as displayed by the UI.
     */
public UiObject getVisibleObjectById(String id) {
    UiObject uiObject = mDevice.findObject(new UiSelector().resourceId(id));
    assertTrue("could not find object with id '" + id + "'", uiObject.exists());
    return uiObject;
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector)

Example 28 with UiSelector

use of android.support.test.uiautomator.UiSelector in project android_packages_apps_Settings by LineageOS.

the class DefaultAppSettingsTest method launchDefaultApps.

private void launchDefaultApps() throws Exception {
    final Intent settingsIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setPackage(mTargetPackage).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getInstrumentation().getContext().startActivity(settingsIntent);
    final String titleApps = mTargetContext.getResources().getString(R.string.app_and_notification_dashboard_title);
    mDevice.findObject(new UiSelector().text(titleApps)).click();
    final String titleDefaultApps = mTargetContext.getResources().getString(R.string.app_default_dashboard_title);
    mDevice.findObject(new UiSelector().text(titleDefaultApps)).click();
}
Also used : UiSelector(android.support.test.uiautomator.UiSelector) Intent(android.content.Intent)

Example 29 with UiSelector

use of android.support.test.uiautomator.UiSelector in project android_packages_apps_Settings by LineageOS.

the class UserSettingsTest method testAddUsersWhenLockedNotExists.

@Test
public void testAddUsersWhenLockedNotExists() throws Exception {
    launchUserSettings();
    UiObject addUsersPreference = mDevice.findObject(new UiSelector().text(ADD_USERS_WHEN_LOCKED));
    assertFalse(addUsersPreference.exists());
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector) SmallTest(android.support.test.filters.SmallTest) Test(org.junit.Test)

Example 30 with UiSelector

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

the class DefaultAppSettingsTest method launchDefaultApps.

private void launchDefaultApps() throws Exception {
    final Intent settingsIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setPackage(mTargetPackage).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getInstrumentation().getContext().startActivity(settingsIntent);
    final String titleApps = mTargetContext.getResources().getString(R.string.app_and_notification_dashboard_title);
    mDevice.findObject(new UiSelector().text(titleApps)).click();
    final String titleDefaultApps = mTargetContext.getResources().getString(R.string.app_default_dashboard_title);
    mDevice.findObject(new UiSelector().text(titleDefaultApps)).click();
}
Also used : UiSelector(android.support.test.uiautomator.UiSelector) Intent(android.content.Intent)

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