Files
platforms/apps/user_app/test/ui/wallet_page_test.dart
czl231 3ef33b531d 已完成用户APP首期功能开发
交付用户端首期页面、配套接口、后台资源及测试文档。用户APP构建、静态分析和三个管理后台构建通过;完整测试仍有2项失败,后端模型注释检查未通过,详见交付记录。
2026-09-13 00:57:32 +08:00

52 lines
2.0 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.
// 功能描述钱包隐私开关、真实空错状态、账单筛选和详情版本1.0.0。
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:user_app/ui/core/app_theme.dart';
import 'package:user_app/ui/features/wallet/wallet_page.dart';
import 'package:user_app/ui/features/wallet/wallet_bills_page.dart';
import '../support/a1_fixture.dart';
void main() {
testWidgets('金额隐藏覆盖余额与最近账单,账单失败可独立重试', (tester) async {
final repo = A1FixtureRepository()..fail = true;
await tester.pumpWidget(
MaterialApp(
theme: AppTheme.light(),
home: WalletPage(repository: repo),
),
);
await tester.pumpAndSettle();
expect(find.text('¥568.00'), findsOneWidget);
await tester.tap(find.byTooltip('隐藏金额'));
await tester.pumpAndSettle();
expect(find.text('¥568.00'), findsNothing);
await tester.scrollUntilVisible(
find.text('账单加载失败,点击重试'),
250,
scrollable: find.byType(Scrollable).first,
);
await tester.pumpAndSettle();
repo.fail = false;
await tester.tap(find.text('账单加载失败,点击重试'));
await tester.pumpAndSettle();
expect(find.text('-¥228.00'), findsNothing);
expect(find.text('气瓶订单'), findsOneWidget);
});
testWidgets('账单筛选只显示对应方向并能查看记账详情', (tester) async {
await tester.pumpWidget(
MaterialApp(
theme: AppTheme.light(),
home: WalletBillsPage(repository: A1FixtureRepository()),
),
);
await tester.pumpAndSettle();
await tester.tap(find.text('收入'));
await tester.pumpAndSettle();
expect(find.text('气瓶订单'), findsNothing);
expect(find.text('+¥59.00'), findsOneWidget);
await tester.tap(find.text('退款入账'));
await tester.pumpAndSettle();
expect(find.text('记账后余额¥568.00'), findsOneWidget);
});
}