How to grant permissions to android when running integration tests on mac?

Viewed 260

I am trying to run integration tests on android emulator, I am using Mac.

Using xcrun simctl command it's working fine on iOS emulators.

To grant permission on Android emulator I added adb to the path and added the command to a .sh file, but adb shell commands are not working, permissions are stil being asked.

adb was added to the path

integration_test.sh

  # for tablet iPad Pro 9.7 inch
  # xcrun simctl privacy 33FCDA0F-76BB-412B-A99B-FDD0F423A9B9 grant location-always br.com.xxx.app

  # for iphone
  # xcrun simctl privacy EED25E77-2BC6-4FB1-9061-FC8F7E57B0B4 grant location-always br.com.xxx.app

  # for android
  adb shell pm grant br.com.xxx.app android.permission.WRITE_EXTERNAL_STORAGE
  adb shell pm grant br.com.xxx.app android.permission.READ_EXTERNAL_STORAGE
  adb shell pm grant br.com.xxx.app android.permission.CAMERA
  adb shell pm grant br.com.xxx.app android.permission.ACCESS_FINE_LOCATION
  adb shell pm grant br.com.xxx.app android.permission.ACCESS_COARSE_LOCATION
  adb shell pm grant br.com.xxx.app android.permission.ACCESS_BACKGROUND_LOCATION

  # Launch integration test
  flutter drive \
    --driver=integration_test/driver.dart \
    --target=integration_test/app_test.dart
0 Answers
Related