Bug 1217484 - Wait for animations to finish in testNewTab. r=sebastian
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 02 Dec 2015 14:01:46 -0800
changeset 309636 536efefba22411ea1b49938f11da706520e9939b
parent 309635 535bb5015ea1b1ced4aa1fb39b88eace3b324264
child 309637 6e27e28a8dfa0028cb5069a6cf5ed885f5d535c7
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1217484
milestone45.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 1217484 - Wait for animations to finish in testNewTab. r=sebastian By waiting an arbitrary amount of time. :(
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
@@ -527,32 +527,42 @@ abstract class BaseTest extends BaseRobo
                     button.performClick();
                 }
             });
        } catch (Throwable throwable) {
            mAsserter.ok(false, "Unable to click the button","Was unable to click button ");
        }
     }
 
+    private void waitForAnimationsToFinish() {
+        // Ideally we'd actually wait for animations to finish but since we have
+        // no good way of doing that, we just wait an arbitrary unit of time.
+        mSolo.sleep(3500);
+    }
+
     public void addTab() {
         mSolo.clickOnView(mSolo.getView(R.id.tabs));
+        waitForAnimationsToFinish();
+
         // wait for addTab to appear (this is usually immediate)
         boolean success = waitForCondition(new Condition() {
             @Override
             public boolean isSatisfied() {
                 View addTabView = mSolo.getView(R.id.add_tab);
                 if (addTabView == null) {
                     return false;
                 }
                 return true;
             }
         }, MAX_WAIT_MS);
         mAsserter.ok(success, "waiting for add tab view", "add tab view available");
         final Actions.RepeatedEventExpecter pageShowExpecter = mActions.expectGeckoEvent("Content:PageShow");
         mSolo.clickOnView(mSolo.getView(R.id.add_tab));
+        waitForAnimationsToFinish();
+
         // Wait until we get a PageShow event for a new tab ID
         for(;;) {
             try {
                 JSONObject data = new JSONObject(pageShowExpecter.blockForEventData());
                 int tabID = data.getInt("tabID");
                 if (tabID == 0) {
                     mAsserter.dumpLog("addTab ignoring PageShow for tab 0");
                     continue;