I have problem with Patrol while running integration test in Flutter. I need to accept some permissions and I want to use to this purpose Petrol package.But in terminal there is an error which seems like this:
Patrol (native): configure() started
Patrol (native): configure() failed
Patrol (native): configure() failed: (GrpcError: configure() failed with code UNAVAILABLE (Error connecting: SocketException: Connection refused (OS Error: Connection refused, errno = 111), address = localhost, port = 53108))
Patrol (native): trying to configure() again in 1 second
Here is my code, in which I initialize NativeAutomator.
void main() async {
final IntegrationTestWidgetsFlutterBinding binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Firebase.initializeApp();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
final automator = NativeAutomator(
config: NativeAutomatorConfig(
packageName: 'my.app.android.id',
bundleId: 'my.app.ios.id',
),
);
await automator.configure();
testWidgets('Log Out', (WidgetTester tester) async {
await SharedPreferencesHelper.clear();
await tester.pumpWidget(const MyApp());
await tester.pumpAndSettle();
await Future<void>.delayed(const Duration(seconds: 15));
await TestHelper.delayUntil(
tester,
find.byType(LoginBody),
);
await Future<void>.delayed(const Duration(seconds: 3));
await tester.enterText(
Consts.email,
);
await delayUI();
await tester.pumpAndSettle();
await tester.enterText(
Consts.password,
);
await delayUI();
await tester.tap(find.byType(Button));
await tester.pumpAndSettle();
await Future<void>.delayed(const Duration(seconds: 5));
automator.grantPermissionOnlyThisTime();
await Future<void>.delayed(const Duration(seconds: 5));
expect(find.byType(LoginBody), findsOneWidget);
});
}
Thanks in advance for help :)
You can Not Use patrol in widget test You have to use patrolTest and patrol_cli and command would be :
eg: