test project picker to agent review flow
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:record/record.dart';
|
||||
import 'dart:async';
|
||||
@@ -260,6 +261,70 @@ void main() {
|
||||
await chatCubit.close();
|
||||
});
|
||||
|
||||
testWidgets('project picker selection reaches the agent review flow', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(1500, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
const selectorChannel = MethodChannel('plugins.flutter.io/file_selector');
|
||||
final messenger =
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger;
|
||||
messenger.setMockMethodCallHandler(selectorChannel, (call) async {
|
||||
expect(call.method, 'getDirectoryPath');
|
||||
expect(
|
||||
(call.arguments as Map<Object?, Object?>)['confirmButtonText'],
|
||||
'تسجيل هذا المشروع',
|
||||
);
|
||||
return r'C:\Projects\sample';
|
||||
});
|
||||
addTearDown(
|
||||
() => messenger.setMockMethodCallHandler(selectorChannel, null),
|
||||
);
|
||||
|
||||
final api = _ProposalWidgetApi();
|
||||
final cubit = ChatCubit(api, settingsStore: LocalSettingsStore.inMemory());
|
||||
await tester.pumpWidget(
|
||||
MultiRepositoryProvider(
|
||||
providers: [RepositoryProvider<ApiRepository>.value(value: api)],
|
||||
child: MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<ChatCubit>.value(value: cubit),
|
||||
BlocProvider(create: (_) => VoiceCubit(api, AudioRecorder())),
|
||||
],
|
||||
child: const SovereignApp(),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.text('تسجيل مجلد مشروع موجود'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('ملفات مساحة العمل'), findsOneWidget);
|
||||
await tester.tap(find.byType(CheckboxListTile));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('متابعة (1)'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(cubit.state.selectedWorkspacePath, r'C:\Projects\sample');
|
||||
expect(cubit.state.selectedWorkspaceFiles, ['src/hello.py']);
|
||||
await tester.enterText(find.byType(TextField), 'أنشئ ملف Python');
|
||||
await tester.tap(find.byTooltip('إرسال'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(api.lastWorkspacePath, r'C:\Projects\sample');
|
||||
expect(api.lastWorkspaceFiles, ['src/hello.py']);
|
||||
expect(find.text('مراجعة إنشاء الملف'), findsOneWidget);
|
||||
expect(api.applyCount, 0);
|
||||
await tester.tap(find.text('إلغاء'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(api.applyCount, 0);
|
||||
expect(tester.takeException(), isNull);
|
||||
await cubit.close();
|
||||
});
|
||||
|
||||
testWidgets('model selector displays capabilities reported by Ollama', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user