Tuesday, 5 October 2021

Automated test - Start recording with camera intent

I have an app and I am trying to write some instrumented test on it. One feature of that app is a button that, when clicked, open the default camera intent of the phone to record a video. It is done by starting the intent ACTION_VIDEO_CAPTURE. After opening that intent, the user can record a video, when finished, he will be redirected to my activity which will upload the video using some API and open a Toast explaining to the user that the video has been uploaded (or not).

Now, I want to write an instrumented test to test that class. I can easily press the button to open the default camera intent, but after this I am stuck. How can I -automatically- start recording, stop recording after a few seconds, then press the "OK" button to go back to my activity? Is this even possible using Espresso or any other library?



from Automated test - Start recording with camera intent

No comments:

Post a Comment