diff options
author | David Yu <dyu@google.com> | 2016-06-27 19:38:54 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-06-27 19:38:54 +0000 |
commit | e7968167ccbfa681139ab3b367f4d3bed63ee731 (patch) | |
tree | d0a211d64012f10445822ba80283e00b1a21b6b2 | |
parent | 75ed67f76cc3a819fd56825e8110bb14126953ad (diff) | |
parent | f077a3a91b27f3d5544cf70baa29190f441a5be4 (diff) | |
download | adt-infra-e7968167ccbfa681139ab3b367f4d3bed63ee731.tar.gz |
Merge "Add two Date and Time system image UI tests for enabling time zone and 24-hour format."
-rw-r--r-- | system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/SettingsTest.java | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/SettingsTest.java b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/SettingsTest.java index 0589d3df..88b696ca 100644 --- a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/SettingsTest.java +++ b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/SettingsTest.java @@ -241,4 +241,99 @@ public class SettingsTest { ); } } + + /** + * Verifies Time Zone option can be enabled. + * <p> + * This is run to qualify releases. Please involve the test team in substantial changes. + * <p> + * TR ID: C14581409 + * <p> + * <pre> + * 1. Start the emulator. + * 2. Open Settings > Date & Time + * 3. Verify automatic time zone option is enabled. + * 4. Disable automatic time zone. + * 5. Verify Select time zone is enabled. + * 6. Enable time zone. + * Verify: + * Select time zone text and Pacific Daylight Time text can be seen. + * </pre> + */ + @Test + public void enableTimeZone() throws Exception { + Instrumentation instrumentation = testFramework.getInstrumentation(); + UiDevice device = testFramework.getDevice(); + AppLauncher.launch(instrumentation, "Settings"); + UiScrollable itemList = + new UiScrollable( + new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES)); + itemList.setAsVerticalList(); + itemList.scrollIntoView(new UiSelector().textContains("Date & time")); + device.findObject(new UiSelector().text("Date & time")).click(); + + UiObject2 switchWidget = UiAutomatorPlus.findObjectByRelative( + instrumentation, + By.clazz("android.widget.Switch"), + By.text("Automatic time zone"), + By.clazz("android.widget.ListView")); + // Initialize automatic time zone option to enabled state. + if (!switchWidget.isChecked()) { + switchWidget.click(); + } + assertTrue(!device.findObject(new UiSelector().text("Select time zone")).isEnabled()); + // Disable automatic time zone option. + switchWidget.click(); + assertTrue(device.findObject(new UiSelector().text("Select time zone")).isEnabled()); + device.findObject(new UiSelector().text("Select time zone")).click(); + assertTrue(device.findObject(new UiSelector().text("Select time zone")).exists()); + assertTrue(device.findObject(new UiSelector().text("Pacific Daylight Time")).exists()); + } + + /** + * Verifies 24-hour format is enabled. + * <p> + * This is run to qualify releases. Please involve the test team in substantial changes. + * <p> + * TR ID: C14581410 + * <p> + * <pre> + * 1. Start the emulator. + * 2. Open Settings > Date & Time + * 3. Verify 24-hour format option is disabled. + * 4. Verify example time on screen shows 1:00 PM. + * 5. Enable 24-hour format. + * Verify: + * Example time on screen shows 13:00. + * </pre> + */ + @Test + public void enableTwentyFourHourFormat() throws Exception { + Instrumentation instrumentation = testFramework.getInstrumentation(); + UiDevice device = testFramework.getDevice(); + AppLauncher.launch(instrumentation, "Settings"); + UiScrollable itemList = + new UiScrollable( + new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES)); + itemList.setAsVerticalList(); + itemList.scrollIntoView(new UiSelector().textContains("Date & time")); + device.findObject(new UiSelector().text("Date & time")).click(); + + UiObject2 switchWidget = UiAutomatorPlus.findObjectByRelative( + instrumentation, + By.clazz("android.widget.Switch"), + By.text("Use 24-hour format"), + By.clazz("android.widget.ListView")); + // Initialize 24-hour format option to disabled state. + if (switchWidget.isChecked()) { + switchWidget.click(); + } + assertTrue(device.findObject(new UiSelector().text("Use 24-hour format")).exists()); + assertTrue(device.findObject(new UiSelector().text("1:00 PM")).exists()); + // Enable 24-hour format. + switchWidget.click(); + assertTrue(device.findObject(new UiSelector().text("13:00")).exists()); + // Clean up by disabling 24-hour format option. + switchWidget.click(); + } } |