polish compact pipeline and run lists
This commit is contained in:
@@ -27,5 +27,7 @@ void main() {
|
||||
expect(graphStatusState('waiting'), 'waiting');
|
||||
expect(graphStatusState('mystery'), 'unknown');
|
||||
expect(runStatusColor('succeeded'), CupertinoColors.systemGreen);
|
||||
expect(runStatusColor('waiting'), CupertinoColors.systemYellow);
|
||||
expect(runStatusColor('canceled'), CupertinoColors.systemGrey);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,17 +4,14 @@ 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/ui/status/run_status_icon.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.
|
||||
/// 12px inset, rows with a stable avatar, title/time and one muted facts line,
|
||||
/// while detailed identity remains in the selected pipeline.
|
||||
void main() {
|
||||
testWidgets('rows and separators share the web list inset', (tester) async {
|
||||
final fixture = PipelineFixture();
|
||||
@@ -25,14 +22,9 @@ void main() {
|
||||
|
||||
// Filter and sort are app-bar actions; no toolbar row without a filter.
|
||||
expect(find.byKey(const Key('pipeline-toolbar')), findsNothing);
|
||||
// A native leading flow icon gives each pipeline a durable identity while
|
||||
// the title follows its normal ListTile spacing.
|
||||
expect(find.byIcon(Icons.account_tree_outlined), findsNWidgets(3));
|
||||
expect(
|
||||
tester.getTopLeft(find.byIcon(Icons.account_tree_outlined).first).dx -
|
||||
listLeft,
|
||||
kPipelineListInset,
|
||||
);
|
||||
// Each pipeline has a deterministic tinted initial rather than one generic
|
||||
// flow icon, while the title follows native ListTile spacing.
|
||||
expect(find.byKey(const Key('pipeline-avatar-1')), findsOneWidget);
|
||||
expect(
|
||||
tester.getTopLeft(find.text('Alpha review')).dx,
|
||||
greaterThan(listLeft),
|
||||
@@ -43,16 +35,13 @@ void main() {
|
||||
findsNWidgets(fixture.summaries.length - 1),
|
||||
);
|
||||
|
||||
// The version trails the title line; the recorded facts are one line and
|
||||
// the run line is the web's status glyph plus its fragments.
|
||||
expect(find.textContaining('v2 · #'), findsOneWidget);
|
||||
// The title's trailing time and the one muted facts line replace the old
|
||||
// version/id, run metadata, and graph stack.
|
||||
expect(find.textContaining('v2 · #'), findsNothing);
|
||||
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
|
||||
final glyphs = tester
|
||||
.widgetList<RunStatusIcon>(find.byType(RunStatusIcon))
|
||||
.map((icon) => icon.label);
|
||||
expect(glyphs, unorderedEquals(['Succeeded', 'Failed']));
|
||||
expect(find.textContaining('Succeeded'), findsNothing);
|
||||
expect(find.text('no runs recorded'), findsOneWidget);
|
||||
expect(find.byKey(const Key('pipeline-status-1')), findsOneWidget);
|
||||
expect(find.byKey(const Key('pipeline-status-2')), findsOneWidget);
|
||||
expect(find.text('no runs recorded'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('the detail header is one identity line; Summary keeps facts', (
|
||||
@@ -111,9 +100,8 @@ void main() {
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(find.text('Alpha review'), findsOneWidget);
|
||||
expect(find.textContaining('v2 · #'), findsOneWidget);
|
||||
// The facts line wraps instead of truncating at large text.
|
||||
expect(find.textContaining('updated 17 Oct 21:26'), findsOneWidget);
|
||||
expect(find.textContaining('v2 · #'), findsNothing);
|
||||
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('compact split panes prioritise a pipeline name and state', (
|
||||
@@ -153,7 +141,7 @@ void main() {
|
||||
expect(
|
||||
find.descendant(
|
||||
of: firstRow,
|
||||
matching: find.byIcon(Icons.account_tree_outlined),
|
||||
matching: find.byKey(const Key('pipeline-avatar-1')),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
@@ -228,49 +216,11 @@ void main() {
|
||||
|
||||
expect(find.byType(CupertinoListTile), findsWidgets);
|
||||
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
|
||||
expect(find.textContaining('v2 · #'), findsOneWidget);
|
||||
expect(
|
||||
find.byWidgetPredicate(
|
||||
(widget) => widget is RunStatusIcon && widget.label == 'Succeeded',
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.textContaining('v2 · #'), findsNothing);
|
||||
expect(find.byKey(const Key('pipeline-avatar-1')), findsOneWidget);
|
||||
expect(find.byKey(const Key('pipeline-status-1')), findsOneWidget);
|
||||
} finally {
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('a row puts its facts in the corners', (tester) async {
|
||||
final fixture = PipelineFixture();
|
||||
await pumpWide(tester, gatewayFor(fixture));
|
||||
final row = tester.getRect(find.byKey(const Key('pipeline-row-1')));
|
||||
final name = tester.getRect(find.text('Alpha review'));
|
||||
final version = tester.getRect(find.textContaining('v2 · #1'));
|
||||
final what = tester.getRect(find.text('2 stages · 1 schedule'));
|
||||
final updated = tester.getRect(find.text('updated 17 Oct 21:26'));
|
||||
// Top: name left, version and id right; below: what left, updated right.
|
||||
expect(version.center.dy, moreOrLessEquals(name.center.dy, epsilon: 2));
|
||||
expect(version.right, greaterThan(row.center.dx));
|
||||
expect(name.left, lessThan(row.center.dx));
|
||||
expect(what.top, greaterThanOrEqualTo(name.bottom));
|
||||
expect(updated.right, greaterThan(row.center.dx));
|
||||
expect(updated.top, greaterThan(what.top));
|
||||
});
|
||||
|
||||
testWidgets('right-hand row items end flush with the same edge', (
|
||||
tester,
|
||||
) async {
|
||||
final fixture = PipelineFixture();
|
||||
await pumpWide(tester, gatewayFor(fixture));
|
||||
final version = tester.getRect(find.textContaining('v2 · #1'));
|
||||
final updated = tester.getRect(find.text('updated 17 Oct 21:26'));
|
||||
expect(updated.right, moreOrLessEquals(version.right, epsilon: 1));
|
||||
final mini = find.byKey(const Key('pipeline-mini-1'));
|
||||
if (mini.evaluate().isNotEmpty) {
|
||||
expect(
|
||||
tester.getRect(mini).right,
|
||||
moreOrLessEquals(version.right, epsilon: 1),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -114,18 +114,19 @@ void main() {
|
||||
await pumpWide(tester, gateway);
|
||||
|
||||
expect(find.text('Seven'), findsOneWidget);
|
||||
// Facts sit in the row's corners: what it is, and when it changed.
|
||||
expect(find.text('2 stages'), findsWidgets);
|
||||
expect(find.text('updated 17 Oct 21:26'), findsOneWidget);
|
||||
expect(find.text('v3 · #7'), findsOneWidget);
|
||||
// The list keeps one factual subtitle; timestamps and identity are detail
|
||||
// facts rather than a dense second/third row of metadata.
|
||||
expect(find.textContaining('2 stages'), findsWidgets);
|
||||
expect(find.text('updated 17 Oct 21:26'), findsNothing);
|
||||
expect(find.text('v3 · #7'), findsNothing);
|
||||
|
||||
expect(find.text('pipeline 8'), findsOneWidget);
|
||||
expect(find.text('v1 · #8'), findsOneWidget);
|
||||
expect(find.text('v1 · #8'), findsNothing);
|
||||
|
||||
expect(find.text('0 stages'), findsOneWidget);
|
||||
expect(find.text('v4 · #9'), findsOneWidget);
|
||||
expect(find.textContaining('updated '), findsOneWidget);
|
||||
expect(find.text('no runs recorded'), findsNWidgets(3));
|
||||
expect(find.textContaining('0 stages'), findsOneWidget);
|
||||
expect(find.text('v4 · #9'), findsNothing);
|
||||
expect(find.textContaining('updated '), findsNothing);
|
||||
expect(find.text('no runs recorded'), findsNothing);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/pipelines/widgets/pipeline_list_panel.dart';
|
||||
|
||||
import 'fixtures.dart';
|
||||
import 'test_helpers.dart';
|
||||
|
||||
/// The list row's recorded flow cue: the reply's `shape` is drawn through the
|
||||
/// shared graph layout, and nothing is invented or fetched when it is absent.
|
||||
/// The list stays a concise index; graph cues belong in the selected detail.
|
||||
void main() {
|
||||
group('pipeline row miniature', () {
|
||||
testWidgets('a recorded shape draws the row miniature', (tester) async {
|
||||
group('pipeline list graph cues', () {
|
||||
testWidgets('a recorded shape does not draw a list miniature', (
|
||||
tester,
|
||||
) async {
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = gatewayFor(
|
||||
fixture,
|
||||
@@ -21,13 +21,14 @@ void main() {
|
||||
|
||||
await pumpWide(tester, gateway);
|
||||
|
||||
expect(find.byKey(const Key('pipeline-mini-7')), findsOneWidget);
|
||||
// The cue is additive: the recorded facts line is unchanged.
|
||||
expect(find.textContaining('#7'), findsOneWidget);
|
||||
expect(find.byKey(const Key('pipeline-mini-7')), findsNothing);
|
||||
expect(find.textContaining('#7'), findsNothing);
|
||||
expect(find.textContaining('2 stages'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a summary without a shape draws no miniature', (tester) async {
|
||||
testWidgets('a summary without a shape retains its concise subtitle', (
|
||||
tester,
|
||||
) async {
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = gatewayFor(
|
||||
fixture,
|
||||
@@ -36,39 +37,9 @@ void main() {
|
||||
|
||||
await pumpWide(tester, gateway);
|
||||
|
||||
expect(find.byType(PipelineMiniGraph), findsNothing);
|
||||
expect(find.byKey(const Key('pipeline-mini-8')), findsNothing);
|
||||
expect(find.textContaining('#8'), findsOneWidget);
|
||||
expect(find.textContaining('#8'), findsNothing);
|
||||
expect(find.textContaining('1 stage'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a miniature never fetches another origin or pipeline detail', (
|
||||
tester,
|
||||
) async {
|
||||
final fixture = PipelineFixture();
|
||||
final shape = reviewGraph();
|
||||
final stage = (shape['stages'] as List).first as Map<String, dynamic>;
|
||||
// A recorded external preview must be ignored: the row draws only the
|
||||
// recorded flow and never requests another origin.
|
||||
stage['preview'] = 'https://images.example.test/mini.png';
|
||||
stage['url'] = 'https://images.example.test/mini.png';
|
||||
final gateway = gatewayFor(
|
||||
fixture,
|
||||
summaries: [
|
||||
pipelineSummary(id: 9, name: 'Remote', stages: 2)..['shape'] = shape,
|
||||
],
|
||||
);
|
||||
|
||||
await pumpWide(tester, gateway);
|
||||
|
||||
expect(find.byKey(const Key('pipeline-mini-9')), findsOneWidget);
|
||||
expect(find.byType(Image), findsNothing);
|
||||
expect(gateway.callsOf('get_pipeline'), isEmpty);
|
||||
expect(
|
||||
gateway.calls.map((call) => call.type),
|
||||
everyElement(isIn(<String>['list_pipelines', 'list_runs'])),
|
||||
);
|
||||
expect(find.textContaining('#9'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ void main() {
|
||||
expect(running.progress, '1 step · at review');
|
||||
});
|
||||
|
||||
testWidgets('a run row places its facts in the corners', (tester) async {
|
||||
testWidgets('a normal row groups its title, age, and one subtitle', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(800, 400);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
@@ -56,21 +58,16 @@ void main() {
|
||||
);
|
||||
Rect at(String text) => tester.getRect(find.text(text));
|
||||
final title = at('Ship the release notes');
|
||||
final number = at('#42');
|
||||
final pipeline = at('release');
|
||||
final duration = at('2m 5s');
|
||||
final steps = at('3 steps');
|
||||
// Left column: run, pipeline, time; right column: number, duration, steps.
|
||||
expect(number.center.dy, moreOrLessEquals(title.center.dy));
|
||||
expect(duration.center.dy, moreOrLessEquals(pipeline.center.dy));
|
||||
expect(pipeline.top, greaterThanOrEqualTo(title.bottom));
|
||||
expect(steps.top, greaterThanOrEqualTo(duration.bottom));
|
||||
for (final right in [number, duration, steps]) {
|
||||
expect(right.right, greaterThan(800 - 32));
|
||||
}
|
||||
final age = at('12h ago');
|
||||
final subtitle = at('release · 2m 5s · 3 steps');
|
||||
|
||||
expect(age.center.dy, moreOrLessEquals(title.center.dy));
|
||||
expect(subtitle.top, greaterThanOrEqualTo(title.bottom));
|
||||
expect(find.text('#42'), findsNothing);
|
||||
expect(find.byIcon(Icons.check_circle_outline), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('uses a muted pipeline fallback only when it is absent', (
|
||||
testWidgets('includes a pipeline fallback in its single subtitle', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
@@ -84,7 +81,10 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('Pipeline unavailable'), findsOneWidget);
|
||||
expect(
|
||||
find.text('Pipeline unavailable · 2m 5s · 3 steps'),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('gives a list action menu a per-run key', (tester) async {
|
||||
|
||||
Reference in New Issue
Block a user