Skip to content

Commit

Permalink
Merge branch 'main' into android_integration_test
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Jan 31, 2024
2 parents 36f9310 + 247405f commit 2b33c82
Show file tree
Hide file tree
Showing 145 changed files with 2,824 additions and 1,219 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/android_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,18 @@ jobs:
run: |
cargo make --profile development-android appflowy-android-dev-ci
- name: Prebuild AppFlowy
working-directory: frontend/appflowy_fluter
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
flutter build apk --debug --target=integration_test/runner.dart
- name: Run integration tests
# https://github.com/ReactiveCircus/android-emulator-runner
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
arch: x86_64
working-directory: frontend/appflowy_flutter
script: flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/runner.dart
script: flutter test integration_test/runner.dart
7 changes: 6 additions & 1 deletion .github/workflows/ios_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ jobs:
- name: Build AppFlowy
working-directory: frontend
run: |
cargo make --profile development-ios-arm64-sim appflowy-core-dev-ios
cargo make --profile development-ios-arm64-sim appflowy-ios-dev
- name: Prebuild AppFlowy
working-directory: frontend/appflowy_fluter
run: |
flutter build ios --simulator --target=integration_test/runner.dart
- name: Run integration tests
working-directory: frontend/appflowy_flutter
Expand Down
4 changes: 2 additions & 2 deletions frontend/appflowy_flutter/assets/template/readme.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
"attributes": { "subtype": "checkbox", "checkbox": true },
"delta": [
{ "insert": "Click " },
{ "insert": "+ New Page ", "attributes": { "code": true } },
{ "insert": "+ New Page", "attributes": { "code": true } },
{
"insert": "button at the bottom of your sidebar to add a new page."
"insert": " button at the bottom of your sidebar to add a new page."
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ void main() {
await tester.findDateEditor(findsOneWidget);

// Select date
await tester.selectLastDateInPicker();
final isToday = await tester.selectLastDateInPicker();

// Select Time of event reminder
await tester.selectReminderOption(ReminderOption.atTimeOfEvent);
// Select "On day of event" reminder
await tester.selectReminderOption(ReminderOption.onDayOfEvent);

// Expect Time of event to be displayed
tester.expectSelectedReminder(ReminderOption.atTimeOfEvent);
// Expect "On day of event" to be displayed
tester.expectSelectedReminder(ReminderOption.onDayOfEvent);

// Dismiss the cell/date editor
await tester.dismissCellEditor();
Expand All @@ -47,14 +47,20 @@ void main() {
await tester.tapCellInGrid(rowIndex: 0, fieldType: FieldType.DateTime);
await tester.findDateEditor(findsOneWidget);

// Expect Time of event to be displayed
tester.expectSelectedReminder(ReminderOption.atTimeOfEvent);
// Expect "On day of event" to be displayed
tester.expectSelectedReminder(ReminderOption.onDayOfEvent);

// Dismiss the cell/date editor
await tester.dismissCellEditor();

int tabIndex = 1;
final now = DateTime.now();
if (isToday && now.hour >= 9) {
tabIndex = 0;
}

// Open "Upcoming" in Notification hub
await tester.openNotificationHub(tabIndex: 1);
await tester.openNotificationHub(tabIndex: tabIndex);

// Expect 1 notification
tester.expectNotificationItems(1);
Expand All @@ -80,13 +86,13 @@ void main() {
await tester.findDateEditor(findsOneWidget);

// Select date
await tester.selectLastDateInPicker();
final isToday = await tester.selectLastDateInPicker();

// Select Time of event reminder
await tester.selectReminderOption(ReminderOption.atTimeOfEvent);
// Select "On day of event"-reminder
await tester.selectReminderOption(ReminderOption.onDayOfEvent);

// Expect Time of event to be displayed
tester.expectSelectedReminder(ReminderOption.atTimeOfEvent);
// Expect "On day of event" to be displayed
tester.expectSelectedReminder(ReminderOption.onDayOfEvent);

// Dismiss the cell/date editor
await tester.dismissCellEditor();
Expand All @@ -95,8 +101,8 @@ void main() {
await tester.tapCellInGrid(rowIndex: 0, fieldType: FieldType.DateTime);
await tester.findDateEditor(findsOneWidget);

// Expect Time of event to be displayed
tester.expectSelectedReminder(ReminderOption.atTimeOfEvent);
// Expect "On day of event" to be displayed
tester.expectSelectedReminder(ReminderOption.onDayOfEvent);

// Dismiss the cell/date editor
await tester.dismissCellEditor();
Expand All @@ -105,8 +111,14 @@ void main() {
await tester.createNewPageWithNameUnderParent();
await tester.pumpAndSettle();

// Open "Upcoming" in Notification hub
await tester.openNotificationHub(tabIndex: 1);
int tabIndex = 1;
final now = DateTime.now();
if (isToday && now.hour >= 9) {
tabIndex = 0;
}

// Open correct tab in Notification hub
await tester.openNotificationHub(tabIndex: tabIndex);

// Expect 1 notification
tester.expectNotificationItems(1);
Expand All @@ -118,5 +130,77 @@ void main() {
// Expect to see Row Editor Dialog
tester.expectToSeeRowDetailsPageDialog();
});

testWidgets(
'toggle include time sets reminder option correctly',
(tester) async {
await tester.initializeAppFlowy();
await tester.tapGoButton();

await tester.createNewPageWithNameUnderParent(
layout: ViewLayoutPB.Grid,
);

// Invoke the field editor
await tester.tapGridFieldWithName('Type');
await tester.tapEditFieldButton();

// Change to date type
await tester.tapSwitchFieldTypeButton();
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 "On day of event"-reminder
await tester.selectReminderOption(ReminderOption.onDayOfEvent);

// Expect "On day of event" to be displayed
tester.expectSelectedReminder(ReminderOption.onDayOfEvent);

// 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 "On day of event" to be displayed
tester.expectSelectedReminder(ReminderOption.onDayOfEvent);

// Toggle include time on
await tester.toggleIncludeTime();

// Expect "At 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 "At time of event" to be displayed
tester.expectSelectedReminder(ReminderOption.atTimeOfEvent);

// Select "One hour before"-reminder
await tester.selectReminderOption(ReminderOption.oneHourBefore);

// Expect "One hour before" to be displayed
tester.expectSelectedReminder(ReminderOption.oneHourBefore);

// Toggle include time off
await tester.toggleIncludeTime();

// Expect "On day of event" to be displayed
tester.expectSelectedReminder(ReminderOption.onDayOfEvent);
},
);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:appflowy/plugins/database/widgets/cell/editable_cell_skeleton/se
import 'package:appflowy/plugins/database/widgets/cell/editable_cell_skeleton/text.dart';
import 'package:appflowy/plugins/database/widgets/cell/editable_cell_skeleton/timestamp.dart';
import 'package:appflowy/plugins/database/widgets/cell/editable_cell_skeleton/url.dart';
import 'package:appflowy/util/field_type_extension.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -37,7 +38,6 @@ import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/filte
import 'package:appflowy/plugins/database/grid/presentation/widgets/footer/grid_footer.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/header/desktop_field_cell.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/header/field_editor.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/header/field_type_extension.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/header/field_type_list.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/header/type_option/date/date_time_format.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/row/row.dart';
Expand Down Expand Up @@ -322,20 +322,23 @@ extension AppFlowyDatabaseTest on WidgetTester {
}

Future<void> selectReminderOption(ReminderOption option) async {
await hoverOnWidget(find.byType(ReminderSelector));
await tapButton(find.byType(ReminderSelector));

final finder = find.descendant(
of: find.byType(FlowyButton),
matching: find.text(option.label),
matching: find.textContaining(option.label),
);

await tapButton(finder);
}

Future<void> selectLastDateInPicker() async {
Future<bool> selectLastDateInPicker() async {
final finder = find.byType(CellContent).last;
final w = widget(finder) as CellContent;

await tapButton(finder);

return w.isToday;
}

Future<void> toggleDateRange() async {
Expand Down Expand Up @@ -814,7 +817,7 @@ extension AppFlowyDatabaseTest on WidgetTester {
final fieldTypeButton = find.descendant(
of: fieldTypeCell,
matching: find.byWidgetPredicate(
(widget) => widget is FlowyText && widget.text == fieldType.title(),
(widget) => widget is FlowyText && widget.text == fieldType.i18n,
),
);
await tapButton(fieldTypeButton);
Expand Down
41 changes: 15 additions & 26 deletions frontend/appflowy_flutter/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ PODS:
- fluttertoast (0.0.2):
- Flutter
- Toast
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- image_gallery_saver (2.0.2):
- Flutter
- image_picker_ios (0.0.1):
Expand All @@ -72,22 +69,20 @@ PODS:
- SDWebImage (5.14.2):
- SDWebImage/Core (= 5.14.2)
- SDWebImage/Core (5.14.2)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sign_in_with_apple (0.0.1):
- Flutter
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
- FlutterMacOS
- super_native_extensions (0.0.1):
- Flutter
- SwiftyGif (5.4.3)
- Toast (4.0.0)
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter

DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
Expand All @@ -106,18 +101,16 @@ DEPENDENCIES:
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- rich_clipboard_ios (from `.symlinks/plugins/rich_clipboard_ios/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- super_native_extensions (from `.symlinks/plugins/super_native_extensions/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- FMDB
- ReachabilitySwift
- SDWebImage
- SwiftyGif
Expand Down Expand Up @@ -156,18 +149,16 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
rich_clipboard_ios:
:path: ".symlinks/plugins/rich_clipboard_ios/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sign_in_with_apple:
:path: ".symlinks/plugins/sign_in_with_apple/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
:path: ".symlinks/plugins/sqflite/darwin"
super_native_extensions:
:path: ".symlinks/plugins/super_native_extensions/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
app_links: 5ef33d0d295a89d9d16bb81b0e3b0d5f70d6c875
Expand All @@ -180,26 +171,24 @@ SPEC CHECKSUMS:
flowy_infra_ui: 0455e1fa8c51885aa1437848e361e99419f34ebc
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425
integration_test: 13825b8a9334a850581300559b8839134b124670
irondash_engine_context: 3458bf979b90d616ffb8ae03a150bafe2e860cc9
keyboard_height_plugin: 43fa8bba20fd5c4fdeed5076466b8b9d43cc6b86
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
rich_clipboard_ios: 7588abe18f881a6d0e9ec0b12e51cae2761e8942
SDWebImage: b9a731e1d6307f44ca703b3976d18c24ca561e84
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
super_native_extensions: 4916b3c627a9c7fffdc48a23a9eca0b1ac228fa7
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812

PODFILE CHECKSUM: 8c681999c7764593c94846b2a64b44d86f7a27ac

COCOAPODS: 1.12.1
COCOAPODS: 1.14.3
Loading

0 comments on commit 2b33c82

Please sign in to comment.