android.support.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'with text: is "Mock String"' doesn't match the selected view. Expected: with text: is "Mock String" Got: "AppCompatTextView{id=2131427413, res-name=tv_text_data, visibility=VISIBLE, width=183, 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=32.0, y=128.0, text=Release String, input-type=0, ime-target=false, has-links=false}"

Stack Overflow | Mes | 5 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Espresso test is not working as expected

    Stack Overflow | 5 months ago | Mes
    android.support.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'with text: is "Mock String"' doesn't match the selected view. Expected: with text: is "Mock String" Got: "AppCompatTextView{id=2131427413, res-name=tv_text_data, visibility=VISIBLE, width=183, 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=32.0, y=128.0, text=Release String, input-type=0, ime-target=false, has-links=false}"
  2. 0

    Espresso 'is enabled' doesn't match the selected view

    Stack Overflow | 2 years ago | user1007522
    junit.framework.AssertionFailedError: 'is enabled' doesn't match the selected view. Expected: is enabled Got: "Button{id=2131296458, res-name=fragment_vote_pause_btn, visibility=INVISIBLE, width=329, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=true, is-enabled=false, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=375.0, y=649.0, text=Tap to play or pause, input-type=0, ime-target=false, has-links=false}"
  3. 0

    GitHub comment 5#275647463

    GitHub | 1 month ago | Sloy
    android.support.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'is displayed on the screen to the user' doesn't match the selected view. Expected: is displayed on the screen to the user Got: "TextView{id=2131558518, res-name=selected_item, visibility=VISIBLE, width=24, height=57, 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=528.0, y=822.0, text=2, input-type=0, ime-target=false, has-links=false}"
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

Root Cause Analysis

  1. junit.framework.AssertionFailedError

    'with text: is "Mock String"' doesn't match the selected view. Expected: with text: is "Mock String" Got: "AppCompatTextView{id=2131427413, res-name=tv_text_data, visibility=VISIBLE, width=183, 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=32.0, y=128.0, text=Release String, input-type=0, ime-target=false, has-links=false}"

    at android.support.test.espresso.matcher.ViewMatchers.assertThat()
  2. android.support.test
    ViewInteraction$2.run
    1. android.support.test.espresso.matcher.ViewMatchers.assertThat(ViewMatchers.java:1053)
    2. android.support.test.espresso.assertion.ViewAssertions$2.check(ViewAssertions.java:89)
    3. android.support.test.espresso.ViewInteraction$2.run(ViewInteraction.java:170)
    3 frames
  3. Java RT
    FutureTask.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:237)
    2 frames
  4. Android Platform
    ActivityThread.main
    1. android.os.Handler.handleCallback(Handler.java:733)
    2. android.os.Handler.dispatchMessage(Handler.java:95)
    3. android.os.Looper.loop(Looper.java:136)
    4. android.app.ActivityThread.main(ActivityThread.java:5086)
    4 frames
  5. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:515)
    2 frames
  6. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    2 frames
  7. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame