wip(app): runs-pipeline-url (retained from the cancelled overrun lane)

This commit is contained in:
2026-10-22 21:59:06 +01:00
parent 1bcc26a4fd
commit 8ff3b3f22e
10 changed files with 217 additions and 9 deletions
@@ -86,6 +86,30 @@ void main() {
expect(find.text('Viewing v1 (latest v2).'), findsNothing);
});
testWidgets('detail Runs action names and opens that pipeline filter', (
tester,
) async {
final fixture = PipelineFixture();
final gateway = gatewayFor(fixture);
final opened = <int>[];
tester.view.physicalSize = const Size(1100, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await tester.pumpWidget(
MaterialApp(
home: PipelinesScreen(gateway: gateway, onViewPipelineRuns: opened.add),
),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('pipeline-row-1')));
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('View runs of Alpha review'), findsOneWidget);
await tester.tap(find.byKey(const Key('pipeline-view-runs')));
expect(opened, [1]);
});
testWidgets('refresh keeps the selected row and its detail', (tester) async {
final fixture = PipelineFixture();
final gateway = gatewayFor(fixture);
@@ -46,17 +46,21 @@ const _runs = [
Widget _materialScreen(
_Gateway gateway, {
int? initialRunId,
int? initialPipelineId,
int syncToken = 0,
ValueChanged<int>? onRunSelected,
VoidCallback? onBack,
ValueChanged<int?>? onBack,
ValueChanged<int?>? onPipelineFilterChanged,
}) => MaterialApp(
home: Scaffold(
body: RunsScreen(
gateway: gateway,
initialRunId: initialRunId,
initialPipelineId: initialPipelineId,
syncToken: syncToken,
onRunSelected: onRunSelected,
onBack: onBack,
onPipelineFilterChanged: onPipelineFilterChanged,
),
),
);
@@ -149,12 +153,12 @@ void main() {
tester,
) async {
int? selected;
var backs = 0;
int? backedPipeline;
await tester.pumpWidget(
_materialScreen(
gateway,
onRunSelected: (id) => selected = id,
onBack: () => backs++,
onBack: (id) => backedPipeline = id,
),
);
await _mountList(tester, gateway);
@@ -167,10 +171,60 @@ void main() {
await tester.tap(find.text('Back to list'));
await tester.pump();
expect(backs, 1);
expect(backedPipeline, isNull);
expect(find.text('Alpha run'), findsOneWidget);
});
testWidgets(
'pipeline route shows its chip and clearing reports the URL change',
(tester) async {
int? changedPipeline = 3;
await tester.pumpWidget(
_materialScreen(
gateway,
initialPipelineId: 3,
onPipelineFilterChanged: (id) => changedPipeline = id,
),
);
await _mountList(tester, gateway);
expect(find.text('Pipeline 3'), findsOneWidget);
expect(changedPipeline, 3);
await tester.tap(find.byTooltip('Clear filter: Pipeline 3'));
await tester.pump();
expect(changedPipeline, isNull);
expect(find.text('Pipeline 3'), findsNothing);
},
);
testWidgets('run detail keeps the pipeline filter for Back routing', (
tester,
) async {
int? backPipeline;
await tester.pumpWidget(
_materialScreen(
gateway,
initialPipelineId: 3,
onBack: (id) => backPipeline = id,
),
);
await _mountList(tester, gateway);
await tester.pumpWidget(
_materialScreen(
gateway,
initialRunId: 2,
onBack: (id) => backPipeline = id,
),
);
await tester.pump();
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
await tester.pump();
await tester.tap(find.text('Back to list'));
await tester.pump();
expect(backPipeline, 3);
});
testWidgets('a route change opens and closes the named run', (tester) async {
await tester.pumpWidget(_materialScreen(gateway, initialRunId: 2));
await _mountList(tester, gateway);