Skip to content

Commit 1047069

Browse files
Copilotjwinarske
andcommitted
Fix failing test by handling async operations properly
Wrap the widget test in runAsync() to properly handle the pending Timer created by Process.run calls in FlatpakService.loadApps(). The test now waits for async operations to complete before finishing, preventing the "Timer is still pending" error. Co-authored-by: jwinarske <[email protected]>
1 parent 2df18b6 commit 1047069

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/widget_test.dart

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,19 @@ import 'package:flutter_flatseal/models/permission.dart';
66
void main() {
77
group('FlatsealApp', () {
88
testWidgets('App launches successfully', (WidgetTester tester) async {
9-
await tester.pumpWidget(const FlatsealApp());
10-
expect(find.text('Flutter Flatseal'), findsOneWidget);
9+
await tester.runAsync(() async {
10+
await tester.pumpWidget(const FlatsealApp());
11+
expect(find.text('Flutter Flatseal'), findsOneWidget);
12+
13+
// Pump a frame to trigger the post-frame callback
14+
await tester.pump();
15+
16+
// Allow some time for async operations to complete
17+
await Future.delayed(const Duration(milliseconds: 100));
18+
19+
// Pump again to process any state changes
20+
await tester.pump();
21+
});
1122
});
1223
});
1324

0 commit comments

Comments
 (0)