chain-studio/test/responsive_test.dart
flemming-it c436e12601
Some checks are pending
Security / Security check (push) Waiting to run
feat(nav): discoverable sidebar — instant tooltips, shortcuts made visible, pinnable rail
The icon-only rail forced first-time users to guess (usertest:
Senior, a11y, UX personas). Three changes:
- Nav tooltips appear instantly and carry the page shortcut
  (Cmd+1..9, Ctrl on non-mac — Ctrl activators added); expanded
  labels show the same hint. Explicit button semantics for
  screen readers on every destination.
- A visible 'Search & commands' row above the footer opens the
  existing Cmd+K palette, which nothing in the UI advertised.
- Settings -> Appearance gains 'Keep the navigation expanded':
  pins the rail with permanent labels (persisted preference).
Footer strip and pillar toggle made overflow-safe for the
animating rail; responsive test scrolls the by-design scrollable
destinations list.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
2026-07-17 23:36:33 +02:00

67 lines
2.1 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';
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 {
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',
);
}
});
}
}