Browse Source

Merge pull request #538 from nextcloud/feature/update-screenshots

Feature/update screenshots
pull/610/head
Kate 1 year ago committed by GitHub
parent
commit
903fb5b73a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 136
      packages/app/integration_test/screenshot_test.dart
  2. BIN
      packages/app/screenshots/files_actions.png
  3. BIN
      packages/app/screenshots/files_create.png
  4. BIN
      packages/app/screenshots/files_details.png
  5. BIN
      packages/app/screenshots/files_photos.png
  6. BIN
      packages/app/screenshots/files_root.png
  7. BIN
      packages/app/screenshots/home_drawer.png
  8. BIN
      packages/app/screenshots/login_form.png
  9. BIN
      packages/app/screenshots/login_server_selection.png
  10. BIN
      packages/app/screenshots/news_articles_starred_list.png
  11. BIN
      packages/app/screenshots/news_articles_unread_list.png
  12. BIN
      packages/app/screenshots/news_feed_add.png
  13. BIN
      packages/app/screenshots/news_feed_articles_list.png
  14. BIN
      packages/app/screenshots/news_feeds_list.png
  15. BIN
      packages/app/screenshots/news_folders_list.png
  16. BIN
      packages/app/screenshots/notes_categories_list.png
  17. BIN
      packages/app/screenshots/notes_note_create.png
  18. BIN
      packages/app/screenshots/notes_note_edit.png
  19. BIN
      packages/app/screenshots/notes_note_preview.png
  20. BIN
      packages/app/screenshots/notes_notes_list.png
  21. BIN
      packages/app/screenshots/notifications_list.png
  22. BIN
      packages/app/screenshots/settings_account.png
  23. BIN
      packages/app/screenshots/settings_accounts.png
  24. BIN
      packages/app/screenshots/settings_app_files.png
  25. BIN
      packages/app/screenshots/settings_app_news.png
  26. BIN
      packages/app/screenshots/settings_app_notes.png
  27. BIN
      packages/app/screenshots/settings_dark.png
  28. BIN
      packages/app/screenshots/settings_light.png
  29. BIN
      packages/app/screenshots/settings_oled.png
  30. 4
      packages/app/test_driver/integration_test.dart
  31. 22
      packages/neon/neon/lib/neon.dart
  32. 1
      packages/neon/neon/lib/settings.dart
  33. 2
      packages/neon/neon/lib/src/blocs/login_check_account.dart
  34. 2
      packages/neon/neon/lib/src/blocs/login_check_server_status.dart
  35. 2
      packages/neon/neon/lib/src/blocs/login_flow.dart
  36. 3
      packages/neon/neon/lib/src/settings/widgets/settings_list.dart
  37. 15
      packages/neon/neon/lib/src/utils/user_agent.dart
  38. 2
      tool/Dockerfile.dev

136
packages/app/integration_test/screenshot_test.dart

@ -9,85 +9,11 @@ import 'package:integration_test/integration_test.dart';
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';
class MemorySharedPreferences implements SharedPreferences {
final _data = <String, dynamic>{};
@override
Future<bool> clear() async {
_data.clear();
return true;
}
@override
Future<bool> commit() async => true;
@override
Future reload() async {}
@override
Future<bool> remove(final String key) async {
_data.remove(key);
return true;
}
@override
Set<String> getKeys() => _data.keys.toSet();
@override
bool containsKey(final String key) => _data.keys.contains(key);
@override
Object? get(final String key) => _data[key];
@override
bool? getBool(final String key) => _data[key] as bool?;
@override
double? getDouble(final String key) => _data[key] as double?;
@override
int? getInt(final String key) => _data[key] as int?;
@override
String? getString(final String key) => _data[key] as String?;
@override
List<String>? getStringList(final String key) => (_data[key] as List).cast<String>();
@override
Future<bool> setBool(final String key, final bool value) async {
_data[key] = value;
return true;
}
@override
Future<bool> setDouble(final String key, final double value) async {
_data[key] = value;
return true;
}
@override
Future<bool> setInt(final String key, final int value) async {
_data[key] = value;
return true;
}
@override
Future<bool> setString(final String key, final String value) async {
_data[key] = value;
return true;
}
@override
Future<bool> setStringList(final String key, final List<String> value) async {
_data[key] = value;
return true;
}
}
Future runTestApp(
final WidgetTester tester,
final IntegrationTestWidgetsFlutterBinding binding, {
@ -97,7 +23,6 @@ Future runTestApp(
getAppImplementations: getAppImplementations,
theme: neonTheme,
bindingOverride: binding,
sharedPreferencesOverride: MemorySharedPreferences(),
account: account,
firstLaunchDisabled: true,
nextPushDisabled: true,
@ -112,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();
}
@ -121,22 +46,41 @@ Future prepareScreenshot(final WidgetTester tester, final IntegrationTestWidgets
await tester.pumpAndSettle();
}
Future<Account> getAccount(final String username) async {
const host = 'http://10.0.2.2';
final appPassword = (await NextcloudClient(
host,
loginName: username,
password: username,
).core.appPassword.getAppPassword())
.ocs
.data
.apppassword;
return Account(
serverURL: host,
username: username,
password: appPassword,
);
}
Future main() async {
// The screenshots are pretty annoying on Android. See https://github.com/flutter/flutter/issues/92381
assert(Platform.isAndroid, 'Screenshots need to be taken on Android');
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
final account = Account(
serverURL: 'http://10.0.2.2',
username: 'user1',
password: 'user1',
);
late Account account;
setUpAll(() async {
account = await getAccount('demo');
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
});
setUp(() {
SharedPreferences.setMockInitialValues({});
});
testWidgets('login', (final tester) async {
await runTestApp(
tester,
@ -144,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 {
@ -222,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));
@ -292,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));
@ -343,11 +279,7 @@ Future main() async {
});
testWidgets('notifications', (final tester) async {
await Account(
serverURL: 'http://10.0.2.2',
username: 'admin',
password: 'admin',
).client.notifications.sendAdminNotification(
await (await getAccount('admin')).client.notifications.sendAdminNotification(
userId: account.username,
shortMessage: 'Notifications demo',
longMessage: 'This is a notifications demo of the Neon app',
@ -359,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();
@ -375,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'));
@ -426,13 +358,13 @@ 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');
// Go to account settings
await tester.tap(find.text('user1@10.0.2.2:80'));
await tester.tap(find.text('demo@10.0.2.2:80'));
await tester.pumpAndSettle();
await tester.tap(find.text('Automatic'));
await tester.pumpAndSettle();

BIN
packages/app/screenshots/files_actions.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 KiB

After

Width:  |  Height:  |  Size: 505 KiB

BIN
packages/app/screenshots/files_create.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 KiB

After

Width:  |  Height:  |  Size: 417 KiB

BIN
packages/app/screenshots/files_details.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 754 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
packages/app/screenshots/files_photos.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

After

Width:  |  Height:  |  Size: 482 KiB

BIN
packages/app/screenshots/files_root.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 254 KiB

BIN
packages/app/screenshots/home_drawer.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 112 KiB

BIN
packages/app/screenshots/login_form.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

BIN
packages/app/screenshots/login_server_selection.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 109 KiB

BIN
packages/app/screenshots/news_articles_starred_list.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 156 KiB

BIN
packages/app/screenshots/news_articles_unread_list.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

After

Width:  |  Height:  |  Size: 446 KiB

BIN
packages/app/screenshots/news_feed_add.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 145 KiB

BIN
packages/app/screenshots/news_feed_articles_list.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 KiB

After

Width:  |  Height:  |  Size: 508 KiB

BIN
packages/app/screenshots/news_feeds_list.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 150 KiB

BIN
packages/app/screenshots/news_folders_list.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 98 KiB

BIN
packages/app/screenshots/notes_categories_list.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 85 KiB

BIN
packages/app/screenshots/notes_note_create.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 112 KiB

BIN
packages/app/screenshots/notes_note_edit.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 63 KiB

BIN
packages/app/screenshots/notes_note_preview.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 60 KiB

BIN
packages/app/screenshots/notes_notes_list.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 94 KiB

BIN
packages/app/screenshots/notifications_list.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 86 KiB

BIN
packages/app/screenshots/settings_account.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 129 KiB

BIN
packages/app/screenshots/settings_accounts.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 172 KiB

BIN
packages/app/screenshots/settings_app_files.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 150 KiB

BIN
packages/app/screenshots/settings_app_news.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

After

Width:  |  Height:  |  Size: 240 KiB

BIN
packages/app/screenshots/settings_app_notes.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 171 KiB

BIN
packages/app/screenshots/settings_dark.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 151 KiB

BIN
packages/app/screenshots/settings_light.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 155 KiB

BIN
packages/app/screenshots/settings_oled.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 150 KiB

4
packages/app/test_driver/integration_test.dart

@ -1,6 +1,5 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:integration_test/integration_test_driver_extended.dart';
Future<void> main() async {
@ -16,6 +15,7 @@ Future<void> main() async {
},
);
} catch (e) {
debugPrint('Error occurred: $e');
// ignore: avoid_print
print('Error occurred: $e');
}
}

22
packages/neon/neon/lib/neon.dart

@ -2,7 +2,6 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:meta/meta.dart';
import 'package:neon/src/app.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/first_launch.dart';
@ -14,27 +13,24 @@ import 'package:neon/src/platform/platform.dart';
import 'package:neon/src/theme/neon.dart';
import 'package:neon/src/utils/global_options.dart';
import 'package:neon/src/utils/request_manager.dart';
import 'package:neon/src/utils/user_agent.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
@internal
late final String neonUserAgent;
Future runNeon({
required final Iterable<AppImplementation> Function(SharedPreferences, RequestManager, NeonPlatform)
getAppImplementations,
required final NeonTheme theme,
final WidgetsBinding? bindingOverride,
final SharedPreferences? sharedPreferencesOverride,
final Account? account,
final bool firstLaunchDisabled = false,
final bool nextPushDisabled = false,
@visibleForTesting final WidgetsBinding? bindingOverride,
@visibleForTesting final Account? account,
@visibleForTesting final bool firstLaunchDisabled = false,
@visibleForTesting final bool nextPushDisabled = false,
}) async {
final binding = bindingOverride ?? WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: binding);
final sharedPreferences = sharedPreferencesOverride ?? await SharedPreferences.getInstance();
final sharedPreferences = await SharedPreferences.getInstance();
final platform = await getNeonPlatform();
final cache = Cache(platform);
@ -43,11 +39,7 @@ Future runNeon({
final allAppImplementations = getAppImplementations(sharedPreferences, requestManager, platform);
final packageInfo = await PackageInfo.fromPlatform();
var buildNumber = packageInfo.buildNumber;
if (buildNumber.isEmpty) {
buildNumber = '1';
}
neonUserAgent = 'Neon ${packageInfo.version}+$buildNumber';
buildUserAgent(packageInfo);
final globalOptions = GlobalOptions(
sharedPreferences,

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

2
packages/neon/neon/lib/src/blocs/login_check_account.dart

@ -1,10 +1,10 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:neon/neon.dart';
import 'package:neon/src/bloc/bloc.dart';
import 'package:neon/src/bloc/result.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/utils/user_agent.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';

2
packages/neon/neon/lib/src/blocs/login_check_server_status.dart

@ -1,9 +1,9 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:neon/neon.dart';
import 'package:neon/src/bloc/bloc.dart';
import 'package:neon/src/bloc/result.dart';
import 'package:neon/src/utils/user_agent.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';

2
packages/neon/neon/lib/src/blocs/login_flow.dart

@ -1,9 +1,9 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:neon/neon.dart';
import 'package:neon/src/bloc/bloc.dart';
import 'package:neon/src/bloc/result.dart';
import 'package:neon/src/utils/user_agent.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';

3
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,

15
packages/neon/neon/lib/src/utils/user_agent.dart

@ -0,0 +1,15 @@
import 'package:meta/meta.dart';
import 'package:package_info_plus/package_info_plus.dart';
late String? _userAgent;
void buildUserAgent(final PackageInfo packageInfo) {
var buildNumber = packageInfo.buildNumber;
if (buildNumber.isEmpty) {
buildNumber = '1';
}
_userAgent = 'Neon ${packageInfo.version}+$buildNumber';
}
@internal
String get neonUserAgent => _userAgent!;

2
tool/Dockerfile.dev

@ -10,6 +10,7 @@ RUN ./occ app:disable password_policy
RUN OC_PASS="user1" ./occ user:add --password-from-env --display-name "User One" user1
RUN OC_PASS="user2" ./occ user:add --password-from-env --display-name "User Two" user2
RUN OC_PASS="demo" ./occ user:add --password-from-env --display-name "Demo" demo
RUN ./occ app:install news --force --allow-unstable # 21.2.0
RUN ./occ app:install notes --force --allow-unstable # 4.8.0
@ -18,5 +19,6 @@ RUN ./occ app:install uppush --force --allow-unstable # 1.4.0
RUN ./occ app:enable password_policy
RUN (sh /entrypoint.sh php -S 0.0.0.0:8080 &) && \
until curl -s -o /dev/null http://localhost:8080/status.php; do true; done && \
# Do not setup the demo user here
for user in admin user1 user2; do curl -u "$user:$user" -H "ocs-apirequest: true" -s -o /dev/null http://localhost:8080/ocs/v2.php/cloud/user; done
COPY --chown=www-data:www-data overlay /usr/src/nextcloud/

Loading…
Cancel
Save