I’m trying to run an end to end test on my device thus I have to ask permission to access position through adb
When I run the command from a terminal it’s working as expected but when dart:io is executing it throw this exception (and it’s the same for every adb commands)
Enviroment :
- MacOs
- Android Studio
Code :
void main() {
group('Testing full app flow', () {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
setUpAll(() async {
await Process.run('adb' , ['shell' ,'pm', 'grant', 'com.MYSERVICE', 'android.permission.ACCESS_FINE_LOCATION']);
});
testWidgets('test the password input on real device/emulator', (tester) async {
//TESTS
});
});
}
2
Answers
I figured out how to make it properly : Now the adb commands needs to be in the driver because the test is running on the device (and it obviously cant adb itself)
it should be something like that :
as described here : https://github.com/flutter/flutter/issues/12561
I did not made it on iOS for the moment but will update later
PS : the run command is still :
flutter drive
--driver=integration_test/driver.dart
--target=integration_test/app_test.dart
-d DEVICE
But Flutter_blue still consider the Bluetooth disabled
Try with superuser: