From 2a1cbc82c3ae0286983c47de7b338d2bd3bf4e83 Mon Sep 17 00:00:00 2001 From: flemming-it Date: Wed, 15 Jul 2026 04:53:03 +0200 Subject: [PATCH] test(setup): pin the English wizard variant The wizard's widget tests all ran in German, leaving the English variant unverified (open follow-up from the setup redesign). One EN walk now pins the localized step counter, scenario cards with explanations, environment step and Next/Back navigation, and asserts no German strings leak through. Signed-off-by: flemming-it --- test/guided_setup_test.dart | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/test/guided_setup_test.dart b/test/guided_setup_test.dart index 94c9bee..6e640fd 100644 --- a/test/guided_setup_test.dart +++ b/test/guided_setup_test.dart @@ -415,6 +415,56 @@ void main() { }); }); + group('English variant', () { + Widget hostEn() => MaterialApp( + locale: const Locale('en'), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + home: Builder( + builder: (context) => Scaffold( + body: Center( + child: ElevatedButton( + onPressed: () => GuidedSetupDialog.show(context), + child: const Text('open'), + ), + ), + ), + ), + ); + + testWidgets('walks the three steps with localized cards, no German leaks', ( + tester, + ) async { + await tester.pumpWidget(hostEn()); + await tester.tap(find.text('open')); + await tester.pumpAndSettle(); + + // Step 1: English counter + scenario cards with explanations. + expect(find.text('Step 1 of 3'), findsOneWidget); + expect(find.text('Regulated production'), findsOneWidget); + expect(find.text('Just trying it out'), findsOneWidget); + expect( + find.textContaining('human approval before every AI step'), + findsOneWidget, + ); + // Nothing renders in the other locale. + expect(find.text('Schritt 1 von 3'), findsNothing); + expect(find.text('Regulierter Produktivbetrieb'), findsNothing); + + // Steps 2 and 3 walk with the English buttons. + await tester.tap(find.text('Next')); + await tester.pumpAndSettle(); + expect(find.text('Step 2 of 3'), findsOneWidget); + await tester.tap(find.text('Next')); + await tester.pumpAndSettle(); + expect(find.text('Step 3 of 3'), findsOneWidget); + expect(find.text('This computer'), findsOneWidget); + await tester.tap(find.text('Back')); + await tester.pumpAndSettle(); + expect(find.text('Step 2 of 3'), findsOneWidget); + }); + }); + group('parseSetupSuggestion', () { test('accepts a valid JSON object embedded in prose', () { final r = parseSetupSuggestion(