Bug 1091410 - Intermittent testLinkContextMenu | Wait for the URLBar. r=bnicholson, a=test-only
authorMark Finkle <mfinkle@mozilla.com>
Mon, 03 Nov 2014 14:44:45 -0500
changeset 225925 2ad92b68de0b
parent 225924 cdd31f8931ae
child 225926 2be3d4150683
push id4070
push userryanvm@gmail.com
push date2014-11-04 15:37 +0000
treeherdermozilla-beta@2ad92b68de0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, test-only
bugs1091410
milestone34.0
Bug 1091410 - Intermittent testLinkContextMenu | Wait for the URLBar. r=bnicholson, a=test-only
mobile/android/base/tests/BaseTest.java
--- a/mobile/android/base/tests/BaseTest.java
+++ b/mobile/android/base/tests/BaseTest.java
@@ -178,16 +178,17 @@ abstract class BaseTest extends BaseRobo
         mAsserter.ok(value.matches(regex), name, "Expected /" + regex +"/, got \"" + value + "\"");
     }
 
     /**
      * Click on the URL bar to focus it and enter editing mode.
      */
     protected final void focusUrlBar() {
         // Click on the browser toolbar to enter editing mode
+        mSolo.waitForView(R.id.browser_toolbar);
         final View toolbarView = mSolo.getView(R.id.browser_toolbar);
         mSolo.clickOnView(toolbarView);
 
         // Wait for highlighed text to gain focus
         boolean success = waitForCondition(new Condition() {
             @Override
             public boolean isSatisfied() {
                 EditText urlEditText = (EditText) mSolo.getView(R.id.url_edit_text);
@@ -197,19 +198,19 @@ abstract class BaseTest extends BaseRobo
                 return false;
             }
         }, MAX_WAIT_ENABLED_TEXT_MS);
 
         mAsserter.ok(success, "waiting for urlbar text to gain focus", "urlbar text gained focus");
     }
 
     protected final void enterUrl(String url) {
-        final EditText urlEditView = (EditText) mSolo.getView(R.id.url_edit_text);
+        focusUrlBar();
 
-        focusUrlBar();
+        final EditText urlEditView = (EditText) mSolo.getView(R.id.url_edit_text);
 
         // Send the keys for the URL we want to enter
         mSolo.clearEditText(urlEditView);
         mSolo.enterText(urlEditView, url);
 
         // Get the URL text from the URL bar EditText view
         final String urlBarText = urlEditView.getText().toString();
         mAsserter.is(url, urlBarText, "URL typed properly");