chain-studio/test/guided_setup_test.dart
flemming-it c9fa068991 feat(studio): guided-setup wizard (reuses chain init engine)
A Welcome 'Setup assistant' button opens a wizard that collects
scenario / intent / target (+ approval & data-local toggles), then calls
`chain init --answers` to preview the assembled plan and `--apply --force`
to write the config — reusing the Rust deterministic engine, no logic
duplicated. New SystemActions.chainInit; copyable errors via
showFaiProcessError; EN+DE l10n. analyze clean; smoke test + existing
welcome/sidebar tests pass.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
2026-06-21 21:04:13 +02:00

30 lines
1.2 KiB
Dart

// 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.
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()),
),
);
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);
});
}