Android Espresso, Wake up device before test. How to use a custom manifest for test?

前端 未结 8 1302
情书的邮戳
情书的邮戳 2020-12-09 03:52

I\'ve been writing tests with androids new espresso framework and find that it works well. One annoying thing (not particular to espresso) is that I have to make sure my scr

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 04:08

    For testing device set Lock pattern to NONE in Settings->Security Then use instance of UiDevice and call its wakeUp() method

    This method simulates pressing the power button if the screen is OFF else it does nothing if the screen is already ON. If the screen was OFF and it just got turned ON, this method will insert a 500ms delay to allow the device time to wake up and accept input.

提交回复
热议问题