merge(app): land flutter/run-directories

This commit is contained in:
2026-10-22 18:45:00 +01:00
5 changed files with 185 additions and 29 deletions
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/core/transport/connection_state.dart';
import 'package:pipelines_app/features/pipelines/screen.dart';
@@ -28,6 +29,10 @@ FakeGateway launchGateway(
)!,
),
'list_schedules' => {'type': 'schedules', 'schedules': <dynamic>[]},
'chat_directories' => {
'type': 'chat_directories',
'chat_directories': ['/work/recent', 'relative', '/work/other'],
},
'run_pipeline' => onLaunch(fields),
'get_run' when onLookup != null => onLookup(fields),
_ => errorReply('unexpected $type'),
@@ -74,6 +79,45 @@ Future<void> fillFields(
}
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
SharedPreferences.setMockInitialValues({});
testWidgets(
'workspace directory suggestions load on open and selection is local',
(tester) async {
final fixture = PipelineFixture();
final gateway = launchGateway(fixture, onLaunch: (_) => acceptedRun(76));
await pumpScreen(tester, gateway, <int>[]);
await openDetail(tester);
await tester.tap(find.byKey(runPipelineActionKey));
await tester.pumpAndSettle();
expect(gateway.callsOf('chat_directories'), hasLength(1));
expect(find.text(runPipelineDirectoriesLoading), findsNothing);
expect(
tester
.widget<TextField>(find.byKey(runPipelineWorkspaceKey))
.controller
?.text,
'/work/recent',
);
await tester.tap(find.byKey(runPipelineWorkspaceSuggestionsKey));
await tester.pumpAndSettle();
expect(find.text('/work/other'), findsOneWidget);
expect(find.text('relative'), findsNothing);
await tester.tap(find.text('/work/other'));
await tester.pumpAndSettle();
expect(
tester
.widget<TextField>(find.byKey(runPipelineWorkspaceKey))
.controller
?.text,
'/work/other',
);
expect(gateway.callsOf('run_pipeline'), isEmpty);
expect(gateway.callsOf('chat_directories'), hasLength(1));
},
);
testWidgets('the detail Run action sends the web request for the pinned '
'version and opens only the reply run', (tester) async {
final fixture = PipelineFixture();
@@ -106,10 +150,7 @@ void main() {
expect(gateway.callsOf('run_pipeline'), isEmpty);
await fillFields(tester, prompt: ' Review the change. ');
await tester.enterText(
find.byKey(runPipelineWorkspaceKey),
'/work/alpha ',
);
await tester.enterText(find.byKey(runPipelineWorkspaceKey), '/work/alpha ');
await tester.tap(find.byKey(runPipelineNotifyKey));
await tester.pumpAndSettle();
await tester.tap(find.text('Silent').last);
@@ -508,13 +549,7 @@ void main() {
final helper = tester
.widget<Text>(find.text(runPipelineWorkspaceHelper))
.style;
expect(
helper?.color,
CupertinoColors.secondaryLabel.resolveFrom(context),
);
expect(
helper?.fontSize,
theme.textTheme.tabLabelTextStyle.fontSize,
);
expect(helper?.color, CupertinoColors.secondaryLabel.resolveFrom(context));
expect(helper?.fontSize, theme.textTheme.tabLabelTextStyle.fontSize);
});
}