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>
72 lines
2.3 KiB
Dart
72 lines
2.3 KiB
Dart
// Responsive sweep: every sidebar page must lay out without
|
|
// RenderFlex/RenderBox overflow at the window sizes operators
|
|
// actually use — a small laptop split-screen, the macOS default
|
|
// window, and a full HD display. Overflow errors surface as test
|
|
// failures via FlutterError.onError, so a regression in any page's
|
|
// layout at any of these sizes fails this suite.
|
|
//
|
|
// Navigation mirrors sidebar_test.dart (fixed pumps; the app never
|
|
// "settles" because of long-lived timers).
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:chain_studio/data/hub.dart';
|
|
import 'package:chain_studio/main.dart';
|
|
|
|
import 'support/fake_hub.dart';
|
|
|
|
const _destinations = <String>[
|
|
'welcome',
|
|
'store',
|
|
'doctor',
|
|
'flows',
|
|
'audit',
|
|
'approvals',
|
|
'runs',
|
|
'federation',
|
|
];
|
|
|
|
const _sizes = <String, Size>{
|
|
'tiny (800x600)': Size(800, 600),
|
|
'small (960x600)': Size(960, 600),
|
|
'default (1280x800)': Size(1280, 800),
|
|
'large (1920x1080)': Size(1920, 1080),
|
|
};
|
|
|
|
void main() {
|
|
for (final entry in _sizes.entries) {
|
|
testWidgets('all pages lay out without overflow — ${entry.key}',
|
|
(tester) async {
|
|
// Hermetic: pages render against the scriptable fake, never a
|
|
// hub that happens to listen on the operator's machine.
|
|
installFakeHub();
|
|
tester.view.physicalSize = entry.value;
|
|
tester.view.devicePixelRatio = 1.0;
|
|
addTearDown(tester.view.reset);
|
|
|
|
await tester.pumpWidget(
|
|
const StudioApp(
|
|
initialThemeMode: ThemeModeValue.dark,
|
|
initialLocale: Locale('de'),
|
|
),
|
|
);
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
|
|
for (final id in _destinations) {
|
|
// The destinations list scrolls by design: at 600-px-high
|
|
// windows the rail (destinations + search row + footer)
|
|
// exceeds the viewport, so bring the item into view first.
|
|
final item = find.byKey(ValueKey('sidebar-item-$id'));
|
|
await tester.scrollUntilVisible(item, 40,
|
|
scrollable: find.byType(Scrollable).first);
|
|
await tester.tap(item);
|
|
await tester.pump(const Duration(milliseconds: 400));
|
|
expect(
|
|
tester.takeException(),
|
|
isNull,
|
|
reason: 'page "$id" at ${entry.key} threw during layout',
|
|
);
|
|
}
|
|
});
|
|
}
|
|
}
|