Not able to find solution for detecting camera button for different devices in Espresso script to be run on Firebase Test Lab
Asked Answered
A

2

5

I have to create a script using Espresso to test my app in Firebase test lab. My app uses Camera to capture images and I have opened the default camera app.

For testing on my device I give package name for the testing device that I am using. The issue is that the camera app package names for different Android devices is different, and we do not know each of it. Also it is not good to hard code package names.

I have searched out and not able to find a way to find a solution.

Thanking in advance.

Affirmation answered 19/3, 2019 at 12:12 Comment(0)
D
6

I don't think there's a good way to do this with the actual camera app, since the camera app often differs between device models and Android versions.

How about you fake this dependency in your tests? Either by abstracting the code that calls the camera app, or by adding your own fake camera activity that will get called and returns you a picture the way it's supposed to happen.

Decamp answered 19/3, 2019 at 16:53 Comment(2)
Faking the camera will not make sure if the actual camera did return a image and it got saved properly. Am I right on this?Affirmation
Going with faking the camera Activity. ThanksAffirmation

© 2022 - 2024 — McMap. All rights reserved.