import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/main.dart'; void main() { for (final width in [390.0, 1000.0]) { testWidgets( 'Material shell adapts at width $width and supports large text', (tester) async { tester.view.physicalSize = Size(width, 900); tester.view.devicePixelRatio = 1; addTearDown(tester.view.resetPhysicalSize); addTearDown(tester.view.resetDevicePixelRatio); await tester.pumpWidget( const MaterialApp( home: MediaQuery( data: MediaQueryData(textScaler: TextScaler.linear(2)), child: AdaptiveShell(), ), ), ); expect(find.text('Pipelines'), findsWidgets); expect(find.text('Pipelines — Not implemented'), findsOneWidget); expect( find.byType(NavigationBar), width < 600 ? findsOneWidget : findsNothing, ); expect( find.byType(NavigationRail), width >= 600 ? findsOneWidget : findsNothing, ); await tester.tap(find.text('Runs').last); await tester.pumpAndSettle(); expect(find.text('Runs — Not implemented'), findsOneWidget); }, ); } testWidgets('Cupertino shell uses native navigation controls', ( tester, ) async { await tester.pumpWidget(const MyApp(cupertino: true)); expect(find.byType(CupertinoNavigationBar), findsOneWidget); expect(find.byType(CupertinoTabBar), findsOneWidget); expect(find.text('Pipelines — Not implemented'), findsOneWidget); }); testWidgets('destination content can be supplied by integration', ( tester, ) async { await tester.pumpWidget( MaterialApp( home: AdaptiveShell( destinationBodies: { AppDestination.pipelines: (_) => const Text('Injected pipelines screen'), }, ), ), ); expect(find.text('Injected pipelines screen'), findsOneWidget); expect(find.text('Pipelines — Not implemented'), findsNothing); }); }