mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +00:00
extracted common widget tester actions
This commit is contained in:
parent
0f3d2a1f13
commit
630fda9fb7
2 changed files with 13 additions and 8 deletions
|
@ -7,7 +7,6 @@ import 'package:lightmeter/data/models/ev_source_type.dart';
|
||||||
import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
|
import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
|
||||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/res/dimens.dart';
|
|
||||||
import 'package:lightmeter/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart';
|
import 'package:lightmeter/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart';
|
||||||
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/equipment_profile_picker/widget_picker_equipment_profiles.dart';
|
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/equipment_profile_picker/widget_picker_equipment_profiles.dart';
|
||||||
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/extreme_exposure_pairs_container/widget_container_extreme_exposure_pairs.dart';
|
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/extreme_exposure_pairs_container/widget_container_extreme_exposure_pairs.dart';
|
||||||
|
@ -45,7 +44,6 @@ void main() {
|
||||||
mockSharedPrefs();
|
mockSharedPrefs();
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Generates several screenshots with the light theme
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Purchase & refund premium features',
|
'Purchase & refund premium features',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
|
@ -56,8 +54,7 @@ void main() {
|
||||||
_expectProMeteringScreen(enabled: false);
|
_expectProMeteringScreen(enabled: false);
|
||||||
|
|
||||||
/// Check, that premium settings are disabled
|
/// Check, that premium settings are disabled
|
||||||
await tester.tap(find.byTooltip(S.current.tooltipOpenSettings));
|
await tester.openSettings();
|
||||||
await tester.pumpAndSettle();
|
|
||||||
await _expectProSettingsScreen(tester, enabled: false);
|
await _expectProSettingsScreen(tester, enabled: false);
|
||||||
|
|
||||||
/// Make purchase
|
/// Make purchase
|
||||||
|
@ -68,8 +65,7 @@ void main() {
|
||||||
await _expectProSettingsScreen(tester, enabled: true);
|
await _expectProSettingsScreen(tester, enabled: true);
|
||||||
|
|
||||||
/// Expect, that all the premium controls are now available to user
|
/// Expect, that all the premium controls are now available to user
|
||||||
(tester.state(find.byType(Navigator)) as NavigatorState).pop();
|
await tester.navigatorPop();
|
||||||
await tester.pumpAndSettle(Dimens.durationML);
|
|
||||||
_expectProMeteringScreen(enabled: true);
|
_expectProMeteringScreen(enabled: true);
|
||||||
|
|
||||||
/// Refund
|
/// Refund
|
||||||
|
@ -80,8 +76,7 @@ void main() {
|
||||||
_expectProMeteringScreen(enabled: false);
|
_expectProMeteringScreen(enabled: false);
|
||||||
|
|
||||||
/// Check, that premium settings are disabled
|
/// Check, that premium settings are disabled
|
||||||
await tester.tap(find.byTooltip(S.current.tooltipOpenSettings));
|
await tester.openSettings();
|
||||||
await tester.pumpAndSettle();
|
|
||||||
await _expectProSettingsScreen(tester, enabled: false);
|
await _expectProSettingsScreen(tester, enabled: false);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -53,6 +53,16 @@ extension WidgetTesterCommonActions on WidgetTester {
|
||||||
await tap(find.byType(T));
|
await tap(find.byType(T));
|
||||||
await pumpAndSettle(Dimens.durationL);
|
await pumpAndSettle(Dimens.durationL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> openSettings() async {
|
||||||
|
await tap(find.byTooltip(S.current.tooltipOpenSettings));
|
||||||
|
await pumpAndSettle();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> navigatorPop() async {
|
||||||
|
(state(find.byType(Navigator)) as NavigatorState).pop();
|
||||||
|
await pumpAndSettle(Dimens.durationML);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension WidgetTesterListTileActions on WidgetTester {
|
extension WidgetTesterListTileActions on WidgetTester {
|
||||||
|
|
Loading…
Reference in a new issue