2023-06-20 23:48:34 +08:00
|
|
|
import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pbenum.dart';
|
2023-12-31 07:29:40 +08:00
|
|
|
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
|
2023-06-20 23:48:34 +08:00
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:integration_test/integration_test.dart';
|
|
|
|
|
2023-11-27 18:54:31 -08:00
|
|
|
import '../util/database_test_op.dart';
|
|
|
|
import '../util/util.dart';
|
2023-06-20 23:48:34 +08:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
|
|
|
group('database', () {
|
|
|
|
testWidgets('create linked view', (tester) async {
|
|
|
|
await tester.initializeAppFlowy();
|
|
|
|
await tester.tapGoButton();
|
|
|
|
|
2023-12-27 11:42:39 +08:00
|
|
|
await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
|
2023-06-20 23:48:34 +08:00
|
|
|
|
|
|
|
// Create board view
|
2023-11-21 22:54:09 +08:00
|
|
|
await tester.tapCreateLinkedDatabaseViewButton(DatabaseLayoutPB.Board);
|
2023-06-20 23:48:34 +08:00
|
|
|
tester.assertCurrentDatabaseTagIs(DatabaseLayoutPB.Board);
|
|
|
|
|
|
|
|
// Create grid view
|
2023-11-21 22:54:09 +08:00
|
|
|
await tester.tapCreateLinkedDatabaseViewButton(DatabaseLayoutPB.Grid);
|
2023-06-20 23:48:34 +08:00
|
|
|
tester.assertCurrentDatabaseTagIs(DatabaseLayoutPB.Grid);
|
|
|
|
|
|
|
|
// Create calendar view
|
2023-11-21 22:54:09 +08:00
|
|
|
await tester.tapCreateLinkedDatabaseViewButton(DatabaseLayoutPB.Calendar);
|
2023-06-20 23:48:34 +08:00
|
|
|
tester.assertCurrentDatabaseTagIs(DatabaseLayoutPB.Calendar);
|
|
|
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
});
|
|
|
|
|
|
|
|
testWidgets('rename and delete linked view', (tester) async {
|
|
|
|
await tester.initializeAppFlowy();
|
|
|
|
await tester.tapGoButton();
|
|
|
|
|
2023-12-27 11:42:39 +08:00
|
|
|
await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
|
2023-06-20 23:48:34 +08:00
|
|
|
|
|
|
|
// Create board view
|
2023-11-21 22:54:09 +08:00
|
|
|
await tester.tapCreateLinkedDatabaseViewButton(DatabaseLayoutPB.Board);
|
2023-06-20 23:48:34 +08:00
|
|
|
tester.assertCurrentDatabaseTagIs(DatabaseLayoutPB.Board);
|
|
|
|
|
|
|
|
// rename board view
|
|
|
|
await tester.renameLinkedView(
|
|
|
|
tester.findTabBarLinkViewByViewLayout(ViewLayoutPB.Board),
|
|
|
|
'new board',
|
|
|
|
);
|
|
|
|
final findBoard = tester.findTabBarLinkViewByViewName('new board');
|
|
|
|
expect(findBoard, findsOneWidget);
|
|
|
|
|
|
|
|
// delete the board
|
|
|
|
await tester.deleteDatebaseView(findBoard);
|
|
|
|
expect(tester.findTabBarLinkViewByViewName('new board'), findsNothing);
|
|
|
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
});
|
|
|
|
|
|
|
|
testWidgets('delete the last database view', (tester) async {
|
|
|
|
await tester.initializeAppFlowy();
|
|
|
|
await tester.tapGoButton();
|
|
|
|
|
2023-12-27 11:42:39 +08:00
|
|
|
await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
|
2023-06-20 23:48:34 +08:00
|
|
|
|
|
|
|
// Create board view
|
2023-11-21 22:54:09 +08:00
|
|
|
await tester.tapCreateLinkedDatabaseViewButton(DatabaseLayoutPB.Board);
|
2023-06-20 23:48:34 +08:00
|
|
|
tester.assertCurrentDatabaseTagIs(DatabaseLayoutPB.Board);
|
|
|
|
|
|
|
|
// delete the board
|
|
|
|
await tester.deleteDatebaseView(
|
|
|
|
tester.findTabBarLinkViewByViewLayout(ViewLayoutPB.Board),
|
|
|
|
);
|
|
|
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|