简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM