diff --git a/integration_test/e2e_test.dart b/integration_test/e2e_test.dart index 94d047d..e2539a0 100644 --- a/integration_test/e2e_test.dart +++ b/integration_test/e2e_test.dart @@ -41,14 +41,11 @@ void main() { testWidgets( 'e2e', (tester) async { - await tester.pumpApplication(equipmentProfiles: [] /**, films: [] */); - - /** Create some equipment profiles */ - - await tester.openSettings(); - await tester.tapDescendantTextOf(S.current.equipmentProfiles); + await tester.pumpApplication(equipmentProfiles: [], films: []); /// Create Praktica + Zenitar profile from scratch + await tester.openSettings(); + await tester.tapDescendantTextOf(S.current.equipmentProfiles); await tester.tap(find.byIcon(Icons.add).first); await tester.pumpAndSettle(); await tester.setProfileName(mockEquipmentProfiles[0].name); @@ -68,12 +65,16 @@ void main() { await tester.setApertureValues(1, mockEquipmentProfiles[1].apertureValues); expect(find.text('f/3.5 - f/22'), findsOneWidget); expect(find.text('1/1000 - 16"'), findsNWidgets(2)); - await tester.navigatorPop(); + + /// Select some films + await tester.tap(find.text(S.current.filmsInUse)); + await tester.pumpAndSettle(); + await tester.setDialogFilterValues([mockFilms[0], mockFilms[1]], deselectAll: false); await tester.navigatorPop(); /// Select some initial settings according to the selected gear and film - /// Then tale a photo and verify, that exposure pairs range and EV matches the selected settings + /// Then take a photo and verify, that exposure pairs range and EV matches the selected settings await tester.openPickerAndSelect(mockEquipmentProfiles[0].name); await tester.openPickerAndSelect(mockFilms[0].name); await tester.openPickerAndSelect('400'); @@ -92,8 +93,6 @@ void main() { ev: mockPhotoEv100 + 2, ); - /** Changing some settings in the field */ - /// Add ND to shoot another scene await tester.openPickerAndSelect('2'); await _expectMeteringStateAndMeasure( @@ -121,7 +120,7 @@ void main() { ev: mockPhotoEv100 + 2, ); - /// Set another wilm and set the same ISO + /// Set another film and another ISO await tester.openPickerAndSelect('200'); await tester.openPickerAndSelect(mockFilms[1].name); await _expectMeteringStateAndMeasure( @@ -151,10 +150,10 @@ extension EquipmentProfileActions on WidgetTester { } Future setIsoValues(int profileIndex, List values) => - _setDialogFilterValues(profileIndex, S.current.isoValues, values); + _openAndSetDialogFilterValues(profileIndex, S.current.isoValues, values); Future setNdValues(int profileIndex, List values) => - _setDialogFilterValues(profileIndex, S.current.ndFilters, values); - Future _setDialogFilterValues( + _openAndSetDialogFilterValues(profileIndex, S.current.ndFilters, values); + Future _openAndSetDialogFilterValues( int profileIndex, String listTileTitle, List valuesToSelect, { @@ -162,6 +161,27 @@ extension EquipmentProfileActions on WidgetTester { }) async { await tap(find.text(listTileTitle).at(profileIndex)); await pumpAndSettle(); + await setDialogFilterValues(valuesToSelect, deselectAll: deselectAll); + } + + Future setApertureValues(int profileIndex, List values) => + _setDialogRangePickerValues(profileIndex, S.current.apertureValues, values); + + Future setShutterSpeedValues(int profileIndex, List values) => + _setDialogRangePickerValues(profileIndex, S.current.shutterSpeedValues, values); +} + +extension on WidgetTester { + Future openPickerAndSelect

(String valueToSelect) async { + await openAnimatedPicker

(); + await tapDescendantTextOf>(valueToSelect); + await tapSelectButton(); + } + + Future setDialogFilterValues( + List valuesToSelect, { + bool deselectAll = true, + }) async { if (deselectAll) { await tap(find.byIcon(Icons.deselect)); await pump(); @@ -179,10 +199,6 @@ extension EquipmentProfileActions on WidgetTester { await tapSaveButton(); } - Future setApertureValues(int profileIndex, List values) => - _setDialogRangePickerValues(profileIndex, S.current.apertureValues, values); - Future setShutterSpeedValues(int profileIndex, List values) => - _setDialogRangePickerValues(profileIndex, S.current.shutterSpeedValues, values); Future _setDialogRangePickerValues( int profileIndex, String listTileTitle, @@ -219,14 +235,6 @@ extension EquipmentProfileActions on WidgetTester { } } -extension on WidgetTester { - Future openPickerAndSelect

(String valueToSelect) async { - await openAnimatedPicker

(); - await tapDescendantTextOf>(valueToSelect); - await tapSelectButton(); - } -} - Future _expectMeteringState( WidgetTester tester, { required EquipmentProfile equipmentProfile,