Bug 952091 - Robocop: Add test to show Title Bar options. r=gbrown
authorteodora vermesan <teodora.vermesan@softvision.ro>
Thu, 19 Dec 2013 14:11:06 +0200
changeset 165953 478c4361aa0bbfe260f8723af4b8920e250bae3e
parent 165952 8c00a78919c3fc349077691a8d07d24f04dd0174
child 165954 d8d2ac7002ff06c05b25846b221ba28618df585f
push id4680
push userryanvm@gmail.com
push dateThu, 30 Jan 2014 16:13:05 +0000
treeherderfx-team@211ccffa5a01 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs952091
milestone29.0a1
Bug 952091 - Robocop: Add test to show Title Bar options. r=gbrown
mobile/android/base/tests/StringHelper.java
mobile/android/base/tests/robocop.ini
mobile/android/base/tests/testTitleBar.java
--- a/mobile/android/base/tests/StringHelper.java
+++ b/mobile/android/base/tests/StringHelper.java
@@ -106,16 +106,20 @@ public class StringHelper {
     public static final String TABS_LABEL = "Tabs";
 
     // Display
     public static final String TEXT_SIZE_LABEL = "Text size";
     public static final String TITLE_BAR_LABEL = "Title bar";
     public static final String TEXT_REFLOW_LABEL = "Text reflow";
     public static final String CHARACTER_ENCODING_LABEL = "Character encoding";
     public static final String PLUGINS_LABEL = "Plugins";
+ 
+    // Title bar
+    public static final String SHOW_PAGE_TITLE_LABEL = "Show page title";
+    public static final String SHOW_PAGE_ADDRESS_LABEL = "Show page address";
 
     // Privacy
     public static final String TRACKING_LABEL = "Tracking";
     public static final String COOKIES_LABEL = "Cookies";
     public static final String REMEMBER_PASSWORDS_LABEL = "Remember passwords";
     public static final String MASTER_PASWSWORD_LABEL = "Use master password";
     public static final String CLEAR_PRIVATE_DATA_LABEL = "Clear private data";
 
--- a/mobile/android/base/tests/robocop.ini
+++ b/mobile/android/base/tests/robocop.ini
@@ -68,16 +68,17 @@ skip-if = processor == "x86"
 [testSessionOOMSave]
 [testSessionOOMRestore]
 [testSettingsMenuItems]
 # [testShareLink] # see bug 915897
 [testSystemPages]
 # disabled on x86 only; bug 907383
 skip-if = processor == "x86"
 # [testThumbnails] # see bug 813107
+[testTitleBar]
 # [testVkbOverlap] # see bug 907274
 
 # Using JavascriptTest
 [testBrowserDiscovery]
 [testDeviceSearchEngine]
 [testJNI]
 # [testMozPay] # see bug 945675
 [testOrderedBroadcast]
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/tests/testTitleBar.java
@@ -0,0 +1,58 @@
+package org.mozilla.gecko.tests;
+import android.view.View;
+import org.mozilla.gecko.*;
+import java.util.ArrayList;
+
+/**
+ * This patch tests the option that shows the full URL and title in the URL Bar
+ */
+
+public class testTitleBar extends PixelTest {
+
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+    public void testTitleBar() {
+        blockForGeckoReady();
+        checkOption();
+    }
+
+    public void checkOption() {
+
+        String blank1 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
+        String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
+
+        // Loading a page
+        inputAndLoadUrl(blank1);
+        verifyPageTitle(title);
+
+        // Verifing the full URL is displayed in the URL Bar
+        selectOption(StringHelper.SHOW_PAGE_ADDRESS_LABEL);
+        inputAndLoadUrl(blank1);
+        verifyUrl(blank1);
+
+        // Verifing the title is displayed in the URL Bar
+        selectOption(StringHelper.SHOW_PAGE_TITLE_LABEL);
+        inputAndLoadUrl(blank1);
+        verifyPageTitle(title);
+    }
+
+    // Entering settings, changing the options: show title/page address option and verifing the device type because for phone there is an extra back action to exit the settings menu
+    public void selectOption(String option) {
+        selectSettingsItem(StringHelper.DISPLAY_SECTION_LABEL, StringHelper.TITLE_BAR_LABEL);
+        mAsserter.ok(waitForText(StringHelper.SHOW_PAGE_TITLE_LABEL), "Waiting for the pop-up to open", "Pop up with the options was openend");
+        mSolo.clickOnText(option);
+        mAsserter.ok(waitForText(StringHelper.CHARACTER_ENCODING_LABEL), "Waiting to press the option", "The pop-up is dismissed once clicked");
+        if (mDevice.type.equals("phone")) {
+            mActions.sendSpecialKey(Actions.SpecialKey.BACK);
+            mAsserter.ok(waitForText(StringHelper.CUSTOMIZE_SECTION_LABEL), "Waiting to perform one back", "One back performed");
+            mActions.sendSpecialKey(Actions.SpecialKey.BACK);
+            mAsserter.ok(waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_URL), "Waiting to exit settings", "Exit settings done");
+        }
+        else {
+            mActions.sendSpecialKey(Actions.SpecialKey.BACK);
+            mAsserter.ok(waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_URL), "Waiting to exit settings", "Exit settings done");
+        }
+    }
+}