use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class NotificationSettingsTests method launchAppsSettings.
private void launchAppsSettings() throws Exception {
Intent appsSettingsIntent = new Intent(Settings.ACTION_SETTINGS);
mActivityHelper.launchIntent(appsSettingsIntent);
mSettingsHelper.flingSettingsToStart();
UiObject2 view = mDevice.wait(Until.findObject(By.text("Apps & notifications")), TIMEOUT);
view.click();
UiObject2 title = mDevice.wait(Until.findObject(By.text("Apps & notifications")), TIMEOUT);
assertNotNull("Could not find Settings > Apps & notifications screen", title);
}
use of android.support.test.uiautomator.UiObject2 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());
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class SoundSettingsTest method findRingtoneInList.
private UiObject2 findRingtoneInList(String ringtone) throws Exception {
mHelper.scrollVert(false);
SystemClock.sleep(1000);
UiObject2 ringToneObject = mDevice.wait(Until.findObject(By.text(ringtone)), TIMEOUT);
int count = 0;
while (ringToneObject == null && count < 5) {
mHelper.scrollVert(true);
SystemClock.sleep(1000);
ringToneObject = mDevice.wait(Until.findObject(By.text(ringtone)), TIMEOUT);
count++;
}
return ringToneObject;
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class SoundSettingsTest method clickMore.
private void clickMore() throws InterruptedException {
UiObject2 more = mDevice.wait(Until.findObject(By.text("Advanced")), TIMEOUT);
if (more != null) {
more.click();
Thread.sleep(TIMEOUT);
}
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class LocationSettingsTests method dismissAlertDialogs.
// This method dismisses both alert dialogs that might popup and
// interfere with the test. Since the order in which the dialog
// shows up changes in no specific known way, we're checking for
// both dialogs in any order for a robust test. Bug b/36233151
// filed against Location team for specifications. This is a
// workaround in the meantime to ensure coverage.
private void dismissAlertDialogs() throws Exception {
for (int count = 0; count < 2; count++) {
UiObject2 agreeDialog = mDevice.wait(Until.findObject(By.text("Improve location accuracy?")), TIMEOUT);
UiObject2 previousChoiceYesButton = mDevice.wait(Until.findObject(By.text("YES")), TIMEOUT);
if (agreeDialog != null) {
mDevice.wait(Until.findObject(By.text("AGREE")), TIMEOUT).click();
Thread.sleep(TIMEOUT);
assertNull("Improve location dialog not dismissed", mDevice.wait(Until.findObject(By.text("Improve location accuracy?")), TIMEOUT));
}
if (previousChoiceYesButton != null) {
previousChoiceYesButton.click();
// Short sleep to wait for the new screen
Thread.sleep(TIMEOUT);
}
}
}
Aggregations