Bug 941844 - Part 3: additional Robocop checks for page titles. r=trivial
authorRichard Newman <rnewman@mozilla.com>
Tue, 03 Dec 2013 20:21:33 -0800
changeset 158756 f3f8f27131807410440af922f6741d5cbbbe541f
parent 158755 d5a62078b4f2b3f93a0b158e1b66c8b109c64aab
child 158757 9fe5e212fa41e6f9d85abea50467003301509b42
child 158801 77c68153184c8ad19e72c097269828c9841dd850
push id37085
push userryanvm@gmail.com
push dateWed, 04 Dec 2013 22:39:20 +0000
treeherdermozilla-inbound@1426ffa9caf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstrivial
bugs941844
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 941844 - Part 3: additional Robocop checks for page titles. r=trivial
mobile/android/base/tests/testAboutPage.java
--- a/mobile/android/base/tests/testAboutPage.java
+++ b/mobile/android/base/tests/testAboutPage.java
@@ -7,42 +7,47 @@ import org.mozilla.gecko.*;
  *  - check that about: loads from Settings/About...
  */
 public class testAboutPage extends PixelTest {
     @Override
     protected int getTestType() {
         return TEST_MOCHITEST;
     }
 
+    private void ensureTitleMatches(final String regex) {
+        Element urlBarTitle = mDriver.findElement(getActivity(), URL_BAR_TITLE_ID);
+        mAsserter.isnot(urlBarTitle, null, "Got the URL bar title");
+        assertMatches(urlBarTitle.getText(), regex, "page title match");
+    }
+
     public void testAboutPage() {
         blockForGeckoReady();
 
-        // Load the about: page and verify its title
+        // Load the about: page and verify its title.
         String url = "about:";
         loadAndPaint(url);
 
-        Element urlBarTitle = mDriver.findElement(getActivity(), URL_BAR_TITLE_ID);
-        mAsserter.isnot(urlBarTitle, null, "Got the URL bar title");
-        assertMatches(urlBarTitle.getText(), "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)", "page title match");
+        ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
 
-        // Open a new page to remove the about: page from the current tab
+        // Open a new page to remove the about: page from the current tab.
         url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
         inputAndLoadUrl(url);
 
-        // Set up listeners to catch the page load we're about to do
+        // At this point the page title should have been set.
+        ensureTitleMatches("Browser Blank Page 01");
+
+        // Set up listeners to catch the page load we're about to do.
         Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
         Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
 
         selectSettingsItem("Mozilla", "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
 
         // Wait for the new tab and page to load
         tabEventExpecter.blockForEvent();
         contentEventExpecter.blockForEvent();
 
         tabEventExpecter.unregisterListener();
         contentEventExpecter.unregisterListener();
 
-        // Grab the title to make sure the about: page was loaded
-        urlBarTitle = mDriver.findElement(getActivity(), URL_BAR_TITLE_ID);
-        mAsserter.isnot(urlBarTitle, null, "Got the URL bar title");
-        assertMatches(urlBarTitle.getText(), "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)", "page title match");
+        // Grab the title to make sure the about: page was loaded.
+        ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
     }
 }