测试显示小吃吧以E preSSO [英] Testing Snackbar show with Espresso

查看:273
本文介绍了测试显示小吃吧以E preSSO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来测试使用es preSSO的小吃店出现与右边的文本?

我有一个简单的调用来创建一个小吃店

  Snackbar.make(MVIEW,我的文字,Snackbar.LENGTH_LONG).show();

我已经试过这没有运气

  OnView由(withText(我的text\")).inRoot(withDecorView(not(is(mActivityRule.getActivity().getWindow().getDecorView())))).check(matches(isDisplayed()));


解决方案

这为我工作,请尝试。

  OnView由(allOf(withId(android.support.design.R.id.snackbar_text),withText(我的文字)))
            。检查(匹配(isDisplayed()));

Is there a way to test using Espresso that the snackbar shows up with the right text?

I have a simple call to create a snackbar

Snackbar.make(mView, "My text", Snackbar.LENGTH_LONG).show();

I have tried this without luck

onView(withText("My text")).inRoot(withDecorView(not(is(mActivityRule.getActivity().getWindow().getDecorView())))).check(matches(isDisplayed()));

解决方案

This worked for me, please try.

onView(allOf(withId(android.support.design.R.id.snackbar_text), withText("My text")))
            .check(matches(isDisplayed()));

这篇关于测试显示小吃吧以E preSSO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆