我使用 Firebase-ui 身份验证解决方案(使用 com.firebaseui:firebase-ui:0.4.1)创建了我的应用程序的登录部分。这个库很棒,但我无法设置我的(Espresso)测试用例。
在测试用例中,我想使用邮件提供商(使用邮件测试帐户)执行登录。Espresso 似乎无法做到这一点:单击“使用电子邮件登录”后,我无法单击显示为第一个屏幕的“以上都不是”按钮。
谁能够使用 Espresso 成功登录 Firebase-UI 身份验证库,您是如何做到的?
下面是相关的测试代码(使用新的 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()));