@@ -35,104 +35,104 @@ void testDeepLinkIosAppLaunch(
35
35
// await Xcrun.killApp(appBundleId);
36
36
37
37
FlutterDriver ? driver;
38
- addTearDown (() async {
39
- _log.info ("Cleaning up after the test" );
40
- // Dispose the FlutterDriver connection.
41
- driver? .serviceClient.dispose ();
42
-
43
- // Kill the app when we're done.
44
- await Xcrun .killApp (appBundleId);
45
- });
38
+ // addTearDown(() async {
39
+ // _log.info("Cleaning up after the test");
40
+ // // Dispose the FlutterDriver connection.
41
+ // driver?.serviceClient.dispose();
42
+ //
43
+ // // Kill the app when we're done.
44
+ // await Xcrun.killApp(appBundleId);
45
+ // });
46
46
47
47
// Ensure the app isn't running yet.
48
48
_log.info ("Checking if the app is running..." );
49
49
expect (await Xcrun .isAppRunning (appBundleId), isFalse);
50
50
_log.info ("We've verified the app isn't running" );
51
51
52
- // Clear previous logcat messages so we don't try to connect to a previous
53
- // Dart VM service listing.
54
- _log.info ("Clearing old logs" );
55
- await Xcrun .clearLogcat ();
56
- _log.info ("We've cleared old logs" );
57
-
58
- // Listen to iOS logs to find the Dart VM service for the running app.
59
- _log.info ("Registering for simulator logs" );
60
- String ? dartVmService;
61
- await Xcrun .listenToXcrunForFlutterLogs (
62
- appBundleId,
63
- onLog: (log) {
64
- // _log.info(log);
65
- if (log.contains ("Dart VM service" )) {
66
- _log.info ("Found Dart VM log:\n $log " );
67
-
68
- final regex = RegExp (r'.*Dart VM service.*(http[s]?://[^\s]+)' );
69
- final httpUrl = Uri .parse (regex.firstMatch (log)! .group (1 )! );
70
-
71
- dartVmService =
72
- Uri (scheme: "ws" , host: httpUrl.host, port: httpUrl.port, path: "${httpUrl .path }ws" ).toString ();
73
- }
74
- },
75
- onError: (error) {
76
- _log.shout ("iOS ERROR:" );
77
- _log.shout (error);
78
- },
79
- );
80
- _log.info ("We're now listening to logs and errors from iOS" );
81
-
82
- // Send the deep link.
83
- _log.info ("Sending the deep link: $deepLink " );
84
- await Xcrun .launchAppWithUniversalLink (universalLink: deepLink);
85
-
86
- // Wait until the deep link launches the app.
87
- _log.info ("Waiting for app to launch: $appBundleId " );
88
- final isAppRunning = await Xcrun .waitForAppToLaunch (appBundleId);
89
- expect (
90
- isAppRunning,
91
- isTrue,
92
- reason: "The app never launched after sending the deeplink. Package: $appBundleId , Deeplink: $deepLink " ,
93
- );
94
-
95
- // Wait for a moment so that the app has time to start the Dart VM
96
- // service and report it in the device logs.
97
- _log.info ("Waiting a moment so that app can launch the Dart VM service." );
98
- await Future .delayed (const Duration (seconds: 5 ));
99
-
100
- // Ensure that we found the Dart VM service URL.
101
- expect (
102
- dartVmService,
103
- isNotNull,
104
- reason: "Couldn't find the Dart VM service for the app that was launched with a deep link." ,
105
- );
106
- expect (
107
- dartVmService,
108
- isNotEmpty,
109
- reason: "Couldn't find the Dart VM service for the app that was launched with a deep link." ,
110
- );
111
-
112
- // Setup port forwarding between the host machine running the test, and the
113
- // Android device that's running the app, so we can talk to the Dart VM service.
114
- final port = Uri .parse (dartVmService! ).port;
115
- _log.info ("Forwarding simulator port: $port " );
116
- await Xcrun .forwardTcpPort (port);
117
-
118
- // Connect to the Dart VM service in the app with Flutter Driver.
119
- try {
120
- _log.info ("Connecting to Flutter Driver extension in the Dart VM service." );
121
- driver = await FlutterDriver .connect (
122
- dartVmServiceUrl: dartVmService,
123
- );
124
- } catch (exception) {
125
- if (verbose) {
126
- await _logVmDetailsAfterConnectionFailure (dartVmService! );
127
- }
128
-
129
- throw TestFailure (
130
- "Couldn't connect FlutterDriver to the app's Dart VM service (the app successfully launched with the deep link, though)" ,
131
- );
132
- }
133
-
134
- // Run the test.
135
- await testRunner (driver);
52
+ // // Clear previous logcat messages so we don't try to connect to a previous
53
+ // // Dart VM service listing.
54
+ // _log.info("Clearing old logs");
55
+ // await Xcrun.clearLogcat();
56
+ // _log.info("We've cleared old logs");
57
+ //
58
+ // // Listen to iOS logs to find the Dart VM service for the running app.
59
+ // _log.info("Registering for simulator logs");
60
+ // String? dartVmService;
61
+ // await Xcrun.listenToXcrunForFlutterLogs(
62
+ // appBundleId,
63
+ // onLog: (log) {
64
+ // // _log.info(log);
65
+ // if (log.contains("Dart VM service")) {
66
+ // _log.info("Found Dart VM log:\n$log");
67
+ //
68
+ // final regex = RegExp(r'.*Dart VM service.*(http[s]?://[^\s]+)');
69
+ // final httpUrl = Uri.parse(regex.firstMatch(log)!.group(1)!);
70
+ //
71
+ // dartVmService =
72
+ // Uri(scheme: "ws", host: httpUrl.host, port: httpUrl.port, path: "${httpUrl.path}ws").toString();
73
+ // }
74
+ // },
75
+ // onError: (error) {
76
+ // _log.shout("iOS ERROR:");
77
+ // _log.shout(error);
78
+ // },
79
+ // );
80
+ // _log.info("We're now listening to logs and errors from iOS");
81
+ //
82
+ // // Send the deep link.
83
+ // _log.info("Sending the deep link: $deepLink");
84
+ // await Xcrun.launchAppWithUniversalLink(universalLink: deepLink);
85
+ //
86
+ // // Wait until the deep link launches the app.
87
+ // _log.info("Waiting for app to launch: $appBundleId");
88
+ // final isAppRunning = await Xcrun.waitForAppToLaunch(appBundleId);
89
+ // expect(
90
+ // isAppRunning,
91
+ // isTrue,
92
+ // reason: "The app never launched after sending the deeplink. Package: $appBundleId, Deeplink: $deepLink",
93
+ // );
94
+ //
95
+ // // Wait for a moment so that the app has time to start the Dart VM
96
+ // // service and report it in the device logs.
97
+ // _log.info("Waiting a moment so that app can launch the Dart VM service.");
98
+ // await Future.delayed(const Duration(seconds: 5));
99
+ //
100
+ // // Ensure that we found the Dart VM service URL.
101
+ // expect(
102
+ // dartVmService,
103
+ // isNotNull,
104
+ // reason: "Couldn't find the Dart VM service for the app that was launched with a deep link.",
105
+ // );
106
+ // expect(
107
+ // dartVmService,
108
+ // isNotEmpty,
109
+ // reason: "Couldn't find the Dart VM service for the app that was launched with a deep link.",
110
+ // );
111
+ //
112
+ // // Setup port forwarding between the host machine running the test, and the
113
+ // // Android device that's running the app, so we can talk to the Dart VM service.
114
+ // final port = Uri.parse(dartVmService!).port;
115
+ // _log.info("Forwarding simulator port: $port");
116
+ // await Xcrun.forwardTcpPort(port);
117
+ //
118
+ // // Connect to the Dart VM service in the app with Flutter Driver.
119
+ // try {
120
+ // _log.info("Connecting to Flutter Driver extension in the Dart VM service.");
121
+ // driver = await FlutterDriver.connect(
122
+ // dartVmServiceUrl: dartVmService,
123
+ // );
124
+ // } catch (exception) {
125
+ // if (verbose) {
126
+ // await _logVmDetailsAfterConnectionFailure(dartVmService!);
127
+ // }
128
+ //
129
+ // throw TestFailure(
130
+ // "Couldn't connect FlutterDriver to the app's Dart VM service (the app successfully launched with the deep link, though)",
131
+ // );
132
+ // }
133
+ //
134
+ // // Run the test.
135
+ // await testRunner(driver);
136
136
}, timeout: Timeout (timeout));
137
137
}
138
138
0 commit comments