merge(app): bring main into runs-pipeline-url; main's filter menu supersedes the lane's pipeline menu
This commit is contained in:
@@ -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();
|
||||
@@ -93,6 +137,8 @@ void main() {
|
||||
expect(find.text(runPipelinePromptLabel), findsOneWidget);
|
||||
expect(find.text(runPipelineWorkspaceLabel), findsOneWidget);
|
||||
expect(find.text(runPipelineNotifyLabel), findsOneWidget);
|
||||
expect(find.text(runPipelineOutputFormatLabel), findsOneWidget);
|
||||
expect(find.text(runPipelineOutputFormatHelper), findsOneWidget);
|
||||
expect(find.text(runPipelineCancelLabel), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
@@ -104,14 +150,15 @@ 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);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(runPipelineOutputFormatKey));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('HTML report').last);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(runPipelineConfirmKey));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -123,6 +170,7 @@ void main() {
|
||||
'workspace': '/work/alpha',
|
||||
'input': {'prompt': 'Review the change.'},
|
||||
'notify_mode': 'off',
|
||||
'output_format': 'html',
|
||||
});
|
||||
expect(fields['request_key'], startsWith('app-run-1-2-'));
|
||||
expect('${fields['request_key']}'.length, lessThanOrEqualTo(128));
|
||||
@@ -317,6 +365,12 @@ void main() {
|
||||
// The fields stay locked while admission is unknown.
|
||||
final prompt = tester.widget<TextField>(find.byKey(runPipelinePromptKey));
|
||||
expect(prompt.enabled, isFalse);
|
||||
expect(
|
||||
tester.widget<DropdownButtonFormField<dynamic>>(
|
||||
find.byKey(runPipelineOutputFormatKey),
|
||||
).onChanged,
|
||||
isNull,
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(runPipelineConfirmKey));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -495,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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user