545291e04a
- Run rows show a failed run's reason (else its diagnostic's first line, full text in a tooltip) or a short result preview; the Summary leads with "Why it failed". - Run again for succeeded/canceled/interrupted runs opens the New run form pre-filled (prompt, workspace, report format) at the latest version with the original offered. - Run detail and stage tabs show their names; touch shows captions on the Runs header and artifact viewer actions (desktop keeps tooltips). - ErrorNotice maps not connected / server too old / permission / timeout to what to do, raw detail behind Details (Schedules, create chat, Runs, Pipelines banners). - Settings has no Back arrow; Schedules keeps the rail on wide windows; phone Settings leads with Connection and Notifications and has a Jump to topic menu. - Walkthrough: Open Connection (skipped when connected), labelled Copy. - Pluralised counts; no duplicate status/rail names for screen readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
117 lines
4.6 KiB
Dart
117 lines
4.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/core/api_gateway.dart';
|
|
import 'package:pipelines_app/features/pipelines/pending_run_store.dart';
|
|
import 'package:pipelines_app/features/pipelines/pipeline_repository.dart';
|
|
import 'package:pipelines_app/features/pipelines/pipelines_controller.dart';
|
|
import 'package:pipelines_app/features/pipelines/run_pipeline_intent.dart';
|
|
import 'package:pipelines_app/features/pipelines/run_pipeline_seed.dart';
|
|
import 'package:pipelines_app/features/pipelines/ui/run_pipeline_version_field.dart';
|
|
import 'package:pipelines_app/features/pipelines/ui/run_pipeline_wording.dart';
|
|
import 'package:pipelines_app/features/runs/actions/retry_eligibility.dart';
|
|
import 'package:pipelines_app/features/runs/ui/run_again_flow.dart';
|
|
|
|
import '../../pipelines/fixtures.dart';
|
|
import '../../pipelines/ui/run_pipeline_launch_test.dart'
|
|
show acceptedRun, launchGateway;
|
|
|
|
/// Run again: a finished run that did not fail opens the New run form for its
|
|
/// pipeline, pre-filled with its prompt, workspace and report requirement,
|
|
/// at the latest version with the original offered.
|
|
void main() {
|
|
JsonMap finished({String status = 'succeeded', bool withInput = true}) => {
|
|
'id': 9,
|
|
'status': status,
|
|
'executing': false,
|
|
'pipeline_id': 1,
|
|
'version': 1,
|
|
'workspace': '/work/alpha',
|
|
'output_format': 'markdown',
|
|
if (withInput) 'input': {'prompt': 'Ship the release notes.'},
|
|
};
|
|
|
|
test('only finished runs that did not fail can run again', () {
|
|
expect(canRunAgain(finished()), isTrue);
|
|
expect(canRunAgain(finished(status: 'canceled')), isTrue);
|
|
expect(canRunAgain(finished(status: 'interrupted')), isTrue);
|
|
expect(canRunAgain(finished(status: 'failed')), isFalse);
|
|
expect(canRunAgain(finished()..['executing'] = true), isFalse);
|
|
expect(canRunAgain(finished()..remove('pipeline_id')), isFalse);
|
|
});
|
|
|
|
test('the seed carries the run inputs and its version', () {
|
|
final seed = runAgainSeed(finished());
|
|
expect(seed.prompt, 'Ship the release notes.');
|
|
expect(seed.workspace, '/work/alpha');
|
|
expect(seed.originalVersion, 1);
|
|
expect(seed.outputFormat, RunOutputFormat.markdown);
|
|
expect(runPipelineVersionChoices(2, 1), [2, 1]);
|
|
expect(runPipelineVersionChoices(2, 2), [2]);
|
|
});
|
|
|
|
testWidgets('the form opens pre-filled at the latest version and can '
|
|
'start the original one', (tester) async {
|
|
tester.view.physicalSize = const Size(1100, 900);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.reset);
|
|
final launched = <JsonMap>[];
|
|
final fixture = PipelineFixture();
|
|
final gateway = launchGateway(
|
|
fixture,
|
|
onLaunch: (fields) {
|
|
launched.add(fields);
|
|
return acceptedRun(30);
|
|
},
|
|
onLookup: (_) => {'type': 'run', 'run_detail': finished()},
|
|
);
|
|
final controller = PipelinesController(
|
|
PipelinesRepository(gateway),
|
|
pendingRunStore: MemoryPendingRunStore(),
|
|
);
|
|
addTearDown(controller.dispose);
|
|
final started = <int>[];
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Builder(
|
|
builder: (context) => TextButton(
|
|
onPressed: () => startRunAgainFlow(
|
|
context: context,
|
|
// A list row carries no input: the run is read first.
|
|
run: finished(withInput: false),
|
|
controller: controller,
|
|
gateway: gateway,
|
|
onRunStarted: started.add,
|
|
),
|
|
child: const Text('again'),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.tap(find.text('again'));
|
|
await tester.pumpAndSettle();
|
|
|
|
final prompt = tester.widget<TextField>(find.byKey(runPipelinePromptKey));
|
|
expect(prompt.controller!.text, 'Ship the release notes.');
|
|
final workspace = tester.widget<TextField>(
|
|
find.byKey(runPipelineWorkspaceKey),
|
|
);
|
|
expect(workspace.controller!.text, '/work/alpha');
|
|
expect(find.text('Latest (v2)'), findsOneWidget);
|
|
|
|
await tester.tap(find.byKey(runPipelineVersionKey));
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.text('Original run (v1)').last);
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.byKey(runPipelineConfirmKey));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(launched, hasLength(1));
|
|
expect(launched.single['pipeline_id'], 1);
|
|
expect(launched.single['version'], 1);
|
|
expect(launched.single['workspace'], '/work/alpha');
|
|
expect(launched.single['input'], {'prompt': 'Ship the release notes.'});
|
|
expect(launched.single['output_format'], 'markdown');
|
|
expect(started, [30]);
|
|
});
|
|
}
|