Search in sources :

Example 16 with BySelector

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

the class MoreWirelessSettingsTest2 method testCaCertSettings.

@Suppress
@MediumTest
public void testCaCertSettings() throws Exception {
    loadAddNetworkMenu();
    selectSecurityOption(SECURITY_OPTION_EAP_TEXT);
    BySelector caCertSettingsBySelector = By.res(SETTINGS_PACKAGE, ADD_NETWORK_MENU_CACERT_RES_ID).clazz(SPINNER_CLASS);
    findOrScrollToObject(ADD_NETWORK_MENU_SCROLLABLE_BY_SELECTOR, caCertSettingsBySelector);
    assertEquals(CACERT_MENU_PLEASE_SELECT_TEXT, mDevice.wait(Until.findObject(caCertSettingsBySelector), TIMEOUT).getChildren().get(0).getText());
    mDevice.wait(Until.findObject(caCertSettingsBySelector), TIMEOUT).click();
    Thread.sleep(SLEEP_TIME);
    // Verify CA certificate spinner options.
    assertNotNull(mDevice.wait(Until.findObject(By.text(CACERT_MENU_PLEASE_SELECT_TEXT)), TIMEOUT));
    assertNotNull(mDevice.wait(Until.findObject(By.text(CACERT_MENU_USE_SYSTEM_CERTS_TEXT)), TIMEOUT));
    assertNotNull(mDevice.wait(Until.findObject(By.text(CACERT_MENU_DO_NOT_VALIDATE_TEXT)), TIMEOUT));
    // Verify that a domain field and warning appear when the user selects the
    // "Use system certificates" option.
    mDevice.wait(Until.findObject(By.text(CACERT_MENU_USE_SYSTEM_CERTS_TEXT)), TIMEOUT).click();
    findOrScrollToObject(ADD_NETWORK_MENU_SCROLLABLE_BY_SELECTOR, By.res(SETTINGS_PACKAGE, ADD_NETWORK_MENU_DOMAIN_LAYOUT_RES_ID));
    findOrScrollToObject(ADD_NETWORK_MENU_SCROLLABLE_BY_SELECTOR, By.res(SETTINGS_PACKAGE, ADD_NETWORK_MENU_NO_DOMAIN_WARNING_RES_ID));
    // Verify that a warning appears when the user chooses the "Do Not Validate" option.
    mDevice.wait(Until.findObject(caCertSettingsBySelector), TIMEOUT).click();
    mDevice.wait(Until.findObject(By.text(CACERT_MENU_DO_NOT_VALIDATE_TEXT)), TIMEOUT).click();
    findOrScrollToObject(ADD_NETWORK_MENU_SCROLLABLE_BY_SELECTOR, By.res(SETTINGS_PACKAGE, ADD_NETWORK_MENU_NO_CACERT_WARNING_RES_ID));
}
Also used : BySelector(android.support.test.uiautomator.BySelector) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 17 with BySelector

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

the class NotificationSettingsTests method testNotificationsSettingsListForPhone.

@MediumTest
public void testNotificationsSettingsListForPhone() {
    UiObject2 configureNotifications = mDevice.wait(Until.findObject(By.text("Notifications")), TIMEOUT);
    configureNotifications.click();
    mDevice.wait(Until.findObject(By.text("Blink light")), TIMEOUT);
    UiObject2 appNotifications = mDevice.wait(Until.findObject(By.text("On for all apps")), TIMEOUT);
    appNotifications.click();
    UiObject2 view = mDevice.wait(Until.findObject(By.text("All apps")), TIMEOUT);
    assertNotNull("Could not find Settings > Apps screen", view);
    final BySelector preferenceListSelector = By.clazz(ListView.class).res("android:id/list");
    UiObject2 apps = mDevice.wait(Until.findObject(preferenceListSelector), TIMEOUT);
    UiObject2 phone = scrollTo(mDevice, apps, By.text("Phone"), Direction.DOWN);
    assertNotNull("Could not find Phone notification settings", phone);
    phone.click();
    UiObject2 incomingCalls = mDevice.wait(Until.findObject(By.text("Incoming calls")), TIMEOUT);
    assertNotNull("Could not find incoming calls channel", incomingCalls);
    incomingCalls.click();
    // here's the meat of this test: make sure that you cannot change
    // most settings for this channel
    UiObject2 importance = mDevice.wait(Until.findObject(By.text("Importance")), TIMEOUT);
    assertNotNull("Could not find importance toggle", importance);
    assertFalse(importance.isEnabled());
    assertFalse(mDevice.wait(Until.findObject(By.text("Sound")), TIMEOUT).isEnabled());
    ;
    assertFalse(mDevice.wait(Until.findObject(By.text("Vibrate")), TIMEOUT).isEnabled());
    assertFalse(mDevice.wait(Until.findObject(By.text("Override Do Not Disturb")), TIMEOUT).isEnabled());
}
Also used : BySelector(android.support.test.uiautomator.BySelector) ListView(android.widget.ListView) UiObject2(android.support.test.uiautomator.UiObject2) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 18 with BySelector

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

the class MoreWirelessSettingsTest2 method testPhase2Settings.

@Suppress
@MediumTest
public void testPhase2Settings() throws Exception {
    loadAddNetworkMenu();
    selectSecurityOption(SECURITY_OPTION_EAP_TEXT);
    BySelector phase2SettingsBySelector = By.res(SETTINGS_PACKAGE, ADD_NETWORK_MENU_PHASE2_RES_ID).clazz(SPINNER_CLASS);
    findOrScrollToObject(ADD_NETWORK_MENU_SCROLLABLE_BY_SELECTOR, phase2SettingsBySelector);
    assertEquals(PHASE2_MENU_NONE_TEXT, mDevice.wait(Until.findObject(phase2SettingsBySelector), TIMEOUT).getChildren().get(0).getText());
    mDevice.wait(Until.findObject(phase2SettingsBySelector), TIMEOUT).click();
    Thread.sleep(SLEEP_TIME);
    // Verify Phase 2 authentication spinner options.
    assertNotNull(mDevice.wait(Until.findObject(By.text(PHASE2_MENU_NONE_TEXT)), TIMEOUT));
    assertNotNull(mDevice.wait(Until.findObject(By.text(PHASE2_MENU_MSCHAPV2_TEXT)), TIMEOUT));
    assertNotNull(mDevice.wait(Until.findObject(By.text(PHASE2_MENU_GTC_TEXT)), TIMEOUT));
}
Also used : BySelector(android.support.test.uiautomator.BySelector) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 19 with BySelector

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

the class MoreWirelessSettingsTest2 method testCaCertSettings.

@Suppress
@MediumTest
public void testCaCertSettings() throws Exception {
    loadAddNetworkMenu();
    selectSecurityOption(SECURITY_OPTION_EAP_TEXT);
    BySelector caCertSettingsBySelector = By.res(SETTINGS_PACKAGE, ADD_NETWORK_MENU_CACERT_RES_ID).clazz(SPINNER_CLASS);
    findOrScrollToObject(ADD_NETWORK_MENU_SCROLLABLE_BY_SELECTOR, caCertSettingsBySelector);
    assertEquals(CACERT_MENU_PLEASE_SELECT_TEXT, mDevice.wait(Until.findObject(caCertSettingsBySelector), TIMEOUT).getChildren().get(0).getText());
    mDevice.wait(Until.findObject(caCertSettingsBySelector), TIMEOUT).click();
    Thread.sleep(SLEEP_TIME);
    // Verify CA certificate spinner options.
    assertNotNull(mDevice.wait(Until.findObject(By.text(CACERT_MENU_PLEASE_SELECT_TEXT)), TIMEOUT));
    assertNotNull(mDevice.wait(Until.findObject(By.text(CACERT_MENU_USE_SYSTEM_CERTS_TEXT)), TIMEOUT));
    assertNotNull(mDevice.wait(Until.findObject(By.text(CACERT_MENU_DO_NOT_VALIDATE_TEXT)), TIMEOUT));
    // Verify that a domain field and warning appear when the user selects the
    // "Use system certificates" option.
    mDevice.wait(Until.findObject(By.text(CACERT_MENU_USE_SYSTEM_CERTS_TEXT)), TIMEOUT).click();
    findOrScrollToObject(ADD_NETWORK_MENU_SCROLLABLE_BY_SELECTOR, By.res(SETTINGS_PACKAGE, ADD_NETWORK_MENU_DOMAIN_LAYOUT_RES_ID));
    findOrScrollToObject(ADD_NETWORK_MENU_SCROLLABLE_BY_SELECTOR, By.res(SETTINGS_PACKAGE, ADD_NETWORK_MENU_NO_DOMAIN_WARNING_RES_ID));
    // Verify that a warning appears when the user chooses the "Do Not Validate" option.
    mDevice.wait(Until.findObject(caCertSettingsBySelector), TIMEOUT).click();
    mDevice.wait(Until.findObject(By.text(CACERT_MENU_DO_NOT_VALIDATE_TEXT)), TIMEOUT).click();
    findOrScrollToObject(ADD_NETWORK_MENU_SCROLLABLE_BY_SELECTOR, By.res(SETTINGS_PACKAGE, ADD_NETWORK_MENU_NO_CACERT_WARNING_RES_ID));
}
Also used : BySelector(android.support.test.uiautomator.BySelector) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 20 with BySelector

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

the class NotificationSettingsTests method testNotificationsSettingsListForPhone.

@MediumTest
public void testNotificationsSettingsListForPhone() {
    UiObject2 configureNotifications = mDevice.wait(Until.findObject(By.text("Notifications")), TIMEOUT);
    configureNotifications.click();
    mDevice.wait(Until.findObject(By.text("Blink light")), TIMEOUT);
    UiObject2 appNotifications = mDevice.wait(Until.findObject(By.text("On for all apps")), TIMEOUT);
    appNotifications.click();
    UiObject2 view = mDevice.wait(Until.findObject(By.text("All apps")), TIMEOUT);
    assertNotNull("Could not find Settings > Apps screen", view);
    final BySelector preferenceListSelector = By.clazz(ListView.class).res("android:id/list");
    UiObject2 apps = mDevice.wait(Until.findObject(preferenceListSelector), TIMEOUT);
    UiObject2 phone = scrollTo(mDevice, apps, By.text("Phone"), Direction.DOWN);
    assertNotNull("Could not find Phone notification settings", phone);
    phone.click();
    UiObject2 incomingCalls = mDevice.wait(Until.findObject(By.text("Incoming calls")), TIMEOUT);
    assertNotNull("Could not find incoming calls channel", incomingCalls);
    incomingCalls.click();
    // here's the meat of this test: make sure that you cannot change
    // most settings for this channel
    UiObject2 importance = mDevice.wait(Until.findObject(By.text("Importance")), TIMEOUT);
    assertNotNull("Could not find importance toggle", importance);
    assertFalse(importance.isEnabled());
    assertFalse(mDevice.wait(Until.findObject(By.text("Sound")), TIMEOUT).isEnabled());
    ;
    assertFalse(mDevice.wait(Until.findObject(By.text("Vibrate")), TIMEOUT).isEnabled());
    assertFalse(mDevice.wait(Until.findObject(By.text("Override Do Not Disturb")), TIMEOUT).isEnabled());
}
Also used : BySelector(android.support.test.uiautomator.BySelector) ListView(android.widget.ListView) UiObject2(android.support.test.uiautomator.UiObject2) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

BySelector (android.support.test.uiautomator.BySelector)37 UiObject2 (android.support.test.uiautomator.UiObject2)18 MediumTest (android.test.suitebuilder.annotation.MediumTest)10 Suppress (android.test.suitebuilder.annotation.Suppress)8 ListView (android.widget.ListView)8 Test (org.junit.Test)8 Switch (android.widget.Switch)7 LargeTest (android.support.test.filters.LargeTest)6 UiSelector (android.support.test.uiautomator.UiSelector)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)1