a44f31b989
Read-only Pipelines screen for the Flutter client: - list_pipelines and list_runs with a last-run join, plus get_pipeline with an explicit version (0 = latest); no mutation requests. - Name, run-presence, last-run-status and schedule filters; six sort orders; clear filters; truthful loading, empty and error states. - Detail Summary, selectable Source and version history with selection and return to latest. - Sequenced list/detail requests so stale replies cannot replace a newer selection or open a cleared one; refresh keeps the selected pipeline and version. - Material controls on Android/desktop and Cupertino on iOS; a per-label segmented tab row at narrow widths and scaled text, with the native control kept wherever an equal share fits. - Fixture probe entry and Chrome scripts for the rendered evidence; widget tests cover filters, sorting, formatting, sequencing, layout and the tab row. Graph rendering remains P2: the Graph tab states that it is pending and exposes a host hook. PipelinesScreen is not yet registered in the shell. Evidence and limits: app/notes/P1.md.
46 lines
1.5 KiB
Dart
46 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/pipelines/screen.dart';
|
|
|
|
import 'fixtures.dart';
|
|
|
|
FakeGateway gatewayFor(
|
|
PipelineFixture fixture, {
|
|
bool listFails = false,
|
|
bool runsFail = false,
|
|
bool detailFails = false,
|
|
List<Map<String, dynamic>>? summaries,
|
|
}) => FakeGateway(
|
|
(type, fields) => switch (type) {
|
|
'list_pipelines' =>
|
|
listFails
|
|
? errorReply('server offline')
|
|
: pipelineListReply(summaries ?? fixture.summaries),
|
|
'list_runs' =>
|
|
runsFail ? errorReply('runs down') : runListReply(fixture.runs),
|
|
'get_pipeline' =>
|
|
detailFails
|
|
? errorReply('pipeline ${fields['pipeline_id']} was not found')
|
|
: pipelineDetailReply(
|
|
fixture.detailFor(
|
|
fields['pipeline_id'] as int,
|
|
fields['version'] as int,
|
|
)!,
|
|
),
|
|
_ => errorReply('unexpected $type'),
|
|
},
|
|
);
|
|
|
|
Future<void> pumpWide(WidgetTester tester, FakeGateway gateway) async {
|
|
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)));
|
|
await tester.pumpAndSettle();
|
|
}
|
|
|
|
Finder selectableText(String text) => find.byWidgetPredicate(
|
|
(widget) => widget is SelectableText && widget.data == text,
|
|
);
|