Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 247
Saraz Avatar asked Mar 19 '19 12:03

Saraz


People also ask

Is firebase Testlab free?

$5 per hour for each physical device. $1 per hour for each virtual device.

What is Robo test?

Robo test analyzes the structure of your app's user interface (UI) and then explores it methodically, automatically simulating user activities.

How do I use firebase lab test?

On the Firebase console navigation bar, click Test Lab, and then click Get Started -> Run a Robo test. Click Browse, browse to your app APK, and then click Continue. Define your test matrix by selecting which devices, Android API levels, screen orientations and locales you want to test your app against.


1 Answers

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.

like image 79
Maik Avatar answered Oct 19 '22 16:10

Maik