import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/artifacts/actions/artifact_transfer_io.dart' as transfer; import 'package:pipelines_app/features/artifacts/ui/artifact_html_view_native.dart'; final _linux = TargetPlatformVariant.only(TargetPlatform.linux); /// The Linux app has no web view and no file share sheet: it says so rather /// than failing to create the web view or throwing from Share. void main() { test('only Android, iOS and macOS have the HTML web view', () { for (final platform in TargetPlatform.values) { expect( inertHtmlViewSupported(platform), platform == TargetPlatform.android || platform == TargetPlatform.iOS || platform == TargetPlatform.macOS, reason: '$platform', ); } }); testWidgets('an HTML artifact on Linux explains why it is not previewed', ( tester, ) async { await tester.pumpWidget( const MaterialApp( home: Scaffold(body: InertHtmlView(html: '
report
')), ), ); expect(find.text(inertHtmlUnsupportedMessage), findsOneWidget); expect(tester.takeException(), isNull); // A new document does not reach for a web view either. await tester.pumpWidget( const MaterialApp( home: Scaffold(body: InertHtmlView(html: 'next
')), ), ); expect(tester.takeException(), isNull); }, variant: _linux); testWidgets('Linux offers Download but not Share', (tester) async { expect(transfer.artifactDownloadSupported, isTrue); expect(transfer.artifactShareSupported, isFalse); expect(transfer.artifactShareUnsupportedMessage, contains('Download')); }, variant: _linux); test('other native platforms keep Share', () { expect(transfer.artifactShareSupported, isTrue); expect(transfer.artifactShareUnsupportedMessage, isEmpty); }); }