Skip to content

Commit 45f4f55

Browse files
authored
Inspector integration tests are resilient to Flutter framework changes (#9321)
1 parent 318dbcf commit 45f4f55

18 files changed

+484
-116
lines changed

flutter-candidate.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2b6b9d12589875842e64f4b78fd0f11337755aaa
1+
c2ea27002b9c4ab1aff1db6eb1960e4299aca369

packages/devtools_app/test/screens/inspector/inspector_integration_test.dart

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ import '../../test_infra/matchers/matchers.dart';
1717
const inspectorChangeSettleTime = Duration(seconds: 2);
1818

1919
void main() {
20+
const windowSize = Size(2600.0, 1200.0);
2021
// We need to use real async in this test so we need to use this binding.
2122
initializeLiveTestWidgetsFlutterBindingWithAssets();
22-
const windowSize = Size(2600.0, 1200.0);
2323

24-
final env = FlutterTestEnvironment(
25-
const FlutterRunConfiguration(withDebugger: true),
26-
);
24+
late FlutterTestEnvironment env;
2725

28-
env.afterEverySetup = () async {
26+
Future<void> resetInspectorSelection() async {
2927
final service = serviceConnection.inspectorService;
3028
if (env.reuseTestEnvironment) {
3129
// Ensure the previous test did not set the selection on the device.
@@ -37,19 +35,26 @@ void main() {
3735
isAlive: null,
3836
);
3937
}
40-
};
38+
}
4139

42-
setUp(() async {
43-
await env.setupEnvironment();
44-
// Ensure the legacy inspector is enabled:
45-
preferences.inspector.setLegacyInspectorEnabled(true);
46-
});
40+
group('screenshot tests', () {
41+
setUpAll(() {
42+
env = FlutterTestEnvironment(
43+
const FlutterRunConfiguration(withDebugger: true),
44+
);
45+
env.afterEverySetup = resetInspectorSelection;
46+
});
4747

48-
tearDownAll(() async {
49-
await env.tearDownEnvironment(force: true);
50-
});
48+
setUp(() async {
49+
await env.setupEnvironment();
50+
// Ensure the legacy inspector is enabled:
51+
preferences.inspector.setLegacyInspectorEnabled(true);
52+
});
53+
54+
tearDownAll(() async {
55+
await env.tearDownEnvironment(force: true);
56+
});
5157

52-
group('screenshot tests', () {
5358
testWidgetsWithWindowSize('navigation', windowSize, (
5459
WidgetTester tester,
5560
) async {
@@ -99,6 +104,9 @@ void main() {
99104
matchesDevToolsGolden(
100105
'../../test_infra/goldens/integration_inspector_select_center_details_tree.png',
101106
),
107+
// Implementation widgets from Flutter framework are not guaranteed to
108+
// be stable.
109+
skip: 'https://github.com/flutter/flutter/issues/172037',
102110
);
103111

104112
// Select the RichText row.
@@ -109,6 +117,9 @@ void main() {
109117
matchesDevToolsGolden(
110118
'../../test_infra/goldens/integration_inspector_richtext_selected.png',
111119
),
120+
// Implementation widgets from Flutter framework are not guaranteed to
121+
// be stable.
122+
skip: 'https://github.com/flutter/flutter/issues/172037',
112123
);
113124

114125
// Test hovering over the icon shown when a property has its default
@@ -131,6 +142,9 @@ void main() {
131142
matchesDevToolsGolden(
132143
'../../test_infra/goldens/integration_inspector_scaffold_selected.png',
133144
),
145+
// Implementation widgets from Flutter framework are not guaranteed to
146+
// be stable.
147+
skip: 'https://github.com/flutter/flutter/issues/172037',
134148
);
135149

136150
// The important thing about this is that the details tree should scroll
@@ -143,6 +157,9 @@ void main() {
143157
matchesDevToolsGolden(
144158
'../../test_infra/goldens/integration_animated_physical_model_selected.png',
145159
),
160+
// Implementation widgets from Flutter framework are not guaranteed to
161+
// be stable.
162+
skip: 'https://github.com/flutter/flutter/issues/172037',
146163
);
147164

148165
await env.tearDownEnvironment();
@@ -401,15 +418,25 @@ void main() {
401418
});
402419

403420
group('widget errors', () {
404-
testWidgetsWithWindowSize('show navigator and error labels', windowSize, (
405-
WidgetTester tester,
406-
) async {
421+
setUpAll(() async {
422+
env = FlutterTestEnvironment(
423+
testAppDirectory: 'test/test_infra/fixtures/inspector_app',
424+
const FlutterRunConfiguration(withDebugger: true),
425+
);
407426
await env.setupEnvironment(
408427
config: const FlutterRunConfiguration(
409428
withDebugger: true,
410429
entryScript: 'lib/overflow_errors.dart',
411430
),
412431
);
432+
env.afterEverySetup = resetInspectorSelection;
433+
// Enable the legacy inspector.
434+
preferences.inspector.setLegacyInspectorEnabled(true);
435+
});
436+
437+
testWidgetsWithWindowSize('show navigator and error labels', windowSize, (
438+
WidgetTester tester,
439+
) async {
413440
expect(serviceConnection.serviceManager.service, equals(env.service));
414441
expect(serviceConnection.serviceManager.isolateManager, isNotNull);
415442

0 commit comments

Comments
 (0)