2026-09-19 00:22:04 +08:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
|
import 'package:photo_live/app/app.dart';
|
2026-09-23 16:48:27 +08:00
|
|
|
import 'package:photo_live/core/api_client.dart';
|
|
|
|
|
import 'helpers/fakes.dart';
|
2026-09-19 00:22:04 +08:00
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
testWidgets('boots to login page with localized copy', (tester) async {
|
2026-09-23 16:48:27 +08:00
|
|
|
await tester.pumpWidget(
|
|
|
|
|
ProviderScope(
|
|
|
|
|
// UI06 启动门读会话:生产 SecureSessionStore 平台通道在测试环境
|
|
|
|
|
// 挂起——替身空会话(→ 登录页)。
|
|
|
|
|
overrides: [
|
|
|
|
|
sessionStoreProvider.overrideWithValue(FakeSessionStore()),
|
|
|
|
|
],
|
|
|
|
|
child: const PhotoLiveApp(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
// UI06 启动门:异步读本地会话(空 → 登录页)——多 pump 一帧等完成。
|
|
|
|
|
await tester.pump();
|
|
|
|
|
await tester.pump();
|
2026-09-19 00:22:04 +08:00
|
|
|
|
|
|
|
|
// 测试环境默认 locale 为 en:AppBar 标题与登录按钮均为英文文案。
|
|
|
|
|
expect(find.text('Photo Live'), findsOneWidget);
|
|
|
|
|
expect(find.text('Sign in'), findsOneWidget);
|
|
|
|
|
expect(find.text('Account'), findsOneWidget);
|
|
|
|
|
expect(find.text('Password'), findsOneWidget);
|
|
|
|
|
});
|
|
|
|
|
}
|