import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/updates/launch_update_dialog.dart'; void main() { for (final (platform, sentence, action) in [ ('linux', 'installs it and restarts', 'Install and restart'), ('macos', 'extract the archive', 'Download'), ]) { testWidgets('$platform prompt identifies source and its action', ( tester, ) async { await tester.pumpWidget( MaterialApp( home: Builder( builder: (context) => TextButton( onPressed: () => showLaunchUpdateDialog( context, web: false, cupertino: false, nativePlatform: platform, sourceName: 'Home Linux', ), child: const Text('Check'), ), ), ), ); await tester.tap(find.text('Check')); await tester.pumpAndSettle(); expect(find.textContaining('from Home Linux'), findsOneWidget); expect(find.textContaining(sentence), findsOneWidget); expect(find.text(action), findsOneWidget); expect(find.textContaining('Android'), findsNothing); }); } }