Files
conti-retail-app/app/integration_test/app_test.dart
T

34 lines
1.6 KiB
Dart
Raw Normal View History

2026-08-17 15:29:55 +08:00
// 端到端骨架。来源:conti-docs/09-testing-strategy.md §集成测试。
//
// ---------------------------------------------------------------------------
// 09 的原则:**集成测试只覆盖"跨层出问题就没人发现"的主干链路**,不覆盖分支。
// 现在能跑通的只有第一段(启动 → 停在登录页),后面几段等真实后端环境和测试
// 账号到位后逐段打开——测试打桩到"点了按钮什么都没验证"是负资产。
//
// 跑法:
// flutter test integration_test/app_test.dart \
// --flavor dev -t lib/main_dev.dart --dart-define-from-file=env/dev.json
// ---------------------------------------------------------------------------
import 'package:app/bootstrap.dart';
import 'package:core_foundation/core_foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('冷启动后停在登录页', (WidgetTester tester) async {
await bootstrap(AppEnv.fromDartDefine(flavor: 'dev'));
await tester.pumpAndSettle();
// 没有 token → SessionUnauthenticated → redirect 到 /login04)。
expect(find.byKey(const Key('login_username')), findsOneWidget);
});
// TODO(09): 登录 → 选店 → 工作台 → 采购下单 → 支付回跳。
// 需要 UAT 环境的常驻测试账号和一家固定测试门店;账号一变整条链路就红,
// 所以在账号方案定下来之前不写死。
}