Search in sources :

Example 31 with UiScrollable

use of android.support.test.uiautomator.UiScrollable in project focus-android by mozilla-mobile.

the class SwitchLocaleTest method EnglishSystemLocaleTest.

@Test
public void EnglishSystemLocaleTest() throws InterruptedException, UiObjectNotFoundException {
    UiObject frenchMenuItem = TestHelper.mDevice.findObject(new UiSelector().className("android.widget.TextView").text("Français"));
    UiObject englishMenuItem = TestHelper.mDevice.findObject(new UiSelector().className("android.widget.TextView").text("System default"));
    UiObject frenchLocaleinEn = TestHelper.mDevice.findObject(new UiSelector().className("android.widget.CheckedTextView").text("Français"));
    /* Go to Settings */
    TestHelper.inlineAutocompleteEditText.waitForExists(waitingTime);
    openSettings();
    LanguageSelection.waitForExists(waitingTime);
    /* system locale is in English, check it is now set to system locale */
    LanguageSelection.click();
    sysDefaultLocale.waitForExists(waitingTime);
    Assert.assertTrue(sysDefaultLocale.isChecked());
    /* change locale to non-english in the setting, verify the locale is changed */
    UiScrollable appViews = new UiScrollable(new UiSelector().scrollable(true));
    appViews.scrollIntoView(frenchLocaleinEn);
    Assert.assertTrue(frenchLocaleinEn.isClickable());
    frenchLocaleinEn.click();
    frenchHeading.waitForExists(waitingTime);
    Assert.assertTrue(frenchHeading.exists());
    Assert.assertTrue(frenchMenuItem.exists());
    /* Exit to main and see the UI is in French as well */
    TestHelper.pressBackKey();
    UiObject frenchTitle = TestHelper.mDevice.findObject(new UiSelector().className("android.widget.TextView").text("Navigation privée automatique.\nNaviguez. Effacez. Recommencez."));
    frenchTitle.waitForExists(waitingTime);
    Assert.assertTrue(frenchTitle.exists());
    openMenu();
    Assert.assertEquals(TestHelper.settingsMenuItem.getText(), "Paramètres");
    Assert.assertEquals(TestHelper.HelpItem.getText(), "Aide");
    TestHelper.settingsMenuItem.click();
    /* re-enter settings, change it back to system locale, verify the locale is changed */
    LanguageSelection.click();
    Assert.assertTrue(frenchLocaleinEn.isChecked());
    appViews.scrollToBeginning(10);
    sysDefaultLocale.waitForExists(waitingTime);
    sysDefaultLocale.click();
    LanguageSelection.waitForExists(waitingTime);
    Assert.assertTrue(englishHeading.exists());
    Assert.assertTrue(englishMenuItem.exists());
    TestHelper.pressBackKey();
    UiObject englishTitle = TestHelper.mDevice.findObject(new UiSelector().className("android.widget.TextView").text("Automatic private browsing.\nBrowse. Erase. Repeat."));
    englishTitle.waitForExists(waitingTime);
    Assert.assertTrue(englishTitle.exists());
    TestHelper.menuButton.perform(click());
    Assert.assertEquals(TestHelper.settingsMenuItem.getText(), "Settings");
    Assert.assertEquals(TestHelper.HelpItem.getText(), "Help");
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector) UiScrollable(android.support.test.uiautomator.UiScrollable) Test(org.junit.Test)

Example 32 with UiScrollable

use of android.support.test.uiautomator.UiScrollable in project focus-android by mozilla-mobile.

the class SwitchLocaleTest method FrenchLocaleTest.

@Test
public void FrenchLocaleTest() throws InterruptedException, UiObjectNotFoundException {
    UiObject frenchMenuItem = TestHelper.mDevice.findObject(new UiSelector().className("android.widget.TextView").text("Valeur par défaut du système"));
    UiObject englishMenuItem = TestHelper.mDevice.findObject(new UiSelector().className("android.widget.TextView").text("English (United States)"));
    UiObject englishLocaleinFr = TestHelper.mDevice.findObject(new UiSelector().className("android.widget.CheckedTextView").text("English (United States)"));
    /* Go to Settings */
    TestHelper.inlineAutocompleteEditText.waitForExists(waitingTime);
    openSettings();
    LanguageSelection.waitForExists(waitingTime);
    /* system locale is in French, check it is now set to system locale */
    frenchHeading.waitForExists(waitingTime);
    Assert.assertTrue(frenchHeading.exists());
    Assert.assertTrue(frenchMenuItem.exists());
    LanguageSelection.click();
    Assert.assertTrue(sysDefaultLocale.isChecked());
    /* change locale to English in the setting, verify the locale is changed */
    UiScrollable appViews = new UiScrollable(new UiSelector().scrollable(true));
    appViews.scrollIntoView(englishLocaleinFr);
    Assert.assertTrue(englishLocaleinFr.isClickable());
    englishLocaleinFr.click();
    englishHeading.waitForExists(waitingTime);
    Assert.assertTrue(englishHeading.exists());
    Assert.assertTrue(englishMenuItem.exists());
}
Also used : UiObject(android.support.test.uiautomator.UiObject) UiSelector(android.support.test.uiautomator.UiSelector) UiScrollable(android.support.test.uiautomator.UiScrollable) Test(org.junit.Test)

Example 33 with UiScrollable

use of android.support.test.uiautomator.UiScrollable in project android_packages_apps_Settings by SudaMod.

the class UserSettingsTest method launchUserSettings.

private void launchUserSettings() throws Exception {
    launchSettings();
    final UiScrollable settings = new UiScrollable(new UiSelector().packageName(mTargetPackage).scrollable(true));
    final String titleUsersAndAccounts = USER_AND_ACCOUNTS;
    settings.scrollTextIntoView(titleUsersAndAccounts);
    mDevice.findObject(new UiSelector().text(titleUsersAndAccounts)).click();
    mDevice.findObject(new UiSelector().text(USERS)).click();
}
Also used : UiSelector(android.support.test.uiautomator.UiSelector) UiScrollable(android.support.test.uiautomator.UiScrollable)

Example 34 with UiScrollable

use of android.support.test.uiautomator.UiScrollable in project platform_packages_apps_Settings by BlissRoms.

the class UserSettingsTest method launchUserSettings.

private void launchUserSettings() throws Exception {
    launchSettings();
    final UiScrollable settings = new UiScrollable(new UiSelector().packageName(mTargetPackage).scrollable(true));
    final String titleUsersAndAccounts = USER_AND_ACCOUNTS;
    settings.scrollTextIntoView(titleUsersAndAccounts);
    mDevice.findObject(new UiSelector().text(titleUsersAndAccounts)).click();
    mDevice.findObject(new UiSelector().text(USERS)).click();
}
Also used : UiSelector(android.support.test.uiautomator.UiSelector) UiScrollable(android.support.test.uiautomator.UiScrollable)

Aggregations

UiScrollable (android.support.test.uiautomator.UiScrollable)34 UiSelector (android.support.test.uiautomator.UiSelector)29 UiObject (android.support.test.uiautomator.UiObject)17 Test (org.junit.Test)6 GfxMonitor (android.support.test.jank.GfxMonitor)5 JankTest (android.support.test.jank.JankTest)5 UiObjectNotFoundException (android.support.test.uiautomator.UiObjectNotFoundException)5 Intent (android.content.Intent)2 RadioButton (android.widget.RadioButton)1 RelativeLayout (android.widget.RelativeLayout)1