use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class MoreWirelessSettingsTests method testVPNMenuLoad.
@MediumTest
public void testVPNMenuLoad() throws Exception {
SettingsHelper.launchSettingsPage(getInstrumentation().getContext(), Settings.ACTION_WIRELESS_SETTINGS);
mDevice.wait(Until.findObject(By.text("VPN")), TIMEOUT).click();
Thread.sleep(TIMEOUT);
UiObject2 usbTethering = mDevice.wait(Until.findObject(By.res(SETTINGS_PACKAGE, "vpn_create")), TIMEOUT);
assertNotNull("VPN screen did not load correctly", usbTethering);
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class ZonePickerSettingsTest method testSelectTimeZone.
private void testSelectTimeZone(String region, String timezone, String expectedTimeZoneOffset, String expectedTimeZoneId, boolean assumeOneTimeZoneInRegion) throws Exception {
mHelper.setIntSetting(SettingsType.GLOBAL, Settings.Global.AUTO_TIME_ZONE, 0);
SettingsHelper.launchSettingsPage(InstrumentationRegistry.getContext(), Settings.ACTION_DATE_SETTINGS);
UiObject2 selectTimeZone = wait(SELECTOR_SELECT_TIME_ZONE);
assertTrue(selectTimeZone.isEnabled());
selectTimeZone.click();
wait(By.text("Region")).click();
// Speed-up the test by searching with the first 2 characters of the region name
wait(By.res("android", "search_src_text")).setText(region.substring(0, 2));
// Select region in the list
selectItemInList(new UiSelector().textContains(region)).click();
// Only select time zone explicitly if there are more than one time zones in a region
if (!assumeOneTimeZoneInRegion) {
wait(By.text("Time zone"));
selectItemInList(new UiSelector().textContains(timezone)).click();
}
mDevice.pressBack();
// The select button should include the GMT offset in the summary
BySelector summarySelector = By.res("android:id/summary");
UiObject2 selectedTimeZone = selectTimeZone.findObject(summarySelector);
assertUiObjectFound(selectedTimeZone, summarySelector);
assertTrue("Expect " + expectedTimeZoneOffset + " is shown for " + timezone, selectedTimeZone.getText().startsWith(expectedTimeZoneOffset));
waitAndAssertTimeGetDefault(expectedTimeZoneId);
assertEquals("Time zone change in Settings should update persist.sys.timezone", expectedTimeZoneId, SystemProperties.get("persist.sys.timezone"));
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class ZonePickerSettingsTest method zonePickerDisabled.
@Test
public void zonePickerDisabled() throws Exception {
mHelper.setIntSetting(SettingsType.GLOBAL, Settings.Global.AUTO_TIME_ZONE, 1);
SettingsHelper.launchSettingsPage(InstrumentationRegistry.getContext(), Settings.ACTION_DATE_SETTINGS);
UiObject2 selectTimeZone = wait(SELECTOR_SELECT_TIME_ZONE);
assertFalse(selectTimeZone.isEnabled());
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class ZonePickerSettingsTest method wait.
/**
* @throws UiObjectNotFoundException if UiDevice.wait returns null
*/
private UiObject2 wait(BySelector selector) throws UiObjectNotFoundException {
UiObject2 item = mDevice.wait(Until.findObject(selector), TIMEOUT);
assertUiObjectFound(item, selector);
return item;
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class SpellCheckerSettingsUITest method launchSettings_hasSwitchBar.
@Test
public void launchSettings_hasSwitchBar() {
mInstrumentation.getContext().startActivity(mIntent);
final UiObject2 switchBar = mUiDevice.wait(Until.findObject(By.text("Use spell checker")), TIMEOUT);
assertThat(switchBar).isNotNull();
}
Aggregations