Runs: failure banner actions, immediate run menu; pipeline rows get Run

- "Why it failed" banner offers Retry (the retry prompt), Run again… (New
  run form pre-filled; now allowed for failed runs from the banner) and
  Open in chat (the run's existing send-to-chat flow).
- The run ⋮ menu shows while the detail loads: items listed from the run's
  list row, disabled until get_run answers (the loading placeholder had no
  actions, so the menu waited for the full detail).
- Pipelines list rows: Run… in the row menu (not for archived pipelines)
  and a trailing Run button when the list sits beside its detail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 00:32:57 +00:00
parent accb9970b6
commit 072db8f749
15 changed files with 578 additions and 22 deletions
@@ -0,0 +1,88 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:pipelines_app/features/pipelines/screen.dart';
import 'package:pipelines_app/features/pipelines/ui/run_pipeline_wording.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_row_actions.dart';
import 'package:pipelines_app/features/pipelines/pipeline_models.dart';
import 'package:pipelines_app/ui/layout/app_overflow_menu.dart';
import '../fixtures.dart';
import 'run_pipeline_launch_test.dart' show acceptedRun, launchGateway;
Future<void> _pump(WidgetTester tester, Size size, FakeGateway gateway) async {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await tester.pumpWidget(MaterialApp(home: PipelinesScreen(gateway: gateway)));
await tester.pumpAndSettle();
}
void main() {
SharedPreferences.setMockInitialValues({});
testWidgets('a wide list row has its own Run button opening the form', (
tester,
) async {
final fixture = PipelineFixture();
final gateway = launchGateway(fixture, onLaunch: (_) => acceptedRun(9));
await _pump(tester, const Size(1440, 900), gateway);
expect(find.byKey(pipelineRowRunKey(1)), findsOneWidget);
await tester.tap(find.byKey(pipelineRowRunKey(1)));
await tester.pumpAndSettle();
// The same New run form as the detail's Run, for the row's pipeline at
// its listed version; opening it starts nothing.
expect(find.byKey(runPipelinePromptKey), findsOneWidget);
expect(gateway.callsOf('get_pipeline').last.fields, {
'pipeline_id': 1,
'version': 2,
});
expect(gateway.callsOf('run_pipeline'), isEmpty);
// The row did not open the pipeline.
expect(find.byKey(const Key('pipeline-detail')), findsNothing);
});
testWidgets('a phone row offers Run… in its menu and no button', (
tester,
) async {
final fixture = PipelineFixture();
final gateway = launchGateway(fixture, onLaunch: (_) => acceptedRun(9));
await _pump(tester, const Size(560, 900), gateway);
expect(find.byKey(pipelineRowRunKey(2)), findsNothing);
await tester.tap(find.byKey(pipelineRowMenuKey(2)));
await tester.pumpAndSettle();
await tester.tap(find.text(pipelineRowRunLabel));
await tester.pumpAndSettle();
expect(find.byKey(runPipelinePromptKey), findsOneWidget);
expect(gateway.callsOf('get_pipeline').last.fields['pipeline_id'], 2);
});
test('an archived pipeline offers no Run, as its detail offers none', () {
final archived = PipelineSummary.fromJson({
...pipelineSummary(id: 4, name: 'Old'),
'archived_at': '2026-10-01T00:00:00Z',
});
void run(BuildContext _) {}
expect(
pipelineRowActions(pipeline: archived, wide: true, onRun: run),
isNull,
);
// Send to chat stays; only Run is withheld.
expect(
pipelineRowActions(
pipeline: archived,
wide: true,
onRun: run,
onOpenInChat: run,
),
isA<AppOverflowMenu<Object?>>(),
);
});
}