chain-studio/test/responsive_test.dart
flemming-it da58125f20
Some checks are pending
Security / Security check (push) Waiting to run
fix(ui): WCAG light-theme accent, overflow-safe audit page, formal address
Accessibility/responsive audit pass with two new permanent test
gates (test/a11y_test.dart: WCAG text contrast + labeled tap
targets on every page in both themes; test/responsive_test.dart:
no layout overflow at 800/960/1280/1920 px). Findings fixed:

- Light theme primary/tertiary sky-500 → sky-700: white text on
  the lighter accent only reached 2.8:1 (welcome CTA, active
  sidebar label); sky-700 clears WCAG AA at ~5.9:1. Dark theme
  unchanged (already compliant). FABs now follow the same accent
  instead of Material 3's washed-out tonal default.
- Audit page: filter chips collapse into a checkmark popup menu
  below 900 px window width (app bar overflowed); the live-status
  bar's left text is now Expanded with ellipsis so the row can
  shrink, and the disconnected state's copyable error gets the
  full remaining width.
- German strings now use formal address consistently (~20 strings
  still used du-forms next to Sie-forms on welcome/setup), the
  audit event-type chip "Step" is "Schritt", and the doctor
  page's event count pluralises correctly in both languages.

flutter analyze clean, 64 tests green. Screenshot pass light+dark
via the guide-shots harness (verified parity, no overflows).

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
2026-07-15 04:34:19 +02:00

61 lines
1.8 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) {
await tester.tap(find.byKey(ValueKey('sidebar-item-$id')));
await tester.pump(const Duration(milliseconds: 400));
expect(
tester.takeException(),
isNull,
reason: 'page "$id" at ${entry.key} threw during layout',
);
}
});
}
}