feat: guided-setup wizard — localized explained options + plain-language plan
Some checks failed
Security / Security check (push) Failing after 1s
Some checks failed
Security / Security check (push) Failing after 1s
Reworks the Setup-Assistent toward the zero-learning-curve bar
(docs/architecture/guided-setup.md, phase 1.1):
- Every scenario/intent/target choice is now a localized option CARD
with a one-line plain-language explanation of what it configures
(DE+EN, Sie-form) — replacing the bare dropdowns whose labels were
English enum humanizations ('Regulated Production', 'This Laptop').
- Three explained steps with a 'Schritt n von 3' progress line
(stakes → task → environment); the two adaptive toggles move to the
last step in plain language (no 'air-gapped' jargon).
- The review step renders a localized PLAIN-LANGUAGE summary built
from 'chain init --answers --plan-json' (the structured SetupPlan) —
'Ch∆In richtet einen regulierten Betrieb ein: signierte Module
verlangt · … · geändert wird nur ~/.chain/config.yaml' — instead of
echoing the CLI's English prose. Warns when an existing config will
be overwritten. After apply: a plain 'Fertig' + next steps.
flutter analyze clean; widget tests for the step flow + German option
labels. Remaining per plan: clickable follow-up actions, signature
dead-end fix, placement/auto-open, and the LLM free-text path.
Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
parent
0073d77a67
commit
140408d26a
7 changed files with 1133 additions and 146 deletions
|
|
@ -1,30 +1,78 @@
|
|||
// Smoke test for the guided-setup wizard: it mounts and renders its
|
||||
// first step (three choice dropdowns) without touching the CLI. The
|
||||
// `chain init` shell-out only happens on Next/Apply, so mounting is
|
||||
// side-effect-free and safe to assert in a widget test.
|
||||
// Guided-setup wizard — the three explained answer steps. Verifies
|
||||
// that options render as localized cards with their one-line
|
||||
// explanation (no English enum humanization) and that Weiter/Zurück
|
||||
// walk the steps. The review step calls the CLI (a subprocess) and is
|
||||
// out of scope for a widget test.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:chain_studio/l10n/app_localizations.dart';
|
||||
import 'package:chain_studio/widgets/guided_setup_dialog.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('guided setup wizard mounts and shows the first step',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
locale: const Locale('en'),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: const Scaffold(body: GuidedSetupDialog()),
|
||||
Widget _host() => MaterialApp(
|
||||
locale: const Locale('de'),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Builder(
|
||||
builder: (context) => Scaffold(
|
||||
body: Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: () => GuidedSetupDialog.show(context),
|
||||
child: const Text('open'),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Title from l10n + the three scenario/intent/target dropdowns.
|
||||
expect(find.text('Setup assistant'), findsWidgets);
|
||||
expect(find.byType(DropdownButton<String>), findsNWidgets(3));
|
||||
// The "Next" action is present (advances to the review/apply step).
|
||||
expect(find.widgetWithText(FilledButton, 'Next'), findsOneWidget);
|
||||
void main() {
|
||||
testWidgets('step 1 shows scenario options in German with explanations', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(_host());
|
||||
await tester.tap(find.text('open'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Step counter + localized (German) scenario labels, not the
|
||||
// English enum humanization.
|
||||
expect(find.text('Schritt 1 von 3'), findsOneWidget);
|
||||
expect(find.text('Regulierter Produktivbetrieb'), findsOneWidget);
|
||||
expect(find.text('Erst mal ausprobieren'), findsOneWidget);
|
||||
// Each option carries its one-line explanation.
|
||||
expect(
|
||||
find.textContaining('menschliche Freigabe vor jedem KI-Schritt'),
|
||||
findsOneWidget,
|
||||
);
|
||||
// No leaked English enum labels.
|
||||
expect(find.text('Regulated Production'), findsNothing);
|
||||
expect(find.text('Trying Out'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('Weiter/Zurück walk the three answer steps', (tester) async {
|
||||
await tester.pumpWidget(_host());
|
||||
await tester.tap(find.text('open'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Step 1 → 2 (task).
|
||||
await tester.tap(find.text('Weiter'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Schritt 2 von 3'), findsOneWidget);
|
||||
expect(find.text('Text aus Dokumenten extrahieren'), findsOneWidget);
|
||||
|
||||
// Step 2 → 3 (environment) shows the two plain-language toggles.
|
||||
await tester.tap(find.text('Weiter'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Schritt 3 von 3'), findsOneWidget);
|
||||
expect(find.text('Dieser Rechner'), findsOneWidget);
|
||||
expect(
|
||||
find.text('Vor jedem KI-Schritt einen Menschen um Freigabe bitten'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// Zurück returns to step 2.
|
||||
await tester.tap(find.text('Zurück'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Schritt 2 von 3'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue