Sevastyan Savanyuk
Sevastyan Savanyuk

Reputation: 6315

How to prevent Firebase Test Lab from granting all apps permissions?

I'm running end-to-end tests on my Flutter app's Android version using the Patrol package. When I run these tests locally, the app requests permissions from the user (specifically for Bluetooth and notifications), and I have UI interactions based on these permission prompts.

However, when I run the same tests in Firebase Test Lab, it appears that all permissions are automatically granted, bypassing the usual user prompt flow.

My goal is to either:

  1. Prevent Firebase Test Lab from auto-granting permissions, so the app behaves as it would in a standard environment.
  2. Detect within my Patrol test code if the tests are being run in Firebase Test Lab, so I can adjust my UI checks accordingly.

Is there a way to control or check Firebase Test Lab's permission behavior, or programmatically identify that the tests are running in this environment? Any guidance or workarounds would be appreciated!

I can work around the problem with test tags, but I don't want to get to that.

Upvotes: 0

Views: 29

Answers (1)

Sevastyan Savanyuk
Sevastyan Savanyuk

Reputation: 6315

There seems to be no Firebase Test Lab set envrionment variables, so I set my own with

patrol build android --dart-define=IS_FIREBASE_TEST_LAB=true

when building the Android deliverables for testing. Then, that variable is available to the patrol test code and the app code.

Upvotes: 0

Related Questions