I’ve developed an Espresso instrumentation test for an app built with React Native. The test involves a "Login with Google" button, which initiates an OAuth flow. On a local device or emulator, this process brings up a system popup listing the Google accounts signed into the device. However, in Firebase Test Lab’s instrumentation tests, the devices do not have any Google accounts logged in. Consequently, instead of showing a list of accounts to choose from, the test encounters a prompt to sign in on the device, as shown here:
Sign In
I expected Firebase Test Lab for Instrumentation tests to provide a default test Google account, similar to what is available in Robo tests.
(Using Robo tests are not a viable option since the application is built with React Native which limits Robo tests’ ability to interact with many controls)
Including Google credentials in the test to sign in on the Test Lab device does not seem as the proper option. I have not found relevant information or guidelines on handling the Google OAuth flow in Firebase Test Lab Instrumentation Tests in the official documentation or other online resources.
I am seeking advice or established patterns on how to handle this scenario in Firebase Test Lab, or confirmation that the scenario is not possible or advisable.
2
Answers
You can enable googleAuto accounts even in an instrumentation test. This is available in the API:
https://firebase.google.com/docs/test-lab/reference/testing/rest/v1/projects.testMatrices#Account
If you’re using the
gcloud
command-line client, you can use the--auto-google-login
option for this.