refactor(page): 删除旧版页面文件
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
// This is a basic Flutter widget test.
|
||||
// 应用启动烟雾测试。
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
// 验证 CupertinoApp.router + ProviderScope + GoRouter 能正常构建并渲染首屏。
|
||||
// 重构后入口为 buildApp(buildAppRouter()),不再存在默认模板的 MyApp / Counter。
|
||||
//
|
||||
// 注意:TokenStorage 依赖 MMKV,需在测试环境先 initialize(真实运行在 main 中完成)。
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:ttstd_family_care/main.dart';
|
||||
import 'package:ttstd_family_care/app/app.dart';
|
||||
import 'package:ttstd_family_care/app/router/app_router.dart';
|
||||
import 'package:ttstd_family_care/core/storage/token_storage.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
setUpAll(() async {
|
||||
// 初始化 MMKV,避免启动页路由决策时访问未就绪的存储。
|
||||
await TokenStorage.initialize();
|
||||
});
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
testWidgets('应用可正常构建并渲染首屏', (tester) async {
|
||||
// 构建真实应用根组件(ProviderScope + CupertinoApp.router)。
|
||||
await tester.pumpWidget(buildApp(buildAppRouter()));
|
||||
// 等待启动页 2s 路由决策定时器与导航动画完成。
|
||||
await tester.pumpAndSettle(const Duration(seconds: 5));
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
// 应用根组件成功挂载(整棵组件树的根始终为 CupertinoApp)。
|
||||
expect(find.byType(CupertinoApp), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user