Bug 1118268 - Improve robocop menu item selection; r=margaret
authorGeoff Brown <gbrown@mozilla.com>
Mon, 28 Mar 2016 16:05:33 -0600
changeset 290763 926f349435b2dfe54784d18e6983dae35d68e4d9
parent 290762 0b7936c9701ab204fe089edde010940df7a581b0
child 290764 0e1791fce8633506e53b34c18205d6b63ae07ba7
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1118268
milestone48.0a1
Bug 1118268 - Improve robocop menu item selection; r=margaret
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseTest.java
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseTest.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseTest.java
@@ -51,17 +51,17 @@ import com.jayway.android.robotium.solo.
 import com.jayway.android.robotium.solo.Timeout;
 
 /**
  *  A convenient base class suitable for most Robocop tests.
  */
 @SuppressWarnings("unchecked")
 abstract class BaseTest extends BaseRobocopTest {
     private static final int VERIFY_URL_TIMEOUT = 2000;
-    private static final int MAX_WAIT_ENABLED_TEXT_MS = 10000;
+    private static final int MAX_WAIT_ENABLED_TEXT_MS = 15000;
     private static final int MAX_WAIT_HOME_PAGER_HIDDEN_MS = 15000;
     private static final int MAX_WAIT_VERIFY_PAGE_TITLE_MS = 15000;
     public static final int MAX_WAIT_MS = 4500;
     public static final int LONG_PRESS_TIME = 6000;
     private static final int GECKO_READY_WAIT_MS = 180000;
 
     protected static final String URL_HTTP_PREFIX = "http://";
 
@@ -430,28 +430,21 @@ abstract class BaseTest extends BaseRobo
                 mSolo.clickOnText(itemName);
             }
         }
     }
 
     public final void selectMenuItem(String menuItemName) {
         // build the item name ready to be used
         String itemName = "^" + menuItemName + "$";
-        mActions.sendSpecialKey(Actions.SpecialKey.MENU);
-        if (waitForText(itemName, true)) {
-            mSolo.clickOnText(itemName);
-        } else {
-            // Older versions of Android have additional settings under "More",
-            // including settings that newer versions have under "Tools."
-            if (mSolo.searchText("(^More$|^Tools$)")) {
-                mSolo.clickOnText("(^More$|^Tools$)");
-            }
-            waitForText(itemName);
-            mSolo.clickOnText(itemName);
-        }
+        final View menuView = mSolo.getView(R.id.menu);
+        mAsserter.isnot(menuView, null, "Menu view is not null");
+        mSolo.clickOnView(menuView, true);
+        mAsserter.ok(waitForEnabledText(itemName), "Waiting for menu item " + itemName, itemName + " is present and enabled");
+        mSolo.clickOnText(itemName);
     }
 
     public final void verifyHomePagerHidden() {
         final View homePagerContainer = mSolo.getView(R.id.home_pager_container);
 
         boolean rc = waitForCondition(new Condition() {
             @Override
             public boolean isSatisfied() {