Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: time field time type and time tracks #5747

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'package:appflowy/plugins/database/widgets/cell/editable_cell_skeleton/time.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';

import '../../shared/database_test_op.dart';
import '../../shared/util.dart';

Expand All @@ -25,6 +28,7 @@ void main() {
name: fieldName,
layout: ViewLayoutPB.Board,
);
await tester.dismissFieldEditor();
await tester.tapButton(card1);
await tester.changeFieldTypeOfFieldWithName(
fieldName,
Expand All @@ -33,5 +37,36 @@ void main() {
);
await tester.hoverOnWidget(find.text('Card 2'));
});

testWidgets('time field plain time time-type', (tester) async {
await tester.initializeAppFlowy();
await tester.tapAnonymousSignInButton();

await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Board);
const name = 'Card 1';
final card1 = find.text(name);
await tester.tapButton(card1);

const fieldName = "Time";
await tester.createField(
FieldType.Time,
name: fieldName,
layout: ViewLayoutPB.Board,
);
await tester.dismissFieldEditor();
await tester.tapButton(card1);

final editableTimeCell = find.byType(EditableTimeCell);
expect(editableTimeCell, findsOne);
await tester.enterText(
find.descendant(of: editableTimeCell, matching: find.byType(TextField)),
'31',
);
await tester.testTextInput.receiveAction(TextInputAction.done);
await tester.pumpAndSettle(const Duration(milliseconds: 300));

final EditableTimeCellState state = tester.state(editableTimeCell);
expect(state.cellBloc.state.content, '31m');
});
});
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import 'package:flutter/widgets.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'package:appflowy/plugins/database/widgets/card/card.dart';
import 'package:appflowy/plugins/database/widgets/cell_editor/extension.dart';
import 'package:appflowy/plugins/database/widgets/row/row_property.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:appflowy_board/appflowy_board.dart';

import '../../shared/util.dart';
import '../../shared/database_test_op.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -46,5 +50,56 @@ void main() {
final card1StatusText = tester.widget<Text>(card1StatusFinder).data;
expect(card1StatusText, 'Doing');
});

testWidgets('add new group', (tester) async {
await tester.initializeAppFlowy();
await tester.tapAnonymousSignInButton();
await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Board);

// assert number of groups
tester.assertNumberOfGroups(4);

// scroll the board horizontally to ensure add new group button appears
await tester.scrollBoardToEnd();

// assert and click on add new group button
tester.assertNewGroupTextField(false);
await tester.tapNewGroupButton();
tester.assertNewGroupTextField(true);

// enter new group name and submit
await tester.enterNewGroupName('needs design', submit: true);

// assert number of groups has increased
tester.assertNumberOfGroups(5);

// assert text field has disappeared
await tester.scrollBoardToEnd();
tester.assertNewGroupTextField(false);

// click on add new group button
await tester.tapNewGroupButton();
tester.assertNewGroupTextField(true);

// type some things
await tester.enterNewGroupName('needs planning', submit: false);

// click on clear button and assert empty contents
await tester.clearNewGroupTextField();

// press escape to cancel
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
tester.assertNewGroupTextField(false);

// click on add new group button
await tester.tapNewGroupButton();
tester.assertNewGroupTextField(true);

// press elsewhere to cancel
await tester.tap(find.byType(AppFlowyBoard));
await tester.pumpAndSettle();
tester.assertNewGroupTextField(false);
});
});
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/database/widgets/card/card.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:appflowy_board/appflowy_board.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../../shared/database_test_op.dart';
import '../../shared/util.dart';

void main() {
Expand Down Expand Up @@ -50,56 +47,5 @@ void main() {
await tester.tapButtonWithName(LocaleKeys.button_duplicate.tr());
expect(find.textContaining(name, findRichText: true), findsNWidgets(2));
});

testWidgets('add new group', (tester) async {
await tester.initializeAppFlowy();
await tester.tapAnonymousSignInButton();
await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Board);

// assert number of groups
tester.assertNumberOfGroups(4);

// scroll the board horizontally to ensure add new group button appears
await tester.scrollBoardToEnd();

// assert and click on add new group button
tester.assertNewGroupTextField(false);
await tester.tapNewGroupButton();
tester.assertNewGroupTextField(true);

// enter new group name and submit
await tester.enterNewGroupName('needs design', submit: true);

// assert number of groups has increased
tester.assertNumberOfGroups(5);

// assert text field has disappeared
await tester.scrollBoardToEnd();
tester.assertNewGroupTextField(false);

// click on add new group button
await tester.tapNewGroupButton();
tester.assertNewGroupTextField(true);

// type some things
await tester.enterNewGroupName('needs planning', submit: false);

// click on clear button and assert empty contents
await tester.clearNewGroupTextField();

// press escape to cancel
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
tester.assertNewGroupTextField(false);

// click on add new group button
await tester.tapNewGroupButton();
tester.assertNewGroupTextField(true);

// press elsewhere to cancel
await tester.tap(find.byType(AppFlowyBoard));
await tester.pumpAndSettle();
tester.assertNewGroupTextField(false);
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:integration_test/integration_test.dart';
import 'board_add_row_test.dart' as board_add_row_test;
import 'board_group_test.dart' as board_group_test;
import 'board_row_test.dart' as board_row_test;
import 'board_field_test.dart' as board_field_test;

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand All @@ -11,4 +12,5 @@ void main() {
board_row_test.main();
board_add_row_test.main();
board_group_test.main();
board_field_test.main();
}
Loading
Loading