Browse Source

Merge pull request #97 from jld3103/fix/screenshots-notifications

neon: Fix notifications screenshot
pull/101/head
jld3103 2 years ago committed by GitHub
parent
commit
cc4f85c4ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      packages/neon/integration_test/screenshot_test.dart
  2. BIN
      packages/neon/screenshots/notifications_list.png

32
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;
late Account account;
final account = Account( setUpAll(() async {
packageInfo = await PackageInfo.fromPlatform();
account = Account(
serverURL: 'http://10.0.2.2', serverURL: 'http://10.0.2.2',
username: 'user1', username: 'user1',
password: 'user1', password: 'user1',
); )..setupClient(packageInfo);
setUpAll(() async {
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,7 +461,14 @@ Future main() async {
}); });
testWidgets('notifications', (final tester) async { testWidgets('notifications', (final tester) async {
await account.client.notifications.sendAdminNotification( await (Account(
serverURL: 'http://10.0.2.2',
username: 'admin',
password: 'admin',
)..setupClient(packageInfo))
.client
.notifications
.sendAdminNotification(
userId: account.username, userId: account.username,
shortMessage: 'Notifications demo', shortMessage: 'Notifications demo',
longMessage: 'This is a notifications demo of the Neon app', longMessage: 'This is a notifications demo of the Neon app',
@ -463,6 +477,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,
@ -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