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");
}
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());
}
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();
}
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();
}
Aggregations