Skip to content

Commit 7b724e0

Browse files
committed
Attempt to fix memory screen goldens
1 parent 851a577 commit 7b724e0

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

packages/devtools_app/test/screens/memory/framework/memory_screen_test.dart

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,23 @@ void main() {
6363
}
6464

6565
Future<void> pumpMemoryScreen(WidgetTester tester) async {
66-
await tester.pumpWidget(
67-
wrapWithControllers(const MemoryScreenBody(), memory: controller),
68-
);
66+
await tester.runAsync(() async {
67+
await tester.pumpWidget(
68+
wrapWithControllers(const MemoryScreenBody(), memory: controller),
69+
);
6970

70-
// Delay to ensure the memory profiler has collected data.
71-
await tester.runAsync(
72-
() async => await tester.pumpAndSettle(const Duration(seconds: 2)),
73-
);
71+
// Current workaround for flaky image asset testing.
72+
// See: https://github.com/flutter/flutter/issues/38997
73+
for (final element in find.byType(Image).evaluate()) {
74+
final widget = element.widget as Image;
75+
final image = widget.image;
76+
await precacheImage(image, element);
77+
await tester.pumpAndSettle();
78+
}
79+
80+
// Delay to ensure the memory profiler has collected data.
81+
await tester.pumpAndSettle(const Duration(seconds: 2));
82+
});
7483
expect(find.byType(MemoryScreenBody), findsOneWidget);
7584
}
7685

0 commit comments

Comments
 (0)