浓缩咖啡吐司搭配仅适用于Android 10(API级别29)

。
订阅者
271
文章
0
评论
测试交流评论144字数 297阅读0分59秒阅读模式
摘要用浓缩咖啡测试时。toast仅适用于Android 10。 onView(带文本(R.string.TOAST\u string)) .inRoot(withDecorView(n...

用浓缩咖啡测试时。toast仅适用于Android 10。

onView(withText(R.string.TOAST_STRING))
                .inRoot(withDecorView(not(getActivity().window.decorView)))
                .check(matches(isDisplayed()))

但是在android 11上,这不起作用。对我来说,它抛出了RootViewWithoutFocusException文章源自玩技e族-https://www.playezu.com/192023.html

androidx.test.espresso.base.RootViewPicker$RootViewWithoutFocusException: Waited for the root of the view hierarchy to have window focus and not request layout for 10 seconds. If you specified a non default root matcher, it may be picking a root that never takes focus. Root:
    Root{application-window-token=android.view.ViewRootImpl$W@6aa9ae4, window-token=android.view.ViewRootImpl$W@6aa9ae4, has-window-focus=false, layout-params-type=1, layout-params-string={(0,0)(fillxfill) ty=BASE_APPLICATION wanim=0x10302fe
      fl=LAYOUT_IN_SCREEN LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED DRAWS_SYSTEM_BAR_BACKGROUNDS
      pfl=FORCE_DRAW_STATUS_BAR_BACKGROUND FIT_INSETS_CONTROLLED
      fitSides=}, decor-view-string=DecorView{id=-1, visibility=INVISIBLE, width=1080, height=2340, has-focus=false, has-focusable=false, has-window-focus=false, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params={(0,0)(fillxfill) ty=BASE_APPLICATION wanim=0x10302fe
      fl=LAYOUT_IN_SCREEN LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED DRAWS_SYSTEM_BAR_BACKGROUNDS
      pfl=FORCE_DRAW_STATUS_BAR_BACKGROUND FIT_INSETS_CONTROLLED
      fitSides=}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}}
        at dalvik.system.VMStack.getThreadStackTrace(Native Method)
        at java.lang.Thread.getStackTrace(Thread.java:1736)
        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:8)
        at androidx.test.espresso.ViewInteraction.check(ViewInteraction.java:12)
        at com.example.asapandroid.kbTests.SubCategoryPageTest.noNetworkToastShownWhenThereIsNoNetwork(SampleTest.kt:37)

请有人帮我做这个。检查android 11及更高版本上是否显示祝酒词。文章源自玩技e族-https://www.playezu.com/192023.html

软件测试设计文章源自玩技e族-https://www.playezu.com/192023.html 文章源自玩技e族-https://www.playezu.com/192023.html

 
匿名

发表评论

匿名网友
确定

拖动滑块以完成验证