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 225847 bd120a8b1abb69b880e3cfe220d276f952d3ac98
parent 225846 180de799976d4f8994eb53296a26f6a8e1034570
child 225848 0eab3abfb5dc7c3ba2d7061657e303f6f3cbac42
push id7203
push userryanvm@gmail.com
push dateTue, 04 Nov 2014 15:36:40 +0000
treeherdermozilla-aurora@056a21b111cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, test-only
bugs1091410
milestone35.0a2
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
@@ -194,16 +194,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);
@@ -213,19 +214,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");