mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-23 00:52:14 +00:00

* feat: support reminder on date * feat: support reminder on date in database * fix: include time static * fix: do not force unwrap * chore: clean flutter code * test: add test for reminder in database * fix: interpret reminder option * feat: date and reminder on mobile * feat: improve notification actions and support open row * feat: support dates in document * fix: minor changes + review * feat: support reminder on mobile in document * feat: support open row on database reminder mobile * test: add more tests * fix: first part of review * fix: open row responsibility * fix: abstract application logic from presentation layer * fix: update reminder on date cell update * test: fix failing test * fix: show correct selected day after end date toggled
123 lines
4.1 KiB
Dart
123 lines
4.1 KiB
Dart
import 'package:appflowy/workspace/presentation/notifications/widgets/notification_item.dart';
|
|
import 'package:appflowy/workspace/presentation/widgets/date_picker/widgets/reminder_selector.dart';
|
|
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart';
|
|
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:integration_test/integration_test.dart';
|
|
|
|
import '../util/database_test_op.dart';
|
|
import '../util/util.dart';
|
|
|
|
void main() {
|
|
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
group('reminder in database', () {
|
|
testWidgets('add date field and add reminder', (tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
|
|
|
|
// Invoke the field editor
|
|
await tester.tapGridFieldWithName('Type');
|
|
await tester.tapEditPropertyButton();
|
|
|
|
// Change to date type
|
|
await tester.tapTypeOptionButton();
|
|
await tester.selectFieldType(FieldType.DateTime);
|
|
await tester.dismissFieldEditor();
|
|
|
|
// Open date picker
|
|
await tester.tapCellInGrid(rowIndex: 0, fieldType: FieldType.DateTime);
|
|
await tester.findDateEditor(findsOneWidget);
|
|
|
|
// Select date
|
|
await tester.selectLastDateInPicker();
|
|
|
|
// Select Time of event reminder
|
|
await tester.selectReminderOption(ReminderOption.atTimeOfEvent);
|
|
|
|
// Expect Time of event to be displayed
|
|
tester.expectSelectedReminder(ReminderOption.atTimeOfEvent);
|
|
|
|
// Dismiss the cell/date editor
|
|
await tester.dismissCellEditor();
|
|
|
|
// Open date picker again
|
|
await tester.tapCellInGrid(rowIndex: 0, fieldType: FieldType.DateTime);
|
|
await tester.findDateEditor(findsOneWidget);
|
|
|
|
// Expect Time of event to be displayed
|
|
tester.expectSelectedReminder(ReminderOption.atTimeOfEvent);
|
|
|
|
// Dismiss the cell/date editor
|
|
await tester.dismissCellEditor();
|
|
|
|
// Open "Upcoming" in Notification hub
|
|
await tester.openNotificationHub(tabIndex: 1);
|
|
|
|
// Expect 1 notification
|
|
tester.expectNotificationItems(1);
|
|
});
|
|
|
|
testWidgets('navigate from reminder to open row', (tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
|
|
|
|
// Invoke the field editor
|
|
await tester.tapGridFieldWithName('Type');
|
|
await tester.tapEditPropertyButton();
|
|
|
|
// Change to date type
|
|
await tester.tapTypeOptionButton();
|
|
await tester.selectFieldType(FieldType.DateTime);
|
|
await tester.dismissFieldEditor();
|
|
|
|
// Open date picker
|
|
await tester.tapCellInGrid(rowIndex: 0, fieldType: FieldType.DateTime);
|
|
await tester.findDateEditor(findsOneWidget);
|
|
|
|
// Select date
|
|
await tester.selectLastDateInPicker();
|
|
|
|
// Select Time of event reminder
|
|
await tester.selectReminderOption(ReminderOption.atTimeOfEvent);
|
|
|
|
// Expect Time of event to be displayed
|
|
tester.expectSelectedReminder(ReminderOption.atTimeOfEvent);
|
|
|
|
// Dismiss the cell/date editor
|
|
await tester.dismissCellEditor();
|
|
|
|
// Open date picker again
|
|
await tester.tapCellInGrid(rowIndex: 0, fieldType: FieldType.DateTime);
|
|
await tester.findDateEditor(findsOneWidget);
|
|
|
|
// Expect Time of event to be displayed
|
|
tester.expectSelectedReminder(ReminderOption.atTimeOfEvent);
|
|
|
|
// Dismiss the cell/date editor
|
|
await tester.dismissCellEditor();
|
|
|
|
// Create and Navigate to a new document
|
|
await tester.createNewPageWithNameUnderParent();
|
|
await tester.pumpAndSettle();
|
|
|
|
// Open "Upcoming" in Notification hub
|
|
await tester.openNotificationHub(tabIndex: 1);
|
|
|
|
// Expect 1 notification
|
|
tester.expectNotificationItems(1);
|
|
|
|
// Tap on the notification
|
|
await tester.tap(find.byType(NotificationItem));
|
|
await tester.pumpAndSettle();
|
|
|
|
// Expect to see Row Editor Dialog
|
|
tester.expectToSeeRowDetailsPageDialog();
|
|
});
|
|
});
|
|
}
|