Share one list row across runs, pipelines, chat, search and schedules

AppListRow (Material + Cupertino) with avatar, bold title and trailing
time, one muted line, one overflow menu style, inset dividers, selected
and emphasised states and a compact mode. Pipelines get a legible initial
avatar, schedule rows shrink to two lines with Edit/Pause/Delete in an
overflow menu, and the shell chat list scrolls behind the bar.
This commit is contained in:
2026-10-31 04:15:01 +00:00
parent 6ab8551348
commit 3c56db37fd
38 changed files with 1841 additions and 1520 deletions
@@ -30,16 +30,15 @@ void main() {
expect(find.text('2 schedules'), findsOneWidget);
expect(find.textContaining('not pipeline definitions'), findsOneWidget);
// Two lines per row: the name with its next run, then the timer
// and pinned pipeline version. The editor holds the rest.
expect(find.text('Research batteries'), findsOneWidget);
expect(find.text('Find battery chemistry sources'), findsOneWidget);
expect(find.text('Pipeline 4 · v2'), findsOneWidget);
expect(find.text('Workspace: /srv/research'), findsOneWidget);
expect(find.text('Timer: Every 24h · mon, wed'), findsOneWidget);
expect(find.text('Timezone: Europe/London'), findsOneWidget);
expect(find.text('22 Oct 09:00'), findsOneWidget);
expect(
find.text('Next due: 2026-10-22 09:00 (your local time)'),
find.text('Every 24h · mon, wed · Pipeline 4 · v2'),
findsOneWidget,
);
expect(find.text('Find battery chemistry sources'), findsNothing);
await tester.scrollUntilVisible(
find.text('Nightly report'),
@@ -50,11 +49,8 @@ void main() {
),
);
expect(find.text('Nightly report'), findsOneWidget);
expect(find.text('Pipeline 7 · v5'), findsOneWidget);
expect(find.text('Workspace: /srv/reports'), findsOneWidget);
expect(find.text('Timer: 10:00, 18:30'), findsOneWidget);
expect(find.text('Timezone: Server timezone'), findsOneWidget);
expect(find.text('Next due: Paused'), findsOneWidget);
expect(find.text('10:00, 18:30 · Pipeline 7 · v5'), findsOneWidget);
expect(find.text('Paused'), findsOneWidget);
if (cupertino) {
expect(find.byType(CupertinoSearchTextField), findsOneWidget);
@@ -18,6 +18,20 @@ Future<void> _tapSave(WidgetTester tester) async {
await tester.pumpAndSettle();
}
/// Edit, Pause/Enable and Delete live in the row's overflow menu.
Future<void> _openMenu(WidgetTester tester, int id) async {
await tester.ensureVisible(find.byKey(scheduleRowMenuKey(id)));
await tester.pumpAndSettle();
await tester.tap(find.byKey(scheduleRowMenuKey(id)));
await tester.pumpAndSettle();
}
Future<void> _pick(WidgetTester tester, Key item, int id) async {
await _openMenu(tester, id);
await tester.tap(find.byKey(item));
await tester.pumpAndSettle();
}
void main() {
testWidgets('lists this pipeline schedules with server values and states', (
tester,
@@ -46,21 +60,24 @@ void main() {
expect(find.text('Schedules (2)'), findsOneWidget);
expect(find.text('Research batteries'), findsOneWidget);
// Two lines: the name with its next run, then version and timer words.
expect(
find.text('Every 24h · mon, wed · Europe/London'),
find.text('v2 · Every 24h · mon, wed · Europe/London'),
findsOneWidget,
);
expect(find.text('Paused'), findsWidgets);
expect(find.text('Nightly report'), findsOneWidget);
expect(
find.text('10:00, 18:30 · Server timezone'),
findsOneWidget,
);
expect(find.text('Enabled'), findsOneWidget);
expect(find.text('Paused'), findsWidgets);
expect(find.text('Paused'), findsWidgets);
expect(find.byKey(scheduleRowEditKey(8)), findsOneWidget);
expect(find.text('v5 · 10:00, 18:30 · Server timezone'), findsOneWidget);
expect(find.bySemanticsLabel(RegExp('Enabled')), findsOneWidget);
expect(find.bySemanticsLabel(RegExp('Paused')), findsOneWidget);
expect(find.text('Paused'), findsOneWidget);
// The prompt and the inline text buttons are gone from the row.
expect(find.text('Edit'), findsNothing);
expect(find.byKey(scheduleRowMenuKey(8)), findsOneWidget);
await _openMenu(tester, 9);
expect(find.byKey(scheduleRowEditKey(9)), findsOneWidget);
expect(find.byKey(scheduleRowToggleKey(9)), findsOneWidget);
expect(find.text('Enable'), findsOneWidget);
expect(find.byKey(scheduleRowDeleteKey(9)), findsOneWidget);
expect(gateway.calls.map((call) => call.type), ['list_schedules']);
expect(gateway.calls.single.fields, {'pipeline_id': 4});
});
@@ -187,7 +204,7 @@ void main() {
});
await pumpScheduleSection(tester, gateway: gateway);
await tester.tap(find.byKey(scheduleRowEditKey(8)));
await _pick(tester, scheduleRowEditKey(8), 8);
await tester.pumpAndSettle();
expect(
tester
@@ -238,14 +255,14 @@ void main() {
});
await pumpScheduleSection(tester, gateway: gateway);
await tester.tap(find.byKey(scheduleRowToggleKey(8)));
await _pick(tester, scheduleRowToggleKey(8), 8);
await tester.pumpAndSettle();
final call = gateway.callsOf('save_schedule').single;
expect(call.fields.containsKey('request_key'), isFalse);
expect(call.fields['schedule'], {...original, 'enabled': false});
expect(find.text('Paused'), findsWidgets);
expect(find.text('Paused'), findsWidgets);
expect(find.text('Paused'), findsOneWidget);
await _openMenu(tester, 8);
expect(find.byKey(scheduleRowToggleKey(8)), findsOneWidget);
expect(find.text('Enable'), findsOneWidget);
expect(gateway.calls.map((call) => call.type), [
@@ -264,11 +281,12 @@ void main() {
});
await pumpScheduleSection(tester, gateway: gateway);
await tester.tap(find.byKey(scheduleRowToggleKey(8)));
await _pick(tester, scheduleRowToggleKey(8), 8);
await tester.pumpAndSettle();
expect(find.byKey(scheduleRowErrorKey(8)), findsOneWidget);
expect(find.text('conflict: revision 3 is stale'), findsOneWidget);
await _openMenu(tester, 8);
expect(find.text('Pause'), findsOneWidget);
expect(gateway.callsOf('list_schedules'), hasLength(1));
});
@@ -291,7 +309,7 @@ void main() {
});
await pumpScheduleSection(tester, gateway: gateway);
await tester.tap(find.byKey(scheduleRowDeleteKey(8)));
await _pick(tester, scheduleRowDeleteKey(8), 8);
await tester.pumpAndSettle();
expect(find.text('Delete Research batteries?'), findsOneWidget);
expect(
@@ -304,7 +322,7 @@ void main() {
await tester.pumpAndSettle();
expect(gateway.callsOf('delete_schedule'), isEmpty);
await tester.tap(find.byKey(scheduleRowDeleteKey(8)));
await _pick(tester, scheduleRowDeleteKey(8), 8);
await tester.pumpAndSettle();
await tester.tap(find.byKey(scheduleDeleteConfirmKey));
await tester.pumpAndSettle();
@@ -333,7 +351,7 @@ void main() {
});
await pumpScheduleSection(tester, gateway: gateway);
await tester.tap(find.byKey(scheduleRowDeleteKey(8)));
await _pick(tester, scheduleRowDeleteKey(8), 8);
await tester.pumpAndSettle();
await tester.tap(find.byKey(scheduleDeleteConfirmKey));
await tester.pumpAndSettle();
@@ -392,10 +410,10 @@ void main() {
expect(tester.takeException(), isNull);
expect(find.byKey(scheduleAddKey), findsOneWidget);
await tester.ensureVisible(find.byKey(scheduleRowDeleteKey(8)));
await tester.pumpAndSettle();
await _openMenu(tester, 8);
expect(find.byKey(scheduleRowEditKey(8)), findsOneWidget);
expect(find.byKey(scheduleRowToggleKey(8)), findsOneWidget);
expect(find.byKey(scheduleRowDeleteKey(8)), findsOneWidget);
expect(tester.takeException(), isNull);
}
});