firebase / FirebaseUI-Android

Optimized UI components for Firebase
https://firebaseopensource.com/projects/firebase/firebaseui-android/
Apache License 2.0
4.63k stars 1.84k forks source link

unable to use Firebase UI with Firebase Test Lab #923

Open LeeHounshell opened 7 years ago

LeeHounshell commented 7 years ago

The current Firebase UI version 2.3.0 does not work with Firebase "Test Lab" sign-in credentials.

The Google Play Console allows developers to upload Alpha and Beta app versions. These versions can be automatically checked (for free) using Firebase Test Lab. However, the current Firebase UI version does not expose UI elements that allow Test Lab to automatically login to an app. This prevents developers from obtaining test results from beyond the login pages.

Please allow Firebase UI to work seamlessly with Firebase Test Lab using the Google Play Console's "pre launch report" configuration.

SUPERCILEX commented 7 years ago

@LeeHounshell Here's how I've gotten around that restriction:

val signInIntent: Intent get() = AuthUI.getInstance().createSignInIntentBuilder()
        .setAvailableProviders(
                if (isInTestMode) listOf(AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build())
                else ALL_PROVIDERS)
        // ...
        .build()

val isInTestMode: Boolean by lazy {
    Settings.System.getString(RobotScouter.INSTANCE.contentResolver, "firebase.test.lab") == "true"
}
WillieCubed commented 7 years ago

Perhaps we should include this information in the docs.

gswierczynski commented 7 years ago

The new crawler introduced in October 2017 (described as one that "provides a more comprehensive review of your app") re-signs the app making Google Account login fail. To use google account login one need to fallback to the previous crawler by opting out in the settings. https://support.google.com/googleplay/android-developer/answer/7002270

You can use the new crawler by providing the login resource names in the console's settings (Pre-launch report -> Settings tab). I tried this:

But it is not reliable for some reason. From what I saw in the recoreded sessions sometimes even though the email is provided clicking 'button_next' navigates to sign up screen instead of password prompt (even though the account does exist). It does not seem to be API dependant (it succeedes on one device and fails on another with the same Android version).

EDIT: Link to firebase doc page describing how to detect that app is running on test lab: https://firebase.google.com/docs/test-lab/android-studio#modify_instrumented_test_behavior_for_testlab

NishaShinde commented 4 years ago

Hi, I am also facing this same issue with the firebase-ui auth library. It is always failing to sign in.

@SUPERCILEX I am developing the app in Java, do you know a workaround for this?

If anyone knows how to deal with it please help!

Thanks!

ArcherEmiya05 commented 2 years ago

If you are uploading your app on Test Lab via GCloud CLI there is now a option --no-resign. This way Test Lab won't overwrite your app signing which likely is the issue here. You can also create test account on Firebase console for Firebase Auth UI cases.