Android Kaspresso (Kakao) 如何从下载中选择文件

问题描述 投票:0回答:1

如何使用 Kaspresso/Kakao/UI Automator 从下载文件夹中选取文件?找不到任何相关信息。

ui-automation android-espresso android-testing gui-testing kakao
1个回答
0
投票

我找到了解决方案。卡斯派索:

@Test
fun sendReceiveFile() {

    ChatMainScreen {
        addAttachmentBtn {
            isVisible()
            click()
        }
        val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())

        UiScrollable(UiSelector().scrollable(true).instance(0)).scrollIntoView(
            UiSelector().textContains("test_pdf2").instance(0)
        ) // we need to scroll to this element if not visible

        val okButton: UiObject2? = device.findObject(
            By.textContains("test_pdf2")
        )

        device.performActionAndWait({ okButton?.click() }, Until.newWindow(), 4000)
        sendMessageBtn {
            isVisible()
            click()
        }
        chatItemsRecyclerView {
            hasDescendant { containsText("test_pdf1") }
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.