mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-12 03:26:03 +00:00

* chore: some ui improvements * fix: integration test * feat: language selector on welcome page (#2796) * feat: add language selector on welcome page * feat: add hover effect and refactor layout * test: add basic languge selector testing * chore: increate place holder width * fix: add catch error for setLocale and finish the testing * chore: update comment * feat: refactor the skip login in page and add tests --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io> * feat: row document (#2792) * chore: create orphan view handler * feat: save icon url and cover url in view * feat: implement emoji picker UI * chore: config ui * chore: config ui again * chore: replace RowPB with RowMetaPB to exposing more row information * fix: compile error * feat: show emoji in row * chore: update * test: insert emoji test * test: add update emoji test * test: add remove emoji test * test: add create field tests * test: add create row and delete row integration tests * test: add create row from row menu * test: document in row detail page * test: delete, duplicate row in row detail page * test: check the row count displayed in grid page * test: rename existing field in grid page * test: update field type of exisiting field in grid page * test: delete field test * test: add duplicate field test * test: add hide field test * test: add edit text cell test * test: add insert text to text cell test * test: add edit number cell test * test: add edit multiple number cells * test: add edit checkbox cell test * feat: integrate editor into database row * test: add edit create time and last edit time cell test * test: add edit date cell by selecting a date test * chore: remove unused code * chore: update checklist bg color * test: add update database layout test --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io> * test: fix test * test: add create select option test --------- Co-authored-by: Yijing Huang <hyj891204@gmail.com> Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io> Co-authored-by: Nathan.fooo <86001920+appflowy@users.noreply.github.com> Co-authored-by: nathan <nathan@appflowy.io>
230 lines
6.9 KiB
Dart
230 lines
6.9 KiB
Dart
import 'package:appflowy/plugins/database_view/widgets/row/row_banner.dart';
|
|
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart';
|
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:integration_test/integration_test.dart';
|
|
|
|
import 'util/database_test_op.dart';
|
|
import 'util/ime.dart';
|
|
import 'util/util.dart';
|
|
|
|
void main() {
|
|
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
group('grid', () {
|
|
const location = 'appflowy';
|
|
|
|
setUp(() async {
|
|
await TestFolder.cleanTestLocation(location);
|
|
await TestFolder.setTestLocation(location);
|
|
});
|
|
|
|
tearDown(() async {
|
|
await TestFolder.cleanTestLocation(location);
|
|
});
|
|
|
|
tearDownAll(() async {
|
|
await TestFolder.cleanTestLocation(null);
|
|
});
|
|
|
|
testWidgets('insert emoji in the row detail page', (tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
// Create a new grid
|
|
await tester.tapAddButton();
|
|
await tester.tapCreateGridButton();
|
|
|
|
// Hover first row and then open the row page
|
|
await tester.openFirstRowDetailPage();
|
|
|
|
await tester.hoverRowBanner();
|
|
|
|
await tester.openEmojiPicker();
|
|
await tester.switchToEmojiList();
|
|
await tester.tapEmoji('😀');
|
|
|
|
// After select the emoji, the EmojiButton will show up
|
|
await tester.tapButton(find.byType(EmojiButton));
|
|
});
|
|
|
|
testWidgets('update emoji in the row detail page', (tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
// Create a new grid
|
|
await tester.tapAddButton();
|
|
await tester.tapCreateGridButton();
|
|
|
|
// Hover first row and then open the row page
|
|
await tester.openFirstRowDetailPage();
|
|
await tester.hoverRowBanner();
|
|
await tester.openEmojiPicker();
|
|
await tester.switchToEmojiList();
|
|
await tester.tapEmoji('😀');
|
|
|
|
// Update existing selected emoji
|
|
await tester.tapButton(find.byType(EmojiButton));
|
|
await tester.switchToEmojiList();
|
|
await tester.tapEmoji('😅');
|
|
|
|
// The emoji already displayed in the row banner
|
|
final emojiText = find.byWidgetPredicate(
|
|
(widget) => widget is FlowyText && widget.text == '😅',
|
|
);
|
|
|
|
// The number of emoji should be two. One in the row displayed in the grid
|
|
// one in the row detail page.
|
|
expect(emojiText, findsNWidgets(2));
|
|
});
|
|
|
|
testWidgets('remove emoji in the row detail page', (tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
// Create a new grid
|
|
await tester.tapAddButton();
|
|
await tester.tapCreateGridButton();
|
|
|
|
// Hover first row and then open the row page
|
|
await tester.openFirstRowDetailPage();
|
|
await tester.hoverRowBanner();
|
|
await tester.openEmojiPicker();
|
|
await tester.switchToEmojiList();
|
|
await tester.tapEmoji('😀');
|
|
|
|
// Remove the emoji
|
|
await tester.tapButton(find.byType(RemoveEmojiButton));
|
|
final emojiText = find.byWidgetPredicate(
|
|
(widget) => widget is FlowyText && widget.text == '😀',
|
|
);
|
|
expect(emojiText, findsNothing);
|
|
});
|
|
|
|
testWidgets('create list of fields in row detail page', (tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
// Create a new grid
|
|
await tester.tapAddButton();
|
|
await tester.tapCreateGridButton();
|
|
|
|
// Hover first row and then open the row page
|
|
await tester.openFirstRowDetailPage();
|
|
|
|
for (final fieldType in [
|
|
FieldType.Checklist,
|
|
FieldType.DateTime,
|
|
FieldType.Number,
|
|
FieldType.URL,
|
|
FieldType.MultiSelect,
|
|
FieldType.LastEditedTime,
|
|
FieldType.CreatedTime,
|
|
FieldType.Checkbox,
|
|
]) {
|
|
await tester.tapRowDetailPageCreatePropertyButton();
|
|
await tester.renameField(fieldType.name);
|
|
|
|
// Open the type option menu
|
|
await tester.tapTypeOptionButton();
|
|
|
|
await tester.selectFieldType(fieldType);
|
|
await tester.dismissFieldEditor();
|
|
|
|
// After update the field type, the cells should be updated
|
|
await tester.findCellByFieldType(fieldType);
|
|
await tester.scrollRowDetailByOffset(const Offset(0, -50));
|
|
}
|
|
});
|
|
|
|
testWidgets('check document is exist in row detail page', (tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
// Create a new grid
|
|
await tester.tapAddButton();
|
|
await tester.tapCreateGridButton();
|
|
|
|
// Hover first row and then open the row page
|
|
await tester.openFirstRowDetailPage();
|
|
|
|
// Each row detail page should have a document
|
|
await tester.assertDocumentExistInRowDetailPage();
|
|
});
|
|
|
|
testWidgets('update the content of the document and re-open it',
|
|
(tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
// Create a new grid
|
|
await tester.tapAddButton();
|
|
await tester.tapCreateGridButton();
|
|
|
|
// Hover first row and then open the row page
|
|
await tester.openFirstRowDetailPage();
|
|
|
|
// Wait for the document to be loaded
|
|
await tester.wait(500);
|
|
|
|
// Focus on the editor
|
|
final textBlock = find.byType(TextBlockComponentWidget);
|
|
await tester.tapAt(tester.getCenter(textBlock));
|
|
|
|
// Input some text
|
|
const inputText = 'Hello world';
|
|
await tester.ime.insertText(inputText);
|
|
expect(
|
|
find.textContaining(inputText, findRichText: true),
|
|
findsOneWidget,
|
|
);
|
|
|
|
// Tap outside to dismiss the field
|
|
await tester.tapAt(Offset.zero);
|
|
await tester.pumpAndSettle();
|
|
|
|
// Re-open the document
|
|
await tester.openFirstRowDetailPage();
|
|
expect(
|
|
find.textContaining(inputText, findRichText: true),
|
|
findsOneWidget,
|
|
);
|
|
});
|
|
|
|
testWidgets('delete row in row detail page', (tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
// Create a new grid
|
|
await tester.tapAddButton();
|
|
await tester.tapCreateGridButton();
|
|
|
|
// Hover first row and then open the row page
|
|
await tester.openFirstRowDetailPage();
|
|
|
|
await tester.tapRowDetailPageDeleteRowButton();
|
|
await tester.tapEscButton();
|
|
|
|
await tester.assertNumberOfRowsInGridPage(2);
|
|
});
|
|
|
|
testWidgets('duplicate row in row detail page', (tester) async {
|
|
await tester.initializeAppFlowy();
|
|
await tester.tapGoButton();
|
|
|
|
// Create a new grid
|
|
await tester.tapAddButton();
|
|
await tester.tapCreateGridButton();
|
|
|
|
// Hover first row and then open the row page
|
|
await tester.openFirstRowDetailPage();
|
|
|
|
await tester.tapRowDetailPageDuplicateRowButton();
|
|
await tester.tapEscButton();
|
|
|
|
await tester.assertNumberOfRowsInGridPage(4);
|
|
});
|
|
});
|
|
}
|