From a8fc5d18f7094ed19fe236925f011580469ea814 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 17 Jul 2024 16:50:37 -0500 Subject: [PATCH] test: update tests --- ...ne_entertainment_system_localizations.dart | 195 ------------------ ...entertainment_system_localizations_en.dart | 41 ---- test/app/view/app_test.dart | 12 -- test/counter/cubit/counter_cubit_test.dart | 25 --- test/counter/view/counter_page_test.dart | 67 ------ test/helpers/helpers.dart | 2 +- .../{pump_app.dart => pump_experience.dart} | 4 +- ...rplane_entertainment_system_demo_test.dart | 56 +++++ .../left_side_navigation_rail_test.dart | 11 + test/src/demo/widgets/movie_card_test.dart | 21 ++ test/src/demo/widgets/music_card_test.dart | 21 ++ .../src/demo/widgets/top_button_bar_test.dart | 53 +++++ .../view/music_player_page_test.dart | 44 ++++ .../widgets/music_visualizer_test.dart | 46 +++++ .../src/overview/view/overview_page_test.dart | 29 +++ ...e_entertainment_system_thumbnail_test.dart | 16 ++ 16 files changed, 300 insertions(+), 343 deletions(-) delete mode 100644 lib/l10n/generated/airplane_entertainment_system_localizations.dart delete mode 100644 lib/l10n/generated/airplane_entertainment_system_localizations_en.dart delete mode 100644 test/app/view/app_test.dart delete mode 100644 test/counter/cubit/counter_cubit_test.dart delete mode 100644 test/counter/view/counter_page_test.dart rename test/helpers/{pump_app.dart => pump_experience.dart} (80%) create mode 100644 test/src/demo/view/airplane_entertainment_system_demo_test.dart create mode 100644 test/src/demo/widgets/left_side_navigation_rail_test.dart create mode 100644 test/src/demo/widgets/movie_card_test.dart create mode 100644 test/src/demo/widgets/music_card_test.dart create mode 100644 test/src/demo/widgets/top_button_bar_test.dart create mode 100644 test/src/music_player/view/music_player_page_test.dart create mode 100644 test/src/music_player/widgets/music_visualizer_test.dart create mode 100644 test/src/overview/view/overview_page_test.dart create mode 100644 test/thumbnail/airplane_entertainment_system_thumbnail_test.dart diff --git a/lib/l10n/generated/airplane_entertainment_system_localizations.dart b/lib/l10n/generated/airplane_entertainment_system_localizations.dart deleted file mode 100644 index b665b5d..0000000 --- a/lib/l10n/generated/airplane_entertainment_system_localizations.dart +++ /dev/null @@ -1,195 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/widgets.dart'; -import 'package:flutter_localizations/flutter_localizations.dart'; -import 'package:intl/intl.dart' as intl; - -import 'airplane_entertainment_system_localizations_en.dart'; - -/// Callers can lookup localized strings with an instance of AirplaneEntertainmentSystemLocalizations -/// returned by `AirplaneEntertainmentSystemLocalizations.of(context)`. -/// -/// Applications need to include `AirplaneEntertainmentSystemLocalizations.delegate()` in their app's -/// `localizationDelegates` list, and the locales they support in the app's -/// `supportedLocales` list. For example: -/// -/// ```dart -/// import 'generated/airplane_entertainment_system_localizations.dart'; -/// -/// return MaterialApp( -/// localizationsDelegates: AirplaneEntertainmentSystemLocalizations.localizationsDelegates, -/// supportedLocales: AirplaneEntertainmentSystemLocalizations.supportedLocales, -/// home: MyApplicationHome(), -/// ); -/// ``` -/// -/// ## Update pubspec.yaml -/// -/// Please make sure to update your pubspec.yaml to include the following -/// packages: -/// -/// ```yaml -/// dependencies: -/// # Internationalization support. -/// flutter_localizations: -/// sdk: flutter -/// intl: any # Use the pinned version from flutter_localizations -/// -/// # Rest of dependencies -/// ``` -/// -/// ## iOS Applications -/// -/// iOS applications define key application metadata, including supported -/// locales, in an Info.plist file that is built into the application bundle. -/// To configure the locales supported by your app, you’ll need to edit this -/// file. -/// -/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file. -/// Then, in the Project Navigator, open the Info.plist file under the Runner -/// project’s Runner folder. -/// -/// Next, select the Information Property List item, select Add Item from the -/// Editor menu, then select Localizations from the pop-up menu. -/// -/// Select and expand the newly-created Localizations item then, for each -/// locale your application supports, add a new item and select the locale -/// you wish to add from the pop-up menu in the Value field. This list should -/// be consistent with the languages listed in the AirplaneEntertainmentSystemLocalizations.supportedLocales -/// property. -abstract class AirplaneEntertainmentSystemLocalizations { - AirplaneEntertainmentSystemLocalizations(String locale) - : localeName = intl.Intl.canonicalizedLocale(locale.toString()); - - final String localeName; - - static AirplaneEntertainmentSystemLocalizations of(BuildContext context) { - return Localizations.of( - context, AirplaneEntertainmentSystemLocalizations)!; - } - - static const LocalizationsDelegate - delegate = _AirplaneEntertainmentSystemLocalizationsDelegate(); - - /// A list of this localizations delegate along with the default localizations - /// delegates. - /// - /// Returns a list of localizations delegates containing this delegate along with - /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, - /// and GlobalWidgetsLocalizations.delegate. - /// - /// Additional delegates can be added by appending to this list in - /// MaterialApp. This list does not have to be used at all if a custom list - /// of delegates is preferred or required. - static const List> localizationsDelegates = - >[ - delegate, - GlobalMaterialLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ]; - - /// A list of this localizations delegate's supported locales. - static const List supportedLocales = [Locale('en')]; - - /// The initial message of the experience - /// - /// In en, this message translates to: - /// **'Hello Experience'** - String get helloExperience; - - /// No description provided for @goodVibes. - /// - /// In en, this message translates to: - /// **'Good Vibes'** - String get goodVibes; - - /// No description provided for @multipleArtists. - /// - /// In en, this message translates to: - /// **'Multiple Artists'** - String get multipleArtists; - - /// No description provided for @minutesShort. - /// - /// In en, this message translates to: - /// **'mins'** - String get minutesShort; - - /// No description provided for @remaining. - /// - /// In en, this message translates to: - /// **'Remaining'** - String get remaining; - - /// No description provided for @hours. - /// - /// In en, this message translates to: - /// **'hours'** - String get hours; - - /// No description provided for @songs. - /// - /// In en, this message translates to: - /// **'songs'** - String get songs; - - /// No description provided for @welcomeMessage. - /// - /// In en, this message translates to: - /// **'Welcome on board'** - String get welcomeMessage; - - /// No description provided for @welcomeSubtitle. - /// - /// In en, this message translates to: - /// **'Lunch will be served in\n10 minutes'** - String get welcomeSubtitle; - - /// No description provided for @assistButton. - /// - /// In en, this message translates to: - /// **'ASSIST'** - String get assistButton; - - /// No description provided for @thunderstorms. - /// - /// In en, this message translates to: - /// **'Thunderstorms'** - String get thunderstorms; -} - -class _AirplaneEntertainmentSystemLocalizationsDelegate - extends LocalizationsDelegate { - const _AirplaneEntertainmentSystemLocalizationsDelegate(); - - @override - Future load(Locale locale) { - return SynchronousFuture( - lookupAirplaneEntertainmentSystemLocalizations(locale)); - } - - @override - bool isSupported(Locale locale) => - ['en'].contains(locale.languageCode); - - @override - bool shouldReload(_AirplaneEntertainmentSystemLocalizationsDelegate old) => - false; -} - -AirplaneEntertainmentSystemLocalizations - lookupAirplaneEntertainmentSystemLocalizations(Locale locale) { - // Lookup logic when only language code is specified. - switch (locale.languageCode) { - case 'en': - return AirplaneEntertainmentSystemLocalizationsEn(); - } - - throw FlutterError( - 'AirplaneEntertainmentSystemLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' - 'an issue with the localizations generation tool. Please file an issue ' - 'on GitHub with a reproducible sample app and the gen-l10n configuration ' - 'that was used.'); -} diff --git a/lib/l10n/generated/airplane_entertainment_system_localizations_en.dart b/lib/l10n/generated/airplane_entertainment_system_localizations_en.dart deleted file mode 100644 index a19e8f4..0000000 --- a/lib/l10n/generated/airplane_entertainment_system_localizations_en.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'airplane_entertainment_system_localizations.dart'; - -/// The translations for English (`en`). -class AirplaneEntertainmentSystemLocalizationsEn - extends AirplaneEntertainmentSystemLocalizations { - AirplaneEntertainmentSystemLocalizationsEn([String locale = 'en']) - : super(locale); - - @override - String get helloExperience => 'Hello Experience'; - - @override - String get goodVibes => 'Good Vibes'; - - @override - String get multipleArtists => 'Multiple Artists'; - - @override - String get minutesShort => 'mins'; - - @override - String get remaining => 'Remaining'; - - @override - String get hours => 'hours'; - - @override - String get songs => 'songs'; - - @override - String get welcomeMessage => 'Welcome on board'; - - @override - String get welcomeSubtitle => 'Lunch will be served in\n10 minutes'; - - @override - String get assistButton => 'ASSIST'; - - @override - String get thunderstorms => 'Thunderstorms'; -} diff --git a/test/app/view/app_test.dart b/test/app/view/app_test.dart deleted file mode 100644 index 4e71bea..0000000 --- a/test/app/view/app_test.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:airplane_entertainment_system/app/app.dart'; -import 'package:airplane_entertainment_system/counter/counter.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - group('App', () { - testWidgets('renders CounterPage', (tester) async { - await tester.pumpWidget(const App()); - expect(find.byType(CounterPage), findsOneWidget); - }); - }); -} diff --git a/test/counter/cubit/counter_cubit_test.dart b/test/counter/cubit/counter_cubit_test.dart deleted file mode 100644 index 2fc6bbe..0000000 --- a/test/counter/cubit/counter_cubit_test.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:airplane_entertainment_system/counter/counter.dart'; -import 'package:bloc_test/bloc_test.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - group('CounterCubit', () { - test('initial state is 0', () { - expect(CounterCubit().state, equals(0)); - }); - - blocTest( - 'emits [1] when increment is called', - build: CounterCubit.new, - act: (cubit) => cubit.increment(), - expect: () => [equals(1)], - ); - - blocTest( - 'emits [-1] when decrement is called', - build: CounterCubit.new, - act: (cubit) => cubit.decrement(), - expect: () => [equals(-1)], - ); - }); -} diff --git a/test/counter/view/counter_page_test.dart b/test/counter/view/counter_page_test.dart deleted file mode 100644 index a4b8fb4..0000000 --- a/test/counter/view/counter_page_test.dart +++ /dev/null @@ -1,67 +0,0 @@ -import 'package:airplane_entertainment_system/counter/counter.dart'; -import 'package:bloc_test/bloc_test.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:mocktail/mocktail.dart'; - -import '../../helpers/helpers.dart'; - -class MockCounterCubit extends MockCubit implements CounterCubit {} - -void main() { - group('CounterPage', () { - testWidgets('renders CounterView', (tester) async { - await tester.pumpApp(const CounterPage()); - expect(find.byType(CounterView), findsOneWidget); - }); - }); - - group('CounterView', () { - late CounterCubit counterCubit; - - setUp(() { - counterCubit = MockCounterCubit(); - }); - - testWidgets('renders current count', (tester) async { - const state = 42; - when(() => counterCubit.state).thenReturn(state); - await tester.pumpApp( - BlocProvider.value( - value: counterCubit, - child: const CounterView(), - ), - ); - expect(find.text('$state'), findsOneWidget); - }); - - testWidgets('calls increment when increment button is tapped', - (tester) async { - when(() => counterCubit.state).thenReturn(0); - when(() => counterCubit.increment()).thenReturn(null); - await tester.pumpApp( - BlocProvider.value( - value: counterCubit, - child: const CounterView(), - ), - ); - await tester.tap(find.byIcon(Icons.add)); - verify(() => counterCubit.increment()).called(1); - }); - - testWidgets('calls decrement when decrement button is tapped', - (tester) async { - when(() => counterCubit.state).thenReturn(0); - when(() => counterCubit.decrement()).thenReturn(null); - await tester.pumpApp( - BlocProvider.value( - value: counterCubit, - child: const CounterView(), - ), - ); - await tester.tap(find.byIcon(Icons.remove)); - verify(() => counterCubit.decrement()).called(1); - }); - }); -} diff --git a/test/helpers/helpers.dart b/test/helpers/helpers.dart index b15fe65..6201182 100644 --- a/test/helpers/helpers.dart +++ b/test/helpers/helpers.dart @@ -1 +1 @@ -export 'pump_app.dart'; +export 'pump_experience.dart'; diff --git a/test/helpers/pump_app.dart b/test/helpers/pump_experience.dart similarity index 80% rename from test/helpers/pump_app.dart rename to test/helpers/pump_experience.dart index feea5b5..d240c92 100644 --- a/test/helpers/pump_app.dart +++ b/test/helpers/pump_experience.dart @@ -2,8 +2,8 @@ import 'package:airplane_entertainment_system/l10n/l10n.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -extension PumpApp on WidgetTester { - Future pumpApp(Widget widget) { +extension PumpExperience on WidgetTester { + Future pumpExperience(Widget widget) { return pumpWidget( MaterialApp( localizationsDelegates: AppLocalizations.localizationsDelegates, diff --git a/test/src/demo/view/airplane_entertainment_system_demo_test.dart b/test/src/demo/view/airplane_entertainment_system_demo_test.dart new file mode 100644 index 0000000..d0851c6 --- /dev/null +++ b/test/src/demo/view/airplane_entertainment_system_demo_test.dart @@ -0,0 +1,56 @@ +import 'package:airplane_entertainment_system/demo/demo.dart'; +import 'package:airplane_entertainment_system/music_player/music_player.dart'; +import 'package:airplane_entertainment_system/overview/overview.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../../helpers/helpers.dart'; + +void main() { + group('AirplaneEntertainmentSystemDemo', () { + testWidgets('shows LeftSideNavigationRail', (tester) async { + await tester.pumpExperience(const AirplaneEntertainmentSystemDemo()); + + expect(find.byType(LeftSideNavigationRail), findsOneWidget); + }); + testWidgets('shows TopButtonBar', (tester) async { + await tester.pumpExperience(const AirplaneEntertainmentSystemDemo()); + + expect(find.byType(TopButtonBar), findsOneWidget); + }); + + testWidgets('contains background', (tester) async { + await tester.pumpExperience(const AirplaneEntertainmentSystemDemo()); + + expect(find.byType(DemoBackground), findsOneWidget); + }); + + testWidgets('shows OverviewPage initially', (tester) async { + await tester.pumpExperience(const AirplaneEntertainmentSystemDemo()); + + expect(find.byType(OverviewPage), findsOneWidget); + }); + + testWidgets('shows MusicPlayerPage when icon is selected', (tester) async { + await tester.pumpExperience(const AirplaneEntertainmentSystemDemo()); + + await tester.tap(find.byIcon(Icons.headphones)); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 650)); + + expect(find.byType(MusicPlayerPage), findsOneWidget); + }); + + testWidgets('shows OverviewPage when icon is selected', (tester) async { + await tester.pumpExperience(const AirplaneEntertainmentSystemDemo()); + + await tester.tap(find.byIcon(Icons.headphones)); + await tester.pump(const Duration(milliseconds: 600)); + + await tester.tap(find.byIcon(Icons.airplanemode_active)); + await tester.pump(const Duration(milliseconds: 600)); + + expect(find.byType(OverviewPage), findsOneWidget); + }); + }); +} diff --git a/test/src/demo/widgets/left_side_navigation_rail_test.dart b/test/src/demo/widgets/left_side_navigation_rail_test.dart new file mode 100644 index 0000000..0c93094 --- /dev/null +++ b/test/src/demo/widgets/left_side_navigation_rail_test.dart @@ -0,0 +1,11 @@ +import 'package:airplane_entertainment_system/demo/demo.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('CustomRectangularShape', () { + test('verifies should not reclip', () async { + final path = CustomRectangularShape(); + expect(path.shouldReclip(path), false); + }); + }); +} diff --git a/test/src/demo/widgets/movie_card_test.dart b/test/src/demo/widgets/movie_card_test.dart new file mode 100644 index 0000000..f23da50 --- /dev/null +++ b/test/src/demo/widgets/movie_card_test.dart @@ -0,0 +1,21 @@ +import 'package:airplane_entertainment_system/l10n/l10n.dart'; +import 'package:airplane_entertainment_system/overview/overview.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('Movie Card', () { + testWidgets('finds one MovieCard Widget', (tester) async { + await tester.pumpWidget( + const MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + home: Scaffold( + body: MovieCard(), + ), + ), + ); + expect(find.byType(MovieCard), findsOneWidget); + }); + }); +} diff --git a/test/src/demo/widgets/music_card_test.dart b/test/src/demo/widgets/music_card_test.dart new file mode 100644 index 0000000..055cd99 --- /dev/null +++ b/test/src/demo/widgets/music_card_test.dart @@ -0,0 +1,21 @@ +import 'package:airplane_entertainment_system/l10n/l10n.dart'; +import 'package:airplane_entertainment_system/overview/overview.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('Music Card', () { + testWidgets('finds one MusicCard Widget', (tester) async { + await tester.pumpWidget( + const MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + home: Scaffold( + body: MusicCard(), + ), + ), + ); + expect(find.byType(MusicCard), findsOneWidget); + }); + }); +} diff --git a/test/src/demo/widgets/top_button_bar_test.dart b/test/src/demo/widgets/top_button_bar_test.dart new file mode 100644 index 0000000..6bf2498 --- /dev/null +++ b/test/src/demo/widgets/top_button_bar_test.dart @@ -0,0 +1,53 @@ +import 'package:airplane_entertainment_system/demo/demo.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../../helpers/helpers.dart'; + +void main() { + group('TopButtonBar', () { + testWidgets('contains power button', (tester) async { + await tester.pumpExperience( + const Scaffold( + body: TopButtonBar(), + ), + ); + + expect(find.byIcon(Icons.power_settings_new), findsOneWidget); + await tester.tap(find.byIcon(Icons.power_settings_new)); + }); + + testWidgets('contains brightness button', (tester) async { + await tester.pumpExperience( + const Scaffold( + body: TopButtonBar(), + ), + ); + + expect(find.byIcon(Icons.brightness_7), findsOneWidget); + await tester.tap(find.byIcon(Icons.brightness_7)); + }); + + testWidgets('contains volume button', (tester) async { + await tester.pumpExperience( + const Scaffold( + body: TopButtonBar(), + ), + ); + + expect(find.byIcon(Icons.volume_up), findsOneWidget); + await tester.tap(find.byIcon(Icons.volume_up)); + }); + + testWidgets('contains assist button', (tester) async { + await tester.pumpExperience( + const Scaffold( + body: TopButtonBar(), + ), + ); + + expect(find.byIcon(Icons.support), findsOneWidget); + await tester.tap(find.byIcon(Icons.support)); + }); + }); +} diff --git a/test/src/music_player/view/music_player_page_test.dart b/test/src/music_player/view/music_player_page_test.dart new file mode 100644 index 0000000..08a00be --- /dev/null +++ b/test/src/music_player/view/music_player_page_test.dart @@ -0,0 +1,44 @@ +import 'package:airplane_entertainment_system/music_player/view/view.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../../helpers/pump_experience.dart'; + +void main() { + group('MusicPlayerPage', () { + testWidgets('contains MusicPlayerPage', (tester) async { + await tester.pumpExperience( + const Scaffold( + body: MusicPlayerPage(), + ), + ); + + expect(find.byType(MusicMenuView), findsOneWidget); + expect(find.byType(MusicPlayerView), findsOneWidget); + }); + + testWidgets('contains back button', (tester) async { + await tester.pumpExperience( + const Scaffold( + body: MusicPlayerPage(), + ), + ); + + expect(find.byIcon(Icons.arrow_back_ios_new_rounded), findsOneWidget); + + await tester.tap(find.byIcon(Icons.arrow_back_ios_new_rounded)); + }); + + testWidgets('contains slider and changing it does nothing', (tester) async { + await tester.pumpExperience( + const Scaffold( + body: MusicPlayerPage(), + ), + ); + + expect(find.byType(Slider), findsOneWidget); + final slider = tester.widget(find.byType(Slider)); + slider.onChanged!(0); + }); + }); +} diff --git a/test/src/music_player/widgets/music_visualizer_test.dart b/test/src/music_player/widgets/music_visualizer_test.dart new file mode 100644 index 0000000..c8f645f --- /dev/null +++ b/test/src/music_player/widgets/music_visualizer_test.dart @@ -0,0 +1,46 @@ +import 'dart:convert'; + +import 'package:airplane_entertainment_system/music_player/music_player.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +const _data = [ + [0.0, 0.0, 0.0, 0.3, 0.4], + [1.0, 1.0, 1.0, 0.5, 0.5], +]; + +class FakeAssetBundle extends Fake implements AssetBundle { + @override + Future loadString(String key, {bool cache = true}) { + if (key == 'assets/spectrogram.json') { + return Future.value(jsonEncode(_data)); + } + + throw UnimplementedError(); + } +} + +void main() { + group('MusicVisualizer', () { + testWidgets('loads data and plays an animation', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: DefaultAssetBundle( + bundle: FakeAssetBundle(), + child: const MusicVisualizer(), + ), + ), + ); + + await tester.pump(const Duration(milliseconds: 50)); + await tester.pump(const Duration(milliseconds: 50)); + await tester.pump(const Duration(milliseconds: 50)); + await tester.pump(const Duration(milliseconds: 50)); + await tester.pump(const Duration(milliseconds: 50)); + await tester.pump(const Duration(milliseconds: 50)); + await tester.pump(const Duration(milliseconds: 50)); + + expect(find.byType(MusicVisualizer), findsOneWidget); + }); + }); +} diff --git a/test/src/overview/view/overview_page_test.dart b/test/src/overview/view/overview_page_test.dart new file mode 100644 index 0000000..3602462 --- /dev/null +++ b/test/src/overview/view/overview_page_test.dart @@ -0,0 +1,29 @@ +import 'package:airplane_entertainment_system/overview/overview.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../../helpers/helpers.dart'; + +void main() { + group('OverviewPage', () { + testWidgets('contains welcome copy', (tester) async { + await tester.pumpExperience(const OverviewPage()); + + expect(find.byType(WelcomeCopy), findsOneWidget); + }); + + testWidgets('contains flight tracker', (tester) async { + await tester.binding.setSurfaceSize(const Size(1600, 1200)); + addTearDown(() => tester.binding.setSurfaceSize(null)); + await tester.pumpExperience(const OverviewPage()); + + await tester.dragUntilVisible( + find.byType(FlightTrackingCard), + find.byType(ListView), + const Offset(0, -50), + ); + + expect(find.byType(FlightTrackingCard), findsOneWidget); + }); + }); +} diff --git a/test/thumbnail/airplane_entertainment_system_thumbnail_test.dart b/test/thumbnail/airplane_entertainment_system_thumbnail_test.dart new file mode 100644 index 0000000..4eb48c4 --- /dev/null +++ b/test/thumbnail/airplane_entertainment_system_thumbnail_test.dart @@ -0,0 +1,16 @@ +import 'package:airplane_entertainment_system/demo/demo.dart'; +import 'package:airplane_entertainment_system/overview/overview.dart'; +import 'package:airplane_entertainment_system/thumbnail/thumbnail.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../helpers/helpers.dart'; + +void main() { + group('AirplaneEntertainmentSystemThumbnail', () { + testWidgets('renders an airplane image and clouds', (tester) async { + await tester.pumpExperience(const AirplaneEntertainmentSystemThumbnail()); + expect(find.byType(Clouds), findsNWidgets(2)); + expect(find.byType(AirplaneImage), findsOneWidget); + }); + }); +}