Opening deep link in integration test in Flutter

Viewed 239

I'm trying to run an integration test which is highly dependent on the user clicking a magic link he got in his email. So far I failed to find a way of doing that. I came across Process.run but it seems like it should be run before the integration test starts and I need to do it during the test.

Any help with either iOS or Android will be highly appreciated.

This is the code I tried so far to work on iOS but Process.run ends with ProcessException: No such file or directory:

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  testWidgets('login test', (WidgetTester tester) async {
    app_sandbox.main();
    await tester.pumpAndSettle(Duration(seconds: 5));
    expect(find.text('foo'), findsOneWidget);
    await Process.run('xcrun', [
      'simctl',
      'openurl',
      '7D6DEC47-C1E2-4F18-A38B-7B4C17558172',
      'https://myDeepLink/sign-in',
    ]);
    await tester.pumpAndSettle();
  });
}
1 Answers

this might only work with flutter_driver

     await Process.run('xcrun', [
        'simctl',
        'openurl',
        'booted',
        'https://myDeepLink/sign-in'
      ]).then((result) {
        stdout.write(result.stdout);
        stderr.write(result.stderr);
      });

not with testWidgets of integration_test

there I got this error:

> Error occured: DriverError: Failed to fulfill RequestData due to
> remote error Original error: ext.flutter.driver: (112) Service has
> disappeared Original stack trace:
> #0      new _OutstandingRequest (package:vm_service/src/vm_service.dart:1746:45)
> #1      VmService._call (package:vm_service/src/vm_service.dart:2262:21)
> #2      VmService.callServiceExtension (package:vm_service/src/vm_service.dart:2233:14)
> #3      VMServiceFlutterDriver.sendCommand (package:flutter_driver/src/driver/vmservice_driver.dart:306:66)
> #4      FlutterDriver.requestData (package:flutter_driver/src/driver/driver.dart:522:45)
> #5      integrationDriver (package:integration_test/integration_test_driver_extended.dart:51:38)
> <asynchronous suspension>
Related