Files
English/kouyu_english/test/support/app_assets.dart
T

19 lines
751 B
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:kouyu_english/main.dart';
/// Pumps the whole app and lets `AppState.load` finish. The load reads the
/// course packs and the AI config from the asset bundle, which is real file
/// I/O that fake time never completes, so the test waits for it in real time
/// until the loading spinner is gone.
Future<void> pumpLoadedApp(WidgetTester tester) async {
await tester.pumpWidget(const KouyuEnglishApp());
for (var i = 0; i < 100; i++) {
if (find.byType(CircularProgressIndicator).evaluate().isEmpty) break;
await tester.runAsync(
() => Future<void>.delayed(const Duration(milliseconds: 20)),
);
await tester.pump();
}
}