Browse Source

neon: Fix notifications screenshot

pull/97/head
jld3103 2 years ago
parent
commit
9fd25d71fd
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 46
      packages/neon/integration_test/screenshot_test.dart
  2. BIN
      packages/neon/screenshots/notifications_list.png

46
packages/neon/integration_test/screenshot_test.dart

@ -96,7 +96,8 @@ class MemorySharedPreferences implements SharedPreferences {
Future pumpAppPage( Future pumpAppPage(
final WidgetTester tester, final WidgetTester tester,
final IntegrationTestWidgetsFlutterBinding binding, { final IntegrationTestWidgetsFlutterBinding binding,
final PackageInfo packageInfo, {
required final Widget Function(BuildContext, Function(NextcloudTheme)) builder, required final Widget Function(BuildContext, Function(NextcloudTheme)) builder,
final Account? account, final Account? account,
}) async { }) async {
@ -106,8 +107,6 @@ Future pumpAppPage(
final requestManager = RequestManager(); final requestManager = RequestManager();
final allAppImplementations = getAppImplementations(sharedPreferences, requestManager, platform); final allAppImplementations = getAppImplementations(sharedPreferences, requestManager, platform);
final packageInfo = await PackageInfo.fromPlatform();
final globalOptions = GlobalOptions( final globalOptions = GlobalOptions(
Storage('global', sharedPreferences), Storage('global', sharedPreferences),
packageInfo, packageInfo,
@ -123,7 +122,7 @@ Future pumpAppPage(
allAppImplementations, allAppImplementations,
); );
if (account != null) { if (account != null) {
accountsBloc.addAccount(account..setupClient(packageInfo)); accountsBloc.addAccount(account);
} }
final pushNotificationsBloc = PushNotificationsBloc( final pushNotificationsBloc = PushNotificationsBloc(
@ -220,14 +219,17 @@ Future main() async {
assert(Platform.isAndroid, 'Screenshots need to be taken on Android'); assert(Platform.isAndroid, 'Screenshots need to be taken on Android');
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized(); final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
late PackageInfo packageInfo;
final account = Account( late Account account;
serverURL: 'http://10.0.2.2',
username: 'user1',
password: 'user1',
);
setUpAll(() async { setUpAll(() async {
packageInfo = await PackageInfo.fromPlatform();
account = Account(
serverURL: 'http://10.0.2.2',
username: 'user1',
password: 'user1',
)..setupClient(packageInfo);
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
}); });
@ -235,6 +237,7 @@ Future main() async {
await pumpAppPage( await pumpAppPage(
tester, tester,
binding, binding,
packageInfo,
builder: (final context, final _) => const LoginPage(), builder: (final context, final _) => const LoginPage(),
); );
await prepareScreenshot(tester, binding); await prepareScreenshot(tester, binding);
@ -253,6 +256,7 @@ Future main() async {
await pumpAppPage( await pumpAppPage(
tester, tester,
binding, binding,
packageInfo,
account: account, account: account,
builder: (final context, final onThemeChanged) => HomePage( builder: (final context, final onThemeChanged) => HomePage(
account: account, account: account,
@ -270,6 +274,7 @@ Future main() async {
await pumpAppPage( await pumpAppPage(
tester, tester,
binding, binding,
packageInfo,
account: account, account: account,
builder: (final context, final onThemeChanged) => HomePage( builder: (final context, final onThemeChanged) => HomePage(
account: account, account: account,
@ -322,6 +327,7 @@ Future main() async {
await pumpAppPage( await pumpAppPage(
tester, tester,
binding, binding,
packageInfo,
account: account, account: account,
builder: (final context, final onThemeChanged) => HomePage( builder: (final context, final onThemeChanged) => HomePage(
account: account, account: account,
@ -396,6 +402,7 @@ Future main() async {
await pumpAppPage( await pumpAppPage(
tester, tester,
binding, binding,
packageInfo,
account: account, account: account,
builder: (final context, final onThemeChanged) => HomePage( builder: (final context, final onThemeChanged) => HomePage(
account: account, account: account,
@ -454,15 +461,23 @@ Future main() async {
}); });
testWidgets('notifications', (final tester) async { testWidgets('notifications', (final tester) async {
await account.client.notifications.sendAdminNotification( await (Account(
userId: account.username, serverURL: 'http://10.0.2.2',
shortMessage: 'Notifications demo', username: 'admin',
longMessage: 'This is a notifications demo of the Neon app', password: 'admin',
); )..setupClient(packageInfo))
.client
.notifications
.sendAdminNotification(
userId: account.username,
shortMessage: 'Notifications demo',
longMessage: 'This is a notifications demo of the Neon app',
);
await pumpAppPage( await pumpAppPage(
tester, tester,
binding, binding,
packageInfo,
account: account, account: account,
builder: (final context, final onThemeChanged) => HomePage( builder: (final context, final onThemeChanged) => HomePage(
account: account, account: account,
@ -482,6 +497,7 @@ Future main() async {
await pumpAppPage( await pumpAppPage(
tester, tester,
binding, binding,
packageInfo,
account: account, account: account,
builder: (final context, final onThemeChanged) => HomePage( builder: (final context, final onThemeChanged) => HomePage(
account: account, account: account,

BIN
packages/neon/screenshots/notifications_list.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Loading…
Cancel
Save