feat(test): hermetic hub fake + state-matrix sweep across all pages
The widget suites used to talk to whatever listens on the real endpoint — results depended on the operator's machine (a running hub fed real data into a11y/responsive runs and its gRPC channel timers caused the historic flake). Hardening round: - HubService.instance is now injectable (debugSetInstance); FakeHubService (test/support/fake_hub.dart) answers every member the pages touch with healthy-empty defaults and scripts per-RPC failures (UNIMPLEMENTED / UNAVAILABLE / detached gate) through a GrpcError-shaped fake. Unimplemented members are recorded and fail the sweep with the exact list. - state_matrix_test.dart pins the app-wide invariants for every sidebar page x hub condition: healthy => no unreachable claims and no raw error text; hub gone => honest unreachable states; UNIMPLEMENTED => never 'not reachable' while the sidebar shows connected; detached gate => plain-language feature-off state. - a11y + responsive sweeps now inject the fake (hermetic); the 6-minute idle-timer drain workaround is gone with the cause. Real bugs the new sweep caught immediately: - every data page (store, doctor, audit, approvals, federation) folded ANY load failure into 'hub not reachable' — the runs-page bug class; they now share HubLoadErrorView, which classifies into unreachable / needs-newer-hub / load-failed-with-copyable- detail (new generic DE+EN strings) - the approvals page's hidden tab had no future listener: a load failure there surfaced as an uncaught async error - the audit status bar rendered the raw gRPC error wall verbatim; it now shows the classified friendly headline (still selectable) Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
parent
adc5fc2311
commit
66b26304fd
19 changed files with 733 additions and 97 deletions
|
|
@ -89,6 +89,12 @@ class _ApprovalsPageState extends State<ApprovalsPage>
|
|||
limit: 200,
|
||||
project: project,
|
||||
);
|
||||
// Only the visible tab has a FutureBuilder listening; give the
|
||||
// hidden tab's future a silent listener so a load failure there
|
||||
// never surfaces as an uncaught async error (the FutureBuilder
|
||||
// that attaches on tab switch still receives the error).
|
||||
_pendingFuture.then((_) {}, onError: (_) {});
|
||||
_historyFuture.then((_) {}, onError: (_) {});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -331,7 +337,6 @@ class _PendingList extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l = AppLocalizations.of(context)!;
|
||||
return FutureBuilder<List<ApprovalRecord>>(
|
||||
future: future,
|
||||
|
|
@ -340,16 +345,7 @@ class _PendingList extends StatelessWidget {
|
|||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (snapshot.hasError) {
|
||||
return ChainEmptyState(
|
||||
icon: Icons.cloud_off_outlined,
|
||||
iconColor: theme.colorScheme.error,
|
||||
title: l.hubUnreachable,
|
||||
hint: l.hubUnreachableHint,
|
||||
action: FilledButton.tonal(
|
||||
onPressed: onRetry,
|
||||
child: Text(l.buttonRetry),
|
||||
),
|
||||
);
|
||||
return HubLoadErrorView(error: snapshot.error!, onRetry: onRetry);
|
||||
}
|
||||
final pending = snapshot.data ?? [];
|
||||
if (pending.isEmpty) {
|
||||
|
|
@ -513,7 +509,6 @@ class _HistoryList extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l = AppLocalizations.of(context)!;
|
||||
return FutureBuilder<List<ApprovalRecord>>(
|
||||
future: future,
|
||||
|
|
@ -522,16 +517,7 @@ class _HistoryList extends StatelessWidget {
|
|||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (snapshot.hasError) {
|
||||
return ChainEmptyState(
|
||||
icon: Icons.cloud_off_outlined,
|
||||
iconColor: theme.colorScheme.error,
|
||||
title: l.hubUnreachable,
|
||||
hint: l.hubUnreachableHint,
|
||||
action: FilledButton.tonal(
|
||||
onPressed: onRetry,
|
||||
child: Text(l.buttonRetry),
|
||||
),
|
||||
);
|
||||
return HubLoadErrorView(error: snapshot.error!, onRetry: onRetry);
|
||||
}
|
||||
final decided = snapshot.data ?? [];
|
||||
if (decided.isEmpty) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue