feat(app): the run dialog can continue to a schedule editor seeded with its prompt
This commit is contained in:
@@ -12,6 +12,7 @@ import 'package:pipelines_app/features/pipelines/pending_run_store.dart';
|
||||
import 'package:pipelines_app/features/pipelines/run_pipeline_intent.dart';
|
||||
import 'package:pipelines_app/features/pipelines/ui/run_pipeline_wording.dart';
|
||||
|
||||
import 'package:pipelines_app/features/schedules/ui/editor/schedule_editor_wording.dart';
|
||||
import '../fixtures.dart';
|
||||
|
||||
typedef LaunchHandler = FutureOr<JsonMap> Function(JsonMap fields);
|
||||
@@ -96,8 +97,9 @@ void main() {
|
||||
requestKey: 'endpoint-intent',
|
||||
);
|
||||
SharedPreferences.setMockInitialValues({
|
||||
pendingRunStorageKey('ws://server-a/connect', 1, 2):
|
||||
jsonEncode(intent.toJson()),
|
||||
pendingRunStorageKey('ws://server-a/connect', 1, 2): jsonEncode(
|
||||
intent.toJson(),
|
||||
),
|
||||
});
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = launchGateway(fixture, onLaunch: (_) => noRun());
|
||||
@@ -416,9 +418,11 @@ void main() {
|
||||
final prompt = tester.widget<TextField>(find.byKey(runPipelinePromptKey));
|
||||
expect(prompt.enabled, isFalse);
|
||||
expect(
|
||||
tester.widget<DropdownButtonFormField<dynamic>>(
|
||||
find.byKey(runPipelineOutputFormatKey),
|
||||
).onChanged,
|
||||
tester
|
||||
.widget<DropdownButtonFormField<dynamic>>(
|
||||
find.byKey(runPipelineOutputFormatKey),
|
||||
)
|
||||
.onChanged,
|
||||
isNull,
|
||||
);
|
||||
|
||||
@@ -645,4 +649,31 @@ void main() {
|
||||
expect(helper?.color, CupertinoColors.secondaryLabel.resolveFrom(context));
|
||||
expect(helper?.fontSize, theme.textTheme.tabLabelTextStyle.fontSize);
|
||||
});
|
||||
|
||||
testWidgets('Schedule… leaves the run dialog for the schedule editor', (
|
||||
tester,
|
||||
) async {
|
||||
final fixture = PipelineFixture();
|
||||
var launches = 0;
|
||||
final gateway = launchGateway(
|
||||
fixture,
|
||||
onLaunch: (_) {
|
||||
launches++;
|
||||
return acceptedRun(9);
|
||||
},
|
||||
);
|
||||
await pumpScreen(tester, gateway, []);
|
||||
await openDetail(tester);
|
||||
await tester.tap(find.byKey(runPipelineActionKey));
|
||||
await tester.pumpAndSettle();
|
||||
await fillFields(tester, prompt: 'Nightly review');
|
||||
await tester.tap(find.byKey(const Key('run-pipeline-schedule')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// The editor is the next page, seeded with the typed prompt; no run left.
|
||||
expect(find.byKey(runPipelineConfirmKey), findsNothing);
|
||||
expect(find.byKey(scheduleEditorSubmitKey), findsOneWidget);
|
||||
expect(find.text('Nightly review'), findsWidgets);
|
||||
expect(launches, 0);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user