我使用Firebase-ui auth解决方案创建了我的应用的登录部分(使用com.firebaseui:firebase-ui:0.4.1)。这个库很棒但是我在设置我的(Espresso)测试用例时遇到了麻烦。
在测试用例中,我想使用邮件提供程序(使用邮件测试帐户)执行登录。 Espresso似乎无法执行此操作:单击“使用电子邮件登录”后,我无法单击显示为第一个屏幕的“以上任何内容”按钮。
谁能够使用Espresso在Firebase-UI auth库上成功登录,您是如何做到这一点的?
以下是相关的测试代码(使用新的Espresso Recorder创建!)
ViewInteraction appCompatButton2 = onView(
allOf(withId(R.id.email_provider), withText("Sign in with email"),
withParent(withId(R.id.btn_holder)),
isDisplayed()));
appCompatButton2.perform(click());
ViewInteraction appCompatEditText = onView(
allOf(withId(R.id.email),
withParent(withId(R.id.input_layout_email)),
isDisplayed()));
appCompatEditText.perform(replaceText("a@a.aa"));
ViewInteraction appCompatButton3 = onView(
allOf(withId(R.id.button_ok), withText("Next"), isDisplayed()));
appCompatButton3.perform(click());
ViewInteraction appCompatEditText2 = onView(
allOf(withId(R.id.password),
withParent(withId(R.id.password_layout)),
isDisplayed()));
appCompatEditText2.perform(replaceText("aaaaaa"));
ViewInteraction appCompatButton4 = onView(
allOf(withId(R.id.button_done), withText("Next"), isDisplayed()));
appCompatButton4.perform(click());
ViewInteraction imageButton = onView(
allOf(withId(R.id.fab), isDisplayed()));
imageButton.check(matches(isDisplayed()));