Search in sources :

Example 51 with UiObject2

use of android.support.test.uiautomator.UiObject2 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 52 with UiObject2

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

the class NotificationSettingsTests method testNotificationsSettingsListForCalculator.

@MediumTest
public void testNotificationsSettingsListForCalculator() {
    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);
    UiObject2 app = mDevice.wait(Until.findObject(By.text("Calculator")), TIMEOUT);
    assertNotNull("Could not find Calculator notification settings", app);
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 53 with UiObject2

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

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);
}
Also used : Intent(android.content.Intent) UiObject2(android.support.test.uiautomator.UiObject2)

Example 54 with UiObject2

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

the class SyncSettingsTest method syncPageShouldHaveAddAccountButton.

@Test
public void syncPageShouldHaveAddAccountButton() throws Exception {
    // Launch Settings
    SettingsHelper.launchSettingsPage(InstrumentationRegistry.getContext(), Settings.ACTION_SYNC_SETTINGS);
    UiObject2 addAccount = mDevice.wait(Until.findObject(By.text("Add account")), TIMEOUT);
    assertTrue(addAccount != null);
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2) MediumTest(androidx.test.filters.MediumTest) Test(org.junit.Test)

Example 55 with UiObject2

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

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());
}
Also used : UiObject2(android.support.test.uiautomator.UiObject2) MediumTest(androidx.test.filters.MediumTest) Test(org.junit.Test)

Aggregations

UiObject2 (android.support.test.uiautomator.UiObject2)133 Test (org.junit.Test)30 BySelector (android.support.test.uiautomator.BySelector)18 MediumTest (android.test.suitebuilder.annotation.MediumTest)16 ListView (android.widget.ListView)8 MediumTest (androidx.test.filters.MediumTest)8 Switch (android.widget.Switch)7 Intent (android.content.Intent)6 RemoteException (android.os.RemoteException)6 LargeTest (android.support.test.filters.LargeTest)6 UiDevice (android.support.test.uiautomator.UiDevice)6 Presubmit (android.platform.test.annotations.Presubmit)4 SdkSuppress (android.support.test.filters.SdkSuppress)4 Activity (android.app.Activity)2 NfcAdapter (android.nfc.NfcAdapter)2 NfcManager (android.nfc.NfcManager)2 Bundle (android.os.Bundle)2 CancellationSignal (android.os.CancellationSignal)2 ParcelFileDescriptor (android.os.ParcelFileDescriptor)2 PrintAttributes (android.print.PrintAttributes)2