- failed on physical device (HONOR ROM-AN00), passed on virtual device (pixel 2 API 31);
- run first MainActivity test and second MainActivity test together, the first one passed and the second on failed; run the second one only, passed.
run those three tests on virtual device (pixel 2 API 31) together, the first one passed only, and the error logs are:
androidx.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'an instance of android.widget.TextView and view.getText() equals string from resource id: <2131689611>' doesn't match the selected view.
Expected: an instance of android.widget.TextView and view.getText() equals string from resource id: <2131689611> [question_oceans] value: The Pacific Ocean is larger than the Atlantic Ocean.
Got: view.getText() was "Canberra is the capital of Australia."
View Details: MaterialTextView{id=2131231055, res-name=question_text_view, visibility=VISIBLE, width=701, height=177, 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, layout-params=android.widget.LinearLayout$LayoutParams@3ad86a4, tag=null, root-is-layout-requested=false, has-input-connection=false, x=189.0, y=577.0, text=Canberra is the capital of Australia., input-type=0, ime-target=false, has-links=false}
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:1724)
at androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:12)
at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:7)
at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:5)
at androidx.test.espresso.ViewInteraction.check(ViewInteraction.java:12)
at com.bignerdranch.android.geoquiz.MainActivityTest.showsSecondQuestionAfterNextPress(MainActivityTest.kt:40)
... 29 trimmed
Caused by: junit.framework.AssertionFailedError: 'an instance of android.widget.TextView and view.getText() equals string from resource id: <2131689611>' doesn't match the selected view.
Expected: an instance of android.widget.TextView and view.getText() equals string from resource id: <2131689611> [question_oceans] value: The Pacific Ocean is larger than the Atlantic Ocean.
Got: view.getText() was "Canberra is the capital of Australia."
View Details: MaterialTextView{id=2131231055, res-name=question_text_view, visibility=VISIBLE, width=701, height=177, 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, layout-params=android.widget.LinearLayout$LayoutParams@3ad86a4, tag=null, root-is-layout-requested=false, has-input-connection=false, x=189.0, y=577.0, text=Canberra is the capital of Australia., input-type=0, ime-target=false, has-links=false}
at androidx.test.espresso.matcher.ViewMatchers.assertThat(ViewMatchers.java:16)
at androidx.test.espresso.assertion.ViewAssertions$MatchesViewAssertion.check(ViewAssertions.java:11)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAssertion.check(ViewInteraction.java:2)
at androidx.test.espresso.ViewInteraction$2.call(ViewInteraction.java:12)
at androidx.test.espresso.ViewInteraction$2.call(ViewInteraction.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)