タイトルが言うように、それは何度か失敗し、それ以外は成功する。スヌーカーとエスプレッソが時々失敗する
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: "AppCompatTextView{id=2131492981, res-name=snackbar_text, visibility=VISIBLE, width=444, height=71, 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=18.0, y=0.0, text=Network Error, input-type=0, ime-target=false, has-links=false}"
スタックトレースの最初の行は、エスプレッソが画面上のスナックバーを見ることができないことを示唆しています。しかし、2行目は実際にvisibility=VISIBLE
とtext=Network Error
のSnackbarが正しいことを示しています。
私は混乱しています、何が起こっていますか?
これは私のテストコードです:
activityRule.launchActivity(new Intent());
onView(withText("Network Error")).check(matches(isDisplayed()));
PS:私は、全体のテストスーツを実行すると、それはほとんどが失敗しました。私はこのテストだけを実行すると失敗することもあります。それ以外の時は緑色を通りますが、パターンがなく、ランダムに見えます。
ありがとうございます!私はUIテストをあきらめる必要のない、これに対する解決策があることをうれしく思っています。 – AdamMc331
実際に私もこれを試しましたが、同じ問題があります。 :( – AdamMc331