use of android.support.test.uiautomator.UiObject2 in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppsSettingsRetainFilterTests method testDisablingSystemAppAndRotateDevice.
@Test
public void testDisablingSystemAppAndRotateDevice() throws Exception {
launchAppsSettings();
UiObject2 calculator = mDevice.wait(Until.findObject(By.text("Calculator")), TIMEOUT);
assertThat(calculator).isNotNull();
calculator.click();
mDevice.waitForIdle(TIMEOUT);
UiObject2 disableButton = mDevice.wait(Until.findObject(By.text("DISABLE")), TIMEOUT);
assertThat(disableButton).isNotNull();
disableButton.click();
mDevice.waitForIdle(TIMEOUT);
// Click on "Disable App" on dialog.
UiObject2 dialogDisableButton = mDevice.wait(Until.findObject(By.text("DISABLE APP")), TIMEOUT);
assertThat(dialogDisableButton).isNotNull();
dialogDisableButton.click();
mDevice.waitForIdle(TIMEOUT);
UiObject2 enableButton = mDevice.wait(Until.findObject(By.text("ENABLE")), TIMEOUT);
assertThat(enableButton).isNotNull();
mDevice.pressBack();
mDevice.waitForIdle(TIMEOUT);
UiObject2 spinnerHeader = mDevice.wait(Until.findObject(By.text("All apps")), TIMEOUT);
assertThat(spinnerHeader).isNotNull();
spinnerHeader.click();
UiObject2 optionDisabledApps = mDevice.wait(Until.findObject(By.text("Disabled apps")), TIMEOUT);
assertThat(optionDisabledApps).isNotNull();
optionDisabledApps.click();
mDevice.waitForIdle(TIMEOUT);
try {
mDevice.setOrientationLeft();
mDevice.waitForIdle(TIMEOUT);
} catch (RemoteException e) {
throw new RuntimeException("Failed to freeze device orientation", e);
}
try {
mDevice.unfreezeRotation();
mDevice.waitForIdle(TIMEOUT);
} catch (RemoteException e) {
throw new RuntimeException("Failed to un-freeze device orientation", e);
}
UiObject2 spinnerDisabledApps = mDevice.wait(Until.findObject(By.text("Disabled apps")), TIMEOUT);
assertThat(spinnerDisabledApps).isNotNull();
}
use of android.support.test.uiautomator.UiObject2 in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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();
}
use of android.support.test.uiautomator.UiObject2 in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppOpsSettingsTest 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;
}
use of android.support.test.uiautomator.UiObject2 in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HomepageDisplayTests method testHomepageCategory.
@Presubmit
@Test
public void testHomepageCategory() throws Exception {
// Launch Settings
SettingsHelper.launchSettingsPage(InstrumentationRegistry.getContext(), Settings.ACTION_SETTINGS);
// Scroll to top
final UiObject2 view = mDevice.wait(Until.findObject(By.res(SETTINGS_PACKAGE, "main_content")), TIMEOUT);
view.scroll(Direction.UP, 100f);
// Inspect each item
for (String item : HOMEPAGE_ITEMS) {
SettingsTestUtils.assertTitleMatch(mDevice, item);
}
}
use of android.support.test.uiautomator.UiObject2 in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MoreWirelessSettingsTest2 method testWifiMenuLoadConfigure.
@MediumTest
public void testWifiMenuLoadConfigure() throws Exception {
loadWiFiConfigureMenu();
Thread.sleep(SLEEP_TIME);
UiObject2 configureWiFiHeading = mDevice.wait(Until.findObject(By.text(CONFIGURE_WIFI_PREFERENCE_TEXT)), TIMEOUT);
assertNotNull("Configure WiFi menu has not loaded correctly", configureWiFiHeading);
}
Aggregations