如何处理Espresso UI Testing附带的屏幕快照中单击Google对话框的按钮com.google.android.gms:id/cancel(文本为“ None of the above of”),?
[

最佳答案

这些帐户选择器对话框不在您的测试应用程序范围内。 Espresso无法处理这些UI元素。

您可以将uiautomator用作Espresso测试的一部分。

见下面的例子

@RunWith(AndroidJUnit4.class)
public class SocialLoginTest {
private UiDevice mUiDevice;

@Before
public void before() throws Exception {
    mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
}

@Test
public void someTest() throws Exception {
    //Launch activity
    //Simulate a Click on the button in your activity that triggers account chooser dialog.

    UiObject mText = mUiDevice.findObject(new UiSelector().text("NONE OF THE ABOVE"));
    mText.click();
    //Assertions for results handled in your application
}

关于android - Google弹出式Espresso Android Studio 2.2,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39370354/

10-13 02:04