Skip to content

Commit 22a71c3

Browse files
authored
Migrate ios driver tests batch 2 to simulators (flutter#190930)
Part of flutter#186414 This batch migrates 3 Devicelab tests to the simulator and deletes 1 obsolete driver test: * `channels_integration_test_ios` * `platform_interaction_test_ios` * `ios_platform_view_tests (Deleted)` * `route_test_ios` Changes: - Moved targets from `Mac_ios` to `Mac` (Simulator) with `bringup: true` and injected `ruby` dependency. - Changed tags to `hostonly`. - Wrapped Devicelab tasks with `testWithNewIOSSimulator`. - Migrated `platform_interaction`, and `ui integration test apps` to use `UIScene` lifecycle - Skipped `channels_integration_test_ios` AppDelegate migration intentionally, as it exists to test backwards compatibility. Updates based on triage review: * Deleted the ios_platform_view_tests driver test entirely (task, CI config, and driver script) because the engine thread-merge architecture it tested is no longer present. * Cleaned the dev/integration_tests/ios_platform_view_tests project app by removing flutter_driver dependencies and deprecated thread-merge UI buttons. Note: The project itself is kept as it is still used by the physical device `native_platform_view_ui_tests_ios` XCUITest runner.
1 parent 92dda37 commit 22a71c3

14 files changed

Lines changed: 133 additions & 174 deletions

File tree

‎.ci.yaml‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5347,14 +5347,17 @@ targets:
53475347
["devicelab", "ios", "mac"]
53485348
task_name: basic_material_app_ios__compile
53495349

5350-
- name: Mac_ios channels_integration_test_ios
5350+
- name: Mac channels_integration_test_ios
53515351
recipe: devicelab/devicelab_drone
5352+
bringup: true
53525353
presubmit: false
53535354
timeout: 60
53545355
properties:
53555356
tags: >
5356-
["devicelab", "ios", "mac"]
5357+
["devicelab", "hostonly", "mac"]
53575358
task_name: channels_integration_test_ios
5359+
dependencies: >-
5360+
[{"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}]
53585361
53595362
- name: Mac_ios complex_layout_ios__start_up
53605363
recipe: devicelab/devicelab_drone
@@ -5418,14 +5421,17 @@ targets:
54185421
task_name: external_textures_integration_test_ios
54195422
ignore_flakiness: "true"
54205423

5421-
- name: Mac_ios route_test_ios
5424+
- name: Mac route_test_ios
54225425
recipe: devicelab/devicelab_drone
5426+
bringup: true
54235427
presubmit: false
54245428
timeout: 60
54255429
properties:
54265430
tags: >
5427-
["devicelab", "ios", "mac"]
5431+
["devicelab", "hostonly", "mac"]
54285432
task_name: route_test_ios
5433+
dependencies: >-
5434+
[{"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}]
54295435
54305436
- name: Mac flavors_test_ios
54315437
recipe: devicelab/devicelab_drone
@@ -5656,15 +5662,6 @@ targets:
56565662
["devicelab", "ios", "mac"]
56575663
task_name: hello_world_impeller_ios_sdfs
56585664

5659-
- name: Mac_ios ios_platform_view_tests
5660-
recipe: devicelab/devicelab_drone
5661-
presubmit: false
5662-
timeout: 60
5663-
properties:
5664-
tags: >
5665-
["devicelab", "ios", "mac"]
5666-
task_name: ios_platform_view_tests
5667-
56685665
- name: Mac_ios large_image_changer_perf_ios
56695666
recipe: devicelab/devicelab_drone
56705667
presubmit: false
@@ -5796,14 +5793,17 @@ targets:
57965793
["devicelab", "ios", "mac"]
57975794
task_name: platform_channels_benchmarks_ios
57985795

5799-
- name: Mac_ios platform_interaction_test_ios
5796+
- name: Mac platform_interaction_test_ios
58005797
recipe: devicelab/devicelab_drone
5798+
bringup: true
58015799
presubmit: false
58025800
timeout: 60
58035801
properties:
58045802
tags: >
5805-
["devicelab", "ios", "mac"]
5803+
["devicelab", "hostonly", "mac"]
58065804
task_name: platform_interaction_test_ios
5805+
dependencies: >-
5806+
[{"dependency": "ruby", "version": "ruby_3.1-pod_1.13"}]
58075807
58085808
- name: Mac_ios platform_view_ios__start_up
58095809
recipe: devicelab/devicelab_drone

‎TESTOWNERS‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@
213213
/dev/devicelab/bin/tasks/ios_app_with_extensions_test.dart @hellohuanlin @flutter/tool
214214
/dev/devicelab/bin/tasks/ios_defines_test.dart @vashworth @flutter/tool
215215
/dev/devicelab/bin/tasks/ios_picture_cache_complexity_scoring_perf__timeline_summary.dart @flar @flutter/engine
216-
/dev/devicelab/bin/tasks/ios_platform_view_tests.dart @stuartmorgan-g @flutter/plugin
217216
/dev/devicelab/bin/tasks/keyboard_hot_restart_ios.dart @loic-sharma @flutter/ios
218217
/dev/devicelab/bin/tasks/large_image_changer_perf_ios.dart @jtmcdole @flutter/engine
219218
/dev/devicelab/bin/tasks/microbenchmarks_ios.dart @louisehsu @flutter/engine

‎dev/devicelab/bin/tasks/channels_integration_test_ios.dart‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,25 @@
44

55
import 'package:flutter_devicelab/framework/devices.dart';
66
import 'package:flutter_devicelab/framework/framework.dart';
7+
import 'package:flutter_devicelab/framework/ios.dart';
8+
import 'package:flutter_devicelab/framework/task_result.dart';
79
import 'package:flutter_devicelab/tasks/integration_tests.dart';
810

911
Future<void> main() async {
1012
deviceOperatingSystem = DeviceOperatingSystem.ios;
11-
await task(createChannelsIntegrationTest());
13+
await task(() async {
14+
String? simulatorDeviceId;
15+
TaskResult? result;
16+
try {
17+
await testWithNewIOSSimulator('channels_integration_test_ios', (String deviceId) async {
18+
simulatorDeviceId = deviceId;
19+
result = await createChannelsIntegrationTest(deviceIdOverride: deviceId).call();
20+
});
21+
} finally {
22+
if (simulatorDeviceId != null) {
23+
await removeIOSSimulator(simulatorDeviceId);
24+
}
25+
}
26+
return result ?? TaskResult.failure('Simulator creation failed');
27+
});
1228
}

‎dev/devicelab/bin/tasks/ios_platform_view_tests.dart‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎dev/devicelab/bin/tasks/platform_interaction_test_ios.dart‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,25 @@
44

55
import 'package:flutter_devicelab/framework/devices.dart';
66
import 'package:flutter_devicelab/framework/framework.dart';
7+
import 'package:flutter_devicelab/framework/ios.dart';
8+
import 'package:flutter_devicelab/framework/task_result.dart';
79
import 'package:flutter_devicelab/tasks/integration_tests.dart';
810

911
Future<void> main() async {
1012
deviceOperatingSystem = DeviceOperatingSystem.ios;
11-
await task(createPlatformInteractionTest());
13+
await task(() async {
14+
String? simulatorDeviceId;
15+
TaskResult? result;
16+
try {
17+
await testWithNewIOSSimulator('platform_interaction_test_ios', (String deviceId) async {
18+
simulatorDeviceId = deviceId;
19+
result = await createPlatformInteractionTest(deviceIdOverride: deviceId).call();
20+
});
21+
} finally {
22+
if (simulatorDeviceId != null) {
23+
await removeIOSSimulator(simulatorDeviceId);
24+
}
25+
}
26+
return result ?? TaskResult.failure('Simulator creation failed');
27+
});
1228
}

‎dev/devicelab/bin/tasks/route_test_ios.dart‎

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,38 @@ import 'dart:io';
66

77
import 'package:flutter_devicelab/framework/devices.dart';
88
import 'package:flutter_devicelab/framework/framework.dart';
9+
import 'package:flutter_devicelab/framework/ios.dart';
910
import 'package:flutter_devicelab/framework/task_result.dart';
1011
import 'package:flutter_devicelab/framework/utils.dart';
1112
import 'package:path/path.dart' as path;
1213

1314
void main() {
15+
deviceOperatingSystem = DeviceOperatingSystem.ios;
1416
task(() async {
15-
deviceOperatingSystem = DeviceOperatingSystem.ios;
16-
final Device device = await devices.workingDevice;
17-
await device.unlock();
18-
final Directory appDir = dir(path.join(flutterDirectory.path, 'dev/integration_tests/ui'));
19-
section('TEST WHETHER `flutter drive --route` WORKS on IOS');
20-
await inDirectory(appDir, () async {
21-
return flutter(
22-
'drive',
23-
options: <String>['-d', device.deviceId, '--route', '/smuggle-it', 'lib/route.dart'],
24-
);
25-
});
26-
return TaskResult.success(null);
17+
String? simulatorDeviceId;
18+
TaskResult? result;
19+
try {
20+
await testWithNewIOSSimulator('route_test_ios', (String deviceId) async {
21+
simulatorDeviceId = deviceId;
22+
final Directory appDir = dir(path.join(flutterDirectory.path, 'dev/integration_tests/ui'));
23+
section('TEST WHETHER `flutter drive --route` WORKS on IOS');
24+
await inDirectory(appDir, () async {
25+
final int exitCode = await flutter(
26+
'drive',
27+
options: <String>['-d', deviceId, '--route', '/smuggle-it', 'lib/route.dart'],
28+
);
29+
if (exitCode != 0) {
30+
result = TaskResult.failure('Flutter drive failed with exit code $exitCode');
31+
} else {
32+
result = TaskResult.success(null);
33+
}
34+
});
35+
});
36+
} finally {
37+
if (simulatorDeviceId != null) {
38+
await removeIOSSimulator(simulatorDeviceId);
39+
}
40+
}
41+
return result ?? TaskResult.failure('Simulator creation failed');
2742
});
2843
}

‎dev/devicelab/lib/tasks/integration_tests.dart‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ import '../framework/talkback.dart' hide adbPath;
88
import '../framework/task_result.dart';
99
import '../framework/utils.dart';
1010

11-
TaskFunction createChannelsIntegrationTest() {
11+
TaskFunction createChannelsIntegrationTest({String? deviceIdOverride}) {
1212
return IntegrationTest(
1313
'${flutterDirectory.path}/dev/integration_tests/channels',
1414
'integration_test/main_test.dart',
15+
deviceIdOverride: deviceIdOverride,
1516
).call;
1617
}
1718

18-
TaskFunction createPlatformInteractionTest() {
19+
TaskFunction createPlatformInteractionTest({String? deviceIdOverride}) {
1920
return DriverTest(
2021
'${flutterDirectory.path}/dev/integration_tests/platform_interaction',
2122
'lib/main.dart',
23+
deviceIdOverride: deviceIdOverride,
2224
).call;
2325
}
2426

@@ -90,14 +92,6 @@ TaskFunction createAndroidSemanticsIntegrationTest() {
9092
).call;
9193
}
9294

93-
TaskFunction createIOSPlatformViewTests() {
94-
return DriverTest(
95-
'${flutterDirectory.path}/dev/integration_tests/ios_platform_view_tests',
96-
'lib/main.dart',
97-
extraOptions: <String>['--dart-define=ENABLE_DRIVER_EXTENSION=true'],
98-
).call;
99-
}
100-
10195
TaskFunction createEndToEndKeyboardTest({String? deviceIdOverride}) {
10296
return DriverTest(
10397
'${flutterDirectory.path}/dev/integration_tests/ui',

‎dev/integration_tests/ios_platform_view_tests/lib/main.dart‎

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,8 @@
44

55
import 'package:flutter/material.dart';
66
import 'package:flutter/services.dart';
7-
import 'package:flutter_driver/driver_extension.dart';
87

98
void main() {
10-
// enableFlutterDriverExtension() will disable keyboard,
11-
// which is required for flutter_driver tests
12-
// But breaks the XCUITests
13-
if (const bool.fromEnvironment('ENABLE_DRIVER_EXTENSION')) {
14-
enableFlutterDriverExtension();
15-
}
169
runApp(const MyApp());
1710
}
1811

@@ -48,24 +41,6 @@ class _MyHomePageState extends State<MyHomePage> {
4841
appBar: AppBar(title: Text(widget.title ?? '')),
4942
body: Column(
5043
children: <Widget>[
51-
TextButton(
52-
key: const ValueKey<String>('platform_view_button'),
53-
child: const Text('show platform view'),
54-
onPressed: () {
55-
Navigator.push(
56-
context,
57-
MaterialPageRoute<MergeThreadTestPage>(
58-
builder: (BuildContext context) => const MergeThreadTestPage(),
59-
),
60-
);
61-
},
62-
),
63-
// Push this button to perform an animation, which ensure the threads are unmerged after the animation.
64-
ElevatedButton(
65-
key: const ValueKey<String>('unmerge_button'),
66-
child: const Text('Tap to unmerge threads'),
67-
onPressed: () {},
68-
),
6944
TextButton(
7045
key: const ValueKey<String>('platform_view_focus_test'),
7146
child: const Text('platform view focus test'),
@@ -133,28 +108,6 @@ class _MyHomePageState extends State<MyHomePage> {
133108
}
134109
}
135110

136-
/// A page to test thread merge for platform view.
137-
class MergeThreadTestPage extends StatelessWidget {
138-
const MergeThreadTestPage({super.key});
139-
140-
static Key button = const ValueKey<String>('plus_button');
141-
142-
@override
143-
Widget build(BuildContext context) {
144-
return Scaffold(
145-
appBar: AppBar(title: const Text('Platform View Thread Merge Tests')),
146-
body: Column(
147-
children: <Widget>[
148-
const Expanded(
149-
child: SizedBox(width: 300, child: UiKitView(viewType: 'platform_view')),
150-
),
151-
ElevatedButton(key: button, child: const Text('button'), onPressed: () {}),
152-
],
153-
),
154-
);
155-
}
156-
}
157-
158111
/// A page to test platform view focus.
159112
class FocusTestPage extends StatefulWidget {
160113
const FocusTestPage({super.key});

‎dev/integration_tests/ios_platform_view_tests/pubspec.yaml‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ resolution: workspace
1010
dependencies:
1111
flutter:
1212
sdk: flutter
13-
flutter_driver:
14-
sdk: flutter
1513

1614

1715
dev_dependencies:
1816
flutter_test:
1917
sdk: flutter
20-
test: any
2118

2219

2320
flutter:
@@ -27,4 +24,4 @@ flutter:
2724
# the material Icons class.
2825
uses-material-design: true
2926

30-
# PUBSPEC CHECKSUM: dgjojg
27+
# PUBSPEC CHECKSUM: 60tfp7

‎dev/integration_tests/ios_platform_view_tests/test_driver/main_test.dart‎

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)