我正在测试在我的活动中启动片段,所以在单击按钮以启动片段后,我测试了已启动片段中视图中的文本是否存在,但测试失败,即使该片段已在我的手机上启动,甚至在视图层次结构中显示该文本存在:
View Hierarchy:
+--------->AppCompatTextView{id=2131886318, res-name=text3_textView, visibility=VISIBLE, width=768, height=68, 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=695.0, text=Pour finaliser votre inscription nous avons besion
d'une photo de profil, input-type=0, ime-target=false, has-links=false}
测试在此处失败:
onView(withText("photo de profil")).check(matches(isDisplayed()));
我在想为什么Espresso未通过此测试,是因为它没有等待片段启动吗?
顺便说一下,我关闭了动画。