Android Kaspresso (Kakao) how to pick file from downloads

48 Views Asked by At

How to pick file from Downloads folder with Kaspresso/Kakao/UI Automator? Cannot find any info about it.

1

There are 1 best solutions below

0
Vladimir Fisher On BEST ANSWER

I've found the solution. Kaspresso:

@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_pdf2") }
        }
    }
}