title: Espresso withText in TextView Doesn't match selected View
body: <p>I'm running into a odd test failure with Espresso. The following is to test a TextView in a displayed Dialog. I get the following error:</p>
  
  <pre><code>   com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'with string from resource id: &lt;2131099772&gt;' doesn't match the selected view.
  Expected: with string from resource id: &lt;2131099772&gt;[my_content] value: Test Content Available
  Got: "TextView{id=2131296340, res-name=dialog_content, visibility=VISIBLE, width=620, height=38, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Test Content Available, input-type=0, ime-target=false}"
  
  at dalvik.system.VMStack.getThreadStackTrace(Native Method)
  at java.lang.Thread.getStackTrace(Thread.java:579)
  at com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:69)
  at com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:40)
  at com.google.android.apps.common.testing.ui.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:159)
  at com.google.android.apps.common.testing.ui.espresso.ViewInteraction.check(ViewInteraction.java:133)
  at com.myapp.testContentDetails(FPATest.java:109)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
  at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
  at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
  at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
  at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
  at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
  at com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner.onStart(GoogleInstrumentationTestRunner.java:167)
  at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
  Caused by: junit.framework.AssertionFailedError: 'with string from resource id: &lt;2131099772&gt;' doesn't match the selected view.
  Expected: with string from resource id: &lt;2131099772&gt;[my_content] value: Test Content Available
  Got: "TextView{id=2131296340, res-name=dialog_content, visibility=VISIBLE, width=620, height=38, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Test Content Available, input-type=0, ime-target=false}"
  
  at com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.assertThat(ViewMatchers.java:789)
  at com.google.android.apps.common.testing.ui.espresso.assertion.ViewAssertions$2.check(ViewAssertions.java:76)
  at com.google.android.apps.common.testing.ui.espresso.ViewInteraction$2.run(ViewInteraction.java:145)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  at android.os.Handler.handleCallback(Handler.java:733)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:136)
  at android.app.ActivityThread.main(ActivityThread.java:5081)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:781)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>So clearly, the view is found, and in it's details, you can see text= the value I'm expecting. Yet it says doesn't match. It's run with the following test statement</p>
  
  <pre><code>onView(withId(R.id.dialog_content)).check(
                  matches(withText(R.string.my_content)));
  </code></pre>
  
  <p>I tried doing it with the following statement as well, but got a NoMatchingViewException, even through the View shows in the view hierarchy of the exception.</p>
  
  <pre><code>onView(withText(R.string.my_content)).check(
                  matches(isDisplayed()));
  </code></pre>
  
  <p>Any help on why this would fail? Its worth noting i'm able to withText() isDisplayed() on a sibling field in the dialog. </p>