fixing keyless tests

This commit is contained in:
Joakim Troëng 2024-04-15 12:06:10 +02:00
parent 848605c855
commit 94885c41c2
2 changed files with 29 additions and 11 deletions

View File

@ -36,21 +36,22 @@ void main() {
}); });
group('Settings', () { group('Settings', () {
appTestKeyless('Click through all Themes', (WidgetTester tester) async { appTestKeyless('Click through all Themes', (WidgetTester tester) async {
var settingDrawerButton = find.byKey(settingDrawerIcon).hitTestable(); await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.tap(settingDrawerButton); await tester.shortWait();
await tester.longWait(); await tester.tap(find.byKey(settingDrawerIcon).hitTestable());
await tester.shortWait();
await tester.tap(find.byKey(themeModeSetting)); await tester.tap(find.byKey(themeModeSetting));
await tester.longWait(); await tester.shortWait();
await tester await tester
.tap(find.byKey(themeModeOption(ThemeMode.light)).hitTestable()); .tap(find.byKey(themeModeOption(ThemeMode.light)).hitTestable());
await tester.longWait(); await tester.longWait();
await tester.tap(find.byKey(themeModeSetting)); await tester.tap(find.byKey(themeModeSetting));
await tester.longWait(); await tester.shortWait();
await tester await tester
.tap(find.byKey(themeModeOption(ThemeMode.dark)).hitTestable()); .tap(find.byKey(themeModeOption(ThemeMode.dark)).hitTestable());
await tester.longWait(); await tester.longWait();
await tester.tap(find.byKey(themeModeSetting)); await tester.tap(find.byKey(themeModeSetting));
await tester.longWait(); await tester.shortWait();
await tester await tester
.tap(find.byKey(themeModeOption(ThemeMode.system)).hitTestable()); .tap(find.byKey(themeModeOption(ThemeMode.system)).hitTestable());
await tester.longWait(); await tester.longWait();
@ -60,6 +61,8 @@ void main() {
var helpDrawerButton = find.byKey(helpDrawerIcon).hitTestable(); var helpDrawerButton = find.byKey(helpDrawerIcon).hitTestable();
appTestKeyless('Check Licenses view', (WidgetTester tester) async { appTestKeyless('Check Licenses view', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.shortWait(); await tester.shortWait();
var licensesButtonText = find.byKey(licensesButton).hitTestable(); var licensesButtonText = find.byKey(licensesButton).hitTestable();
@ -70,8 +73,10 @@ void main() {
}); });
group('Opening of URLs', () { group('Opening of URLs', () {
appTestKeyless('TOS link', (WidgetTester tester) async { appTestKeyless('TOS link', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
if (isAndroid) { if (isAndroid) {
expect(find.byKey(tosButton).hitTestable(), findsOneWidget); expect(find.byKey(tosButton).hitTestable(), findsOneWidget);
} else { } else {
@ -80,8 +85,10 @@ void main() {
} }
}); });
appTestKeyless('Privacy link', (WidgetTester tester) async { appTestKeyless('Privacy link', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
if (isAndroid) { if (isAndroid) {
expect(find.byKey(privacyButton).hitTestable(), findsOneWidget); expect(find.byKey(privacyButton).hitTestable(), findsOneWidget);
} else { } else {
@ -90,8 +97,10 @@ void main() {
} }
}); });
appTestKeyless('Feedback link', (WidgetTester tester) async { appTestKeyless('Feedback link', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
if (isAndroid) { if (isAndroid) {
expect(find.byKey(userGuideButton).hitTestable(), findsOneWidget); expect(find.byKey(userGuideButton).hitTestable(), findsOneWidget);
} else { } else {
@ -100,6 +109,8 @@ void main() {
} }
}); });
appTestKeyless('Help link', (WidgetTester tester) async { appTestKeyless('Help link', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.longWait();
if (isAndroid) { if (isAndroid) {
@ -113,14 +124,18 @@ void main() {
group('Troubleshooting', () { group('Troubleshooting', () {
appTestKeyless('Diagnostics Button', skip: isAndroid, appTestKeyless('Diagnostics Button', skip: isAndroid,
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
await tester.tap(find.byKey(diagnosticsChip).hitTestable()); await tester.tap(find.byKey(diagnosticsChip).hitTestable());
await tester.longWait(); await tester.longWait();
}); });
appTestKeyless('Log button', (WidgetTester tester) async { appTestKeyless('Log button', (WidgetTester tester) async {
await tester.tap(find.byKey(actionsIconButtonKey).hitTestable());
await tester.shortWait();
await tester.tap(helpDrawerButton); await tester.tap(helpDrawerButton);
await tester.longWait(); await tester.shortWait();
await tester.tap(find.byKey(logChip).hitTestable()); await tester.tap(find.byKey(logChip).hitTestable());
await tester.longWait(); await tester.longWait();
}); });

View File

@ -25,6 +25,7 @@ import '../../app/message.dart';
import '../../app/models.dart'; import '../../app/models.dart';
import '../../app/shortcuts.dart'; import '../../app/shortcuts.dart';
import '../../app/views/action_list.dart'; import '../../app/views/action_list.dart';
import '../../app/views/keys.dart';
import '../../app/views/reset_dialog.dart'; import '../../app/views/reset_dialog.dart';
import '../../core/models.dart'; import '../../core/models.dart';
import '../../core/state.dart'; import '../../core/state.dart';
@ -97,6 +98,7 @@ Widget homeBuildActions(
ActionListSection(l10n.s_application, children: [ ActionListSection(l10n.s_application, children: [
ActionListItem( ActionListItem(
icon: const Icon(Symbols.settings), icon: const Icon(Symbols.settings),
key: settingDrawerIcon,
title: l10n.s_settings, title: l10n.s_settings,
subtitle: l10n.l_settings_desc, subtitle: l10n.l_settings_desc,
actionStyle: ActionStyle.primary, actionStyle: ActionStyle.primary,
@ -107,6 +109,7 @@ Widget homeBuildActions(
), ),
ActionListItem( ActionListItem(
icon: const Icon(Symbols.help), icon: const Icon(Symbols.help),
key: helpDrawerIcon,
title: l10n.s_help_and_about, title: l10n.s_help_and_about,
subtitle: l10n.l_help_and_about_desc, subtitle: l10n.l_help_and_about_desc,
actionStyle: ActionStyle.primary, actionStyle: ActionStyle.primary,