merge(app): land pipelines-layout

This commit is contained in:
2026-10-22 15:07:12 +01:00
8 changed files with 307 additions and 96 deletions
@@ -0,0 +1,139 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/screen.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_list_panel.dart';
import 'fixtures.dart';
import 'test_helpers.dart';
/// The list/detail composition follows the web list: one compact toolbar on a
/// 12px inset, rows with a title line, a muted facts line, the version and the
/// last run, separated from each other, and a one-line detail identity header
/// whose recorded facts live at the top of Summary.
void main() {
testWidgets('toolbar, rows and separators share the web list inset', (
tester,
) async {
final fixture = PipelineFixture();
await pumpWide(tester, gatewayFor(fixture));
final list = find.byKey(const Key('pipeline-list'));
final listLeft = tester.getTopLeft(list).dx;
expect(
tester.getTopLeft(find.byKey(const Key('pipeline-toolbar'))).dx -
listLeft,
kPipelineListInset,
);
expect(
tester.getTopLeft(find.text('Alpha review')).dx - listLeft,
kPipelineListInset,
);
expect(
find.descendant(of: list, matching: find.byType(Divider)),
findsNWidgets(fixture.summaries.length - 1),
);
// The version trails the title line; the recorded facts are one line and
// the run line keeps the web's state word and fragments.
expect(find.text('v2'), findsOneWidget);
expect(
find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'),
findsOneWidget,
);
expect(find.textContaining('Succeeded · '), findsOneWidget);
expect(find.textContaining('Failed · '), findsOneWidget);
expect(find.text('no runs recorded'), findsOneWidget);
});
testWidgets('the detail header is one identity line; Summary keeps facts', (
tester,
) async {
final fixture = PipelineFixture();
await pumpWide(tester, gatewayFor(fixture));
await tester.tap(find.byKey(const Key('pipeline-row-1')));
await tester.pumpAndSettle();
final detail = find.byKey(const Key('pipeline-detail'));
final header = find.byKey(const Key('pipeline-detail-header'));
expect(header, findsOneWidget);
expect(
find.descendant(of: header, matching: find.text('Alpha review')),
findsOneWidget,
);
expect(
find.descendant(of: header, matching: find.text('id 1 · v2 · 2 stages')),
findsNothing,
);
// The recorded identity now sits at the top of the Summary tab.
expect(find.text('id 1 · v2 · 2 stages'), findsOneWidget);
expect(
tester
.getTopLeft(
find.descendant(
of: header,
matching: find.text('Alpha review'),
),
)
.dx -
tester.getTopLeft(detail).dx,
12,
);
});
testWidgets('narrow 2x keeps the row identity and facts without overflow', (
tester,
) async {
tester.view.physicalSize = const Size(320, 640);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
MaterialApp(
builder: (context, child) => MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: const TextScaler.linear(2)),
child: child!,
),
home: PipelinesScreen(gateway: gatewayFor(PipelineFixture())),
),
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
expect(find.text('Alpha review'), findsOneWidget);
expect(find.text('v2'), findsOneWidget);
// The facts line wraps instead of truncating at large text.
expect(find.textContaining('updated 17 Oct 21:26'), findsOneWidget);
});
testWidgets('Cupertino keeps native tiles with the same row identity', (
tester,
) async {
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
tester.view.physicalSize = const Size(1100, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
try {
await tester.pumpWidget(
CupertinoApp(
home: PipelinesScreen(gateway: gatewayFor(PipelineFixture())),
),
);
await tester.pumpAndSettle();
expect(find.byType(CupertinoListTile), findsWidgets);
expect(
find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'),
findsOneWidget,
);
expect(find.text('v2'), findsOneWidget);
expect(find.textContaining('Succeeded · '), findsOneWidget);
} finally {
debugDefaultTargetPlatformOverride = null;
}
});
}
@@ -114,13 +114,18 @@ void main() {
await pumpWide(tester, gateway);
expect(find.text('Seven'), findsOneWidget);
expect(find.text('id 7 · v3 · 2 stages'), findsOneWidget);
expect(find.text('updated 17 Oct 21:26'), findsOneWidget);
expect(
find.text('id 7 · 2 stages · updated 17 Oct 21:26'),
findsOneWidget,
);
expect(find.text('v3'), findsOneWidget);
expect(find.text('pipeline 8'), findsOneWidget);
expect(find.text('id 8 · v1 · 2 stages'), findsOneWidget);
expect(find.text('id 8 · 2 stages'), findsOneWidget);
expect(find.text('v1'), findsOneWidget);
expect(find.text('id 9 · v4 · 0 stages'), findsOneWidget);
expect(find.text('id 9 · 0 stages'), findsOneWidget);
expect(find.text('v4'), findsOneWidget);
expect(find.textContaining('updated '), findsOneWidget);
expect(find.text('no runs recorded'), findsNWidgets(3));
});
@@ -22,8 +22,8 @@ void main() {
await pumpWide(tester, gateway);
expect(find.byKey(const Key('pipeline-mini-7')), findsOneWidget);
// The cue is additive: the recorded metadata line is unchanged.
expect(find.text('id 7 · v1 · 2 stages'), findsOneWidget);
// The cue is additive: the recorded facts line is unchanged.
expect(find.textContaining('id 7 · 2 stages'), findsOneWidget);
});
testWidgets('a summary without a shape draws no miniature', (tester) async {
@@ -37,7 +37,7 @@ void main() {
expect(find.byType(PipelineMiniGraph), findsNothing);
expect(find.byKey(const Key('pipeline-mini-8')), findsNothing);
expect(find.text('id 8 · v1 · 1 stage'), findsOneWidget);
expect(find.textContaining('id 8 · 1 stage'), findsOneWidget);
});
testWidgets('a miniature never fetches another origin or pipeline detail', (
@@ -66,7 +66,7 @@ void main() {
gateway.calls.map((call) => call.type),
everyElement(isIn(<String>['list_pipelines', 'list_runs'])),
);
expect(find.text('id 9 · v1 · 2 stages'), findsOneWidget);
expect(find.textContaining('id 9 · 2 stages'), findsOneWidget);
});
});
}
@@ -18,9 +18,10 @@ void main() {
expect(find.text('Pipelines'), findsOneWidget);
expect(find.text('Alpha review'), findsOneWidget);
expect(find.text('id 1 · v2 · 2 stages'), findsOneWidget);
expect(find.text('updated 17 Oct 21:26'), findsOneWidget);
expect(find.text('1 schedule'), findsOneWidget);
expect(
find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'),
findsOneWidget,
);
expect(find.textContaining('run 42'), findsOneWidget);
expect(find.text('no runs recorded'), findsOneWidget);
expect(find.text('Select a pipeline.'), findsOneWidget);
@@ -30,7 +31,7 @@ void main() {
expect(find.byKey(const Key('pipeline-detail')), findsOneWidget);
expect(find.text('hash-alpha'), findsOneWidget);
expect(find.text('id 1 · v2 · 2 stages'), findsNWidgets(2));
expect(find.text('id 1 · v2 · 2 stages'), findsOneWidget);
expect(gateway.callsOf('get_pipeline').single.fields, {
'pipeline_id': 1,
'version': 2,
@@ -53,8 +54,8 @@ void main() {
await tester.tap(find.byKey(const Key('pipeline-row-1')));
await tester.pumpAndSettle();
expect(find.text('v1'), findsOneWidget);
expect(find.text('v2'), findsNWidgets(2));
expect(find.byKey(const Key('pipeline-version-1')), findsOneWidget);
expect(find.byKey(const Key('pipeline-version-2')), findsOneWidget);
await tester.tap(find.byKey(const Key('pipeline-version-1')));
await tester.pumpAndSettle();