// Widget smoke-test for the FlowEditorPage. // // Platform.environment is read-only from inside the test // isolate, so we can't redirect HOME to a temp directory. // Instead this test pumps the page and verifies that the // widget tree builds without throwing — exercising the // missing-directory empty-state path on hosts without // ~/.fai/data/flows. import 'package:fai_studio/l10n/app_localizations.dart'; import 'package:fai_studio/pages/flow_editor.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { Widget wrap() { return MaterialApp( locale: const Locale('en'), supportedLocales: const [Locale('en'), Locale('de')], localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], home: const FlowEditorPage(), ); } testWidgets('builds without throwing + shows expected toolbar buttons', (tester) async { await tester.pumpWidget(wrap()); await tester.pump(const Duration(milliseconds: 100)); expect(find.text('New flow'), findsOneWidget); expect(find.text('Save'), findsOneWidget); expect(find.text('Run'), findsOneWidget); // Without an open file, the empty-state title shows. expect(find.text('No flow open'), findsAtLeastNWidgets(1)); }); }