// First-run gate: on a fresh install the app opens INTO the setup // (embedded wizard as the page), with an explicit skip. Setup // before the app — not a dialog over a shell that isn't set up. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:chain_studio/l10n/app_localizations.dart'; import 'package:chain_studio/pages/setup_gate.dart'; void main() { testWidgets('gate hosts the embedded wizard + a skip action', ( tester, ) async { var done = false; await tester.pumpWidget( MaterialApp( locale: const Locale('de'), localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, home: SetupGateScreen(onDone: () => done = true), ), ); await tester.pumpAndSettle(); // The wizard renders as PAGE content (step 1 visible, no dialog). expect(find.text('Worum geht es?'), findsOneWidget); expect(find.text('Erst mal ausprobieren'), findsOneWidget); expect(find.byType(AlertDialog), findsNothing); // Honest framing + a way past the gate. expect(find.textContaining('Nichts wird ohne Ihre'), findsOneWidget); await tester.ensureVisible(find.text('Später einrichten')); await tester.tap(find.text('Später einrichten')); await tester.pumpAndSettle(); expect(done, isTrue, reason: 'skip must hand control to the app'); }); testWidgets('cancel on step 1 also leaves the gate', (tester) async { var done = false; await tester.pumpWidget( MaterialApp( locale: const Locale('de'), localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, home: SetupGateScreen(onDone: () => done = true), ), ); await tester.pumpAndSettle(); await tester.ensureVisible(find.text('Abbrechen')); await tester.tap(find.text('Abbrechen')); await tester.pumpAndSettle(); expect(done, isTrue); }); }