import 'package:ai_contract_mobile/app/shell/app_shell.dart'; import 'package:ai_contract_mobile/features/auth/domain/auth_session.dart'; import 'package:ai_contract_mobile/shared/storage/session_store.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); const session = AuthSession( accessToken: 'token', userId: 'user-1', tenantId: 'tenant-1', username: 'member@example.com', userDisplayName: 'Mobile Member', role: 'member', status: 'active', ); setUp(() async { SessionStore.useStorageDriverForTesting(InMemorySessionStorageDriver()); await SessionStore.save(session); }); tearDown(() async { await SessionStore.clear(); SessionStore.resetStorageDriverForTesting(); }); testWidgets('shows first-class AI tools tab for authenticated shell', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( home: AiContractAppShell(), ), ); await tester.pump(); expect(find.text('AI工具'), findsWidgets); }); testWidgets('dashboard quick action opens standalone contract workspace', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( home: AiContractAppShell(), ), ); await tester.pump(); final contractQuickAction = find.text('合同生成').first; await tester.ensureVisible(contractQuickAction); await tester.tap(contractQuickAction); await tester.pumpAndSettle(); expect(find.text('合同生成'), findsWidgets); expect(find.text('合同工作台'), findsOneWidget); expect(find.text('模板'), findsWidgets); expect(find.text('历史结果'), findsWidgets); }); }