Files
pipelines/app/test/features/pipelines/pipelines_empty_server_test.dart
T
alan dbd525a7b1 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.
2026-11-12 01:02:31 +00:00

51 lines
1.6 KiB
Dart

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);
},
);
}