polish compact pipeline and run lists

This commit is contained in:
2026-10-31 01:28:34 +00:00
parent 2542791a82
commit faae90e9aa
4 changed files with 228 additions and 28 deletions
@@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@@ -114,6 +116,101 @@ void main() {
expect(find.textContaining('updated 17 Oct 21:26'), findsOneWidget);
});
testWidgets('compact split panes prioritise a pipeline name and state', (
tester,
) async {
tester.view.physicalSize = const Size(640, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 200,
height: 700,
child: PipelinesScreen(gateway: gatewayFor(PipelineFixture())),
),
),
),
),
);
await tester.pumpAndSettle();
final firstRow = find.byKey(const Key('pipeline-row-1'));
expect(
find.descendant(of: firstRow, matching: find.text('Alpha review')),
findsOneWidget,
);
expect(
find.descendant(of: firstRow, matching: find.text('Succeeded')),
findsOneWidget,
);
expect(
find.descendant(of: firstRow, matching: find.textContaining('v2 · #1')),
findsNothing,
);
expect(
find.descendant(
of: firstRow,
matching: find.byIcon(Icons.account_tree_outlined),
),
findsNothing,
);
expect(tester.takeException(), isNull);
});
testWidgets('compact rows do not claim no runs while history is loading', (
tester,
) async {
final fixture = PipelineFixture();
final runs = Completer<Map<String, dynamic>>();
final gateway = FakeGateway(
(type, fields) => switch (type) {
'list_pipelines' => pipelineListReply(fixture.summaries),
'list_runs' => runs.future,
_ => errorReply('unexpected $type'),
},
);
tester.view.physicalSize = const Size(640, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 200,
height: 700,
child: PipelinesScreen(gateway: gateway),
),
),
),
),
);
await tester.pump();
await tester.pump();
final firstRow = find.byKey(const Key('pipeline-row-1'));
expect(firstRow, findsOneWidget);
expect(
find.descendant(of: firstRow, matching: find.text('No runs recorded')),
findsNothing,
);
expect(
find.descendant(of: firstRow, matching: find.text('no runs recorded')),
findsNothing,
);
runs.complete(runListReply(fixture.runs));
await tester.pumpAndSettle();
expect(
find.descendant(of: firstRow, matching: find.text('Succeeded')),
findsOneWidget,
);
expect(tester.takeException(), isNull);
});
testWidgets('Cupertino keeps native tiles with the same row identity', (
tester,
) async {
@@ -104,4 +104,30 @@ void main() {
expect(find.byKey(const ValueKey('run-list-more-menu-42')), findsOneWidget);
expect(find.byKey(runMoreMenuKey), findsNothing);
});
testWidgets('compact rows keep a title and one metadata line', (
tester,
) async {
tester.view.physicalSize = const Size(240, 400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: RunListRow(
run: _finished,
now: DateTime.utc(2026, 10, 22),
gateway: _FakeGateway(),
onRunChanged: (_) {},
),
),
),
);
expect(find.text('Ship the release notes'), findsOneWidget);
expect(find.text('release'), findsOneWidget);
expect(find.text('2m 5s'), findsNothing);
expect(find.byKey(const ValueKey('run-list-more-menu-42')), findsNothing);
expect(tester.takeException(), isNull);
});
}