Files
eryao/apps/test/features/divination/divination_result_screen_test.dart
T

53 lines
1.9 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meeyao_qianwen/app/app_theme.dart';
import 'package:meeyao_qianwen/features/divination/data/models/divination_params.dart';
import 'package:meeyao_qianwen/features/divination/data/services/divination_result_builder.dart';
import 'package:meeyao_qianwen/features/divination/presentation/screens/divination_result_screen.dart';
void main() {
testWidgets('result screen shows key sections', (tester) async {
final params = DivinationMockData.initial().copyWith(
method: DivinationMethod.auto,
questionType: QuestionType.health,
question: '近期状态是否平稳',
);
final data = DivinationResultBuilder().build(
params: params,
yaoStates: const [
YaoType.oldYin,
YaoType.youngYang,
YaoType.youngYin,
YaoType.oldYang,
YaoType.youngYang,
YaoType.oldYin,
],
);
await tester.pumpWidget(
MaterialApp(
theme: AppTheme.light(),
home: DivinationResultScreen(data: data),
),
);
await tester.pump();
expect(find.text('天机推演中'), findsOneWidget);
await tester.pump(const Duration(milliseconds: 450));
expect(find.text('正在解卦'), findsOneWidget);
await tester.pump(const Duration(milliseconds: 850));
expect(find.text('解卦完成\n点击查看'), findsOneWidget);
expect(find.text('解卦结果'), findsOneWidget);
expect(find.text('AI解卦'), findsOneWidget);
expect(find.text('基础信息'), findsOneWidget);
expect(find.text('卦象详情'), findsOneWidget);
expect(find.text('解卦结论'), findsOneWidget);
expect(find.text('○ 老阳(变)'), findsOneWidget);
expect(find.text('× 老阴(变)'), findsOneWidget);
expect(find.text(''), findsWidgets);
expect(find.text('×'), findsWidgets);
});
}