Browse Source

fix(neon,app): Screenshot tests

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/538/head
jld3103 1 year ago
parent
commit
549b482a89
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 21
      packages/app/integration_test/screenshot_test.dart
  2. 1
      packages/neon/neon/lib/settings.dart
  3. 3
      packages/neon/neon/lib/src/settings/widgets/settings_list.dart

21
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/models.dart';
import 'package:neon/neon.dart'; import 'package:neon/neon.dart';
import 'package:neon/nextcloud.dart'; import 'package:neon/nextcloud.dart';
import 'package:neon/settings.dart';
import 'package:neon_files/widgets/actions.dart'; import 'package:neon_files/widgets/actions.dart';
import 'package:shared_preferences/shared_preferences.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 { Future switchPage(final WidgetTester tester, final String name) async {
await openDrawer(tester); await openDrawer(tester);
await tester.tap(find.byKey(Key(name))); await tester.tap(find.text(name).last);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
} }
@ -87,14 +88,6 @@ Future main() async {
); );
await prepareScreenshot(tester, binding); await prepareScreenshot(tester, binding);
await binding.takeScreenshot('login_server_selection'); 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 { testWidgets('home', (final tester) async {
@ -165,7 +158,7 @@ Future main() async {
account: account, account: account,
); );
await prepareScreenshot(tester, binding); await prepareScreenshot(tester, binding);
await switchPage(tester, 'app-news'); await switchPage(tester, 'News');
// Show folders // Show folders
await tester.tap(find.byIcon(Icons.folder)); await tester.tap(find.byIcon(Icons.folder));
@ -235,7 +228,7 @@ Future main() async {
account: account, account: account,
); );
await prepareScreenshot(tester, binding); await prepareScreenshot(tester, binding);
await switchPage(tester, 'app-notes'); await switchPage(tester, 'Notes');
// Create note // Create note
await tester.tap(find.byType(FloatingActionButton)); await tester.tap(find.byType(FloatingActionButton));
@ -298,7 +291,7 @@ Future main() async {
account: account, account: account,
); );
await prepareScreenshot(tester, binding); 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();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
@ -314,7 +307,7 @@ Future main() async {
account: account, account: account,
); );
await prepareScreenshot(tester, binding); await prepareScreenshot(tester, binding);
await switchPage(tester, 'settings'); await switchPage(tester, 'Settings');
// Open Files settings // Open Files settings
await tester.tap(find.text('Files')); await tester.tap(find.text('Files'));
@ -365,7 +358,7 @@ Future main() async {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
// Scroll down to accounts // 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 tester.pumpAndSettle();
await binding.takeScreenshot('settings_accounts'); await binding.takeScreenshot('settings_accounts');

1
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/select_option.dart';
export 'package:neon/src/settings/models/storage.dart'; export 'package:neon/src/settings/models/storage.dart';
export 'package:neon/src/settings/models/toggle_option.dart'; export 'package:neon/src/settings/models/toggle_option.dart';
export 'package:neon/src/settings/widgets/settings_list.dart';

3
packages/neon/neon/lib/src/settings/widgets/settings_list.dart

@ -1,9 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
import 'package:neon/src/settings/widgets/settings_category.dart'; import 'package:neon/src/settings/widgets/settings_category.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
@internal @visibleForTesting
class SettingsList extends StatelessWidget { class SettingsList extends StatelessWidget {
const SettingsList({ const SettingsList({
required this.categories, required this.categories,

Loading…
Cancel
Save