Clarify empty server states

Show calm, actionable empty states for pipelines, runs, and chats while keeping filtered and failed loads distinct. Add focused widget coverage and document the remaining verification limits.
This commit is contained in:
2026-11-12 01:02:31 +00:00
parent 4f1b45571f
commit dbd525a7b1
11 changed files with 201 additions and 17 deletions
@@ -17,7 +17,7 @@ void main() {
expect(find.byType(Scaffold), findsWidgets);
const message = 'No chat sessions on this server yet.';
const message = 'No chats yet. Use New chat to start one.';
expect(find.text(message), findsOneWidget);
expectNormalTextStyle(tester, message);
});
@@ -39,7 +39,7 @@ void main() {
'for this operator';
expect(find.text(message), findsOneWidget);
expectNormalTextStyle(tester, message);
expect(find.text('No chat sessions on this server yet.'), findsNothing);
expect(find.text('No chats yet. Use New chat to start one.'), findsNothing);
expect(
find.ancestor(
of: find.text('Retry'),
@@ -91,7 +91,10 @@ void main() {
) async {
final gateway = FakeChatGateway();
await pumpMaterialChat(tester, gateway);
expect(find.text('No chat sessions on this server yet.'), findsOneWidget);
expect(
find.text('No chats yet. Use New chat to start one.'),
findsOneWidget,
);
expect(find.textContaining('No chats match'), findsNothing);
});
@@ -111,7 +114,7 @@ void main() {
'Bad state: server unavailable while listing chat sessions '
'for this operator';
expect(find.text(message), findsOneWidget);
expect(find.text('No chat sessions on this server yet.'), findsNothing);
expect(find.text('No chats yet. Use New chat to start one.'), findsNothing);
final messageBox = tester.renderObject<RenderBox>(find.text(message));
expect(
messageBox.size.height,
@@ -132,7 +132,7 @@ void main() {
const [],
const PipelineFilters(),
)?.message,
'No pipelines are defined on this server.',
'No pipelines yet.',
);
expect(pipelineListEmptyState(all, all, const PipelineFilters()), isNull);
});
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'fixtures.dart';
import 'test_helpers.dart';
/// A brand-new server: every list is empty and healthy.
FakeGateway emptyServerGateway() => FakeGateway(
(type, fields) => switch (type) {
'list_pipelines' => pipelineListReply(const []),
'list_runs' => runListReply(const []),
'list_schedules' => {'type': 'schedules', 'schedules': <dynamic>[]},
_ => errorReply('unexpected $type'),
},
);
void main() {
testWidgets(
'an empty server shows a calm no-pipelines state with the next step',
(tester) async {
await pumpWide(tester, emptyServerGateway());
expect(find.text('No pipelines yet.'), findsOneWidget);
expect(
find.text('Create one from a template in Templates.'),
findsOneWidget,
);
expect(find.text('Loading pipelines…'), findsNothing);
expect(find.byKey(const Key('pipeline-list')), findsNothing);
expect(find.textContaining('not defined'), findsNothing);
expect(find.text('Retry'), findsNothing);
expect(tester.takeException(), isNull);
},
);
testWidgets(
'a failed list stays an error and never reads as an empty server',
(tester) async {
await pumpWide(
tester,
gatewayFor(PipelineFixture(), listFails: true, summaries: const []),
);
expect(find.textContaining('server offline'), findsOneWidget);
expect(find.text('No pipelines yet.'), findsNothing);
expect(find.text('Loading pipelines…'), findsNothing);
expect(tester.takeException(), isNull);
},
);
}
@@ -98,8 +98,9 @@ void main() {
MaterialApp(home: PipelinesScreen(gateway: emptyGateway)),
);
await tester.pumpAndSettle();
expect(find.text('No pipelines yet.'), findsOneWidget);
expect(
find.text('No pipelines are defined on this server.'),
find.text('Create one from a template in Templates.'),
findsOneWidget,
);
});
@@ -162,9 +162,50 @@ void main() {
gateway.reply = {'runs': []};
await controller.load();
await tester.pumpAndSettle();
expect(find.text('No runs found.'), findsOneWidget);
expect(find.text('No runs yet.'), findsOneWidget);
expect(find.textContaining('Start one from Pipelines'), findsOneWidget);
expect(find.text('No runs found.'), findsNothing);
expect(find.textContaining('offline'), findsNothing);
expect(tester.takeException(), isNull);
// A filter that hides every run is a different state: say so and offer
// the filter as the way back, not a server with no runs.
controller.setStatus('failed');
await tester.pumpAndSettle();
expect(find.text('No runs found.'), findsOneWidget);
expect(find.text('No runs yet.'), findsNothing);
expect(
find.text('Try changing or clearing the filters.'),
findsOneWidget,
);
expect(tester.takeException(), isNull);
},
variant: TargetPlatformVariant.only(TargetPlatform.android),
);
testWidgets(
'an empty server with a search query reads as no match, not no runs',
(tester) async {
gateway.failure = null;
gateway.gate = null;
gateway.reply = {'runs': []};
await controller.load();
controller.setQuery('deploy');
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: RunsList(controller: controller, onSelected: (_) {}),
),
),
);
await tester.pumpAndSettle();
expect(find.text('No runs found.'), findsOneWidget);
expect(find.text('No runs yet.'), findsNothing);
expect(
find.text('Try changing or clearing the filters.'),
findsOneWidget,
);
expect(tester.takeException(), isNull);
},
variant: TargetPlatformVariant.only(TargetPlatform.android),
);