From 549b482a89ccf571fb74d9e43a75d6bb6f41c243 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 10 Aug 2023 16:12:29 +0200 Subject: [PATCH] fix(neon,app): Screenshot tests Signed-off-by: jld3103 --- .../app/integration_test/screenshot_test.dart | 21 +++++++------------ packages/neon/neon/lib/settings.dart | 1 + .../src/settings/widgets/settings_list.dart | 3 +-- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/packages/app/integration_test/screenshot_test.dart b/packages/app/integration_test/screenshot_test.dart index 7ef2ec9b..7ad759e4 100644 --- a/packages/app/integration_test/screenshot_test.dart +++ b/packages/app/integration_test/screenshot_test.dart @@ -10,6 +10,7 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart import 'package:neon/models.dart'; import 'package:neon/neon.dart'; import 'package:neon/nextcloud.dart'; +import 'package:neon/settings.dart'; import 'package:neon_files/widgets/actions.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -36,7 +37,7 @@ Future openDrawer(final WidgetTester tester) async { Future switchPage(final WidgetTester tester, final String name) async { await openDrawer(tester); - await tester.tap(find.byKey(Key(name))); + await tester.tap(find.text(name).last); await tester.pumpAndSettle(); } @@ -87,14 +88,6 @@ Future main() async { ); await prepareScreenshot(tester, binding); await binding.takeScreenshot('login_server_selection'); - - await tester.enterText(find.byType(TextFormField), account.serverURL); - await tester.pumpAndSettle(); - await tester.testTextInput.receiveAction(TextInputAction.done); - await tester.pumpAndSettle(); - await tester.pump(const Duration(seconds: 3)); // Make sure the login webview is loaded - await tester.pumpAndSettle(); - await binding.takeScreenshot('login_form'); }); testWidgets('home', (final tester) async { @@ -165,7 +158,7 @@ Future main() async { account: account, ); await prepareScreenshot(tester, binding); - await switchPage(tester, 'app-news'); + await switchPage(tester, 'News'); // Show folders await tester.tap(find.byIcon(Icons.folder)); @@ -235,7 +228,7 @@ Future main() async { account: account, ); await prepareScreenshot(tester, binding); - await switchPage(tester, 'app-notes'); + await switchPage(tester, 'Notes'); // Create note await tester.tap(find.byType(FloatingActionButton)); @@ -298,7 +291,7 @@ Future main() async { account: account, ); await prepareScreenshot(tester, binding); - await tester.tap(find.byKey(const Key('app-notifications'))); + await tester.tap(find.byTooltip('Notifications')); await tester.pumpAndSettle(); await tester.pumpAndSettle(); @@ -314,7 +307,7 @@ Future main() async { account: account, ); await prepareScreenshot(tester, binding); - await switchPage(tester, 'settings'); + await switchPage(tester, 'Settings'); // Open Files settings await tester.tap(find.text('Files')); @@ -365,7 +358,7 @@ Future main() async { await tester.pumpAndSettle(); // Scroll down to accounts - await tester.drag(find.byType(ListView), const Offset(0, -10000)); + await tester.drag(find.byType(SettingsList).first, const Offset(0, -10000)); await tester.pumpAndSettle(); await binding.takeScreenshot('settings_accounts'); diff --git a/packages/neon/neon/lib/settings.dart b/packages/neon/neon/lib/settings.dart index 15823bf3..08c0053e 100644 --- a/packages/neon/neon/lib/settings.dart +++ b/packages/neon/neon/lib/settings.dart @@ -4,3 +4,4 @@ export 'package:neon/src/settings/models/options_category.dart'; export 'package:neon/src/settings/models/select_option.dart'; export 'package:neon/src/settings/models/storage.dart'; export 'package:neon/src/settings/models/toggle_option.dart'; +export 'package:neon/src/settings/widgets/settings_list.dart'; diff --git a/packages/neon/neon/lib/src/settings/widgets/settings_list.dart b/packages/neon/neon/lib/src/settings/widgets/settings_list.dart index fb609dd7..55642062 100644 --- a/packages/neon/neon/lib/src/settings/widgets/settings_list.dart +++ b/packages/neon/neon/lib/src/settings/widgets/settings_list.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:meta/meta.dart'; import 'package:neon/src/settings/widgets/settings_category.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; -@internal +@visibleForTesting class SettingsList extends StatelessWidget { const SettingsList({ required this.categories,