Bug 1118268 - Wait for animations to finish when selecting menu items. r=margaret draft
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 29 Jan 2016 13:08:16 -0800
changeset 327225 abe41be0080e9e222fe0bd3134efc0945dcf8ed3
parent 326699 1c2c044db3ef02ac69decfee03c40aa14b12fe96
child 513667 2cba04059261f5ac9bdfc4cda2f76101bc522f9c
push id10205
push usermichael.l.comella@gmail.com
push dateFri, 29 Jan 2016 21:09:32 +0000
reviewersmargaret
bugs1118268, 1217484
milestone47.0a1
Bug 1118268 - Wait for animations to finish when selecting menu items. r=margaret testPrivateBrowsing selects menu items to open a new tab and I suspect the failures occur because we don't wait for the animations to finish before attempting to click again, like in bug 1217484 comment 8.
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseTest.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/PixelTest.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
@@ -417,27 +417,30 @@ abstract class BaseTest extends BaseRobo
             }
         }
     }
 
     public final void selectMenuItem(String menuItemName) {
         // build the item name ready to be used
         String itemName = "^" + menuItemName + "$";
         mActions.sendSpecialKey(Actions.SpecialKey.MENU);
+        waitForAnimationsToFinish();
         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$)");
+                waitForAnimationsToFinish();
             }
             waitForText(itemName);
             mSolo.clickOnText(itemName);
         }
+        waitForAnimationsToFinish();
     }
 
     public final void verifyHomePagerHidden() {
         final View homePagerContainer = mSolo.getView(R.id.home_pager_container);
 
         boolean rc = waitForCondition(new Condition() {
             @Override
             public boolean isSatisfied() {
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/PixelTest.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/PixelTest.java
@@ -46,16 +46,17 @@ abstract class PixelTest extends BaseTes
         return p;
     }
 
     protected final void reloadAndPaint() {
         PaintedSurface painted = reloadAndGetPainted();
         painted.close();
     }
 
+    // This should be merged with BaseTest.addTab, but it's probably not worth the time.
     public void addTab(String url, String title, boolean isPrivate) {
         Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
         Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
 
         if (isPrivate) {
             selectMenuItem(mStringHelper.NEW_PRIVATE_TAB_LABEL);
         } else {
             selectMenuItem(mStringHelper.NEW_TAB_LABEL);