database_field_settings_test.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import 'package:appflowy/plugins/database_view/grid/presentation/grid_page.dart';
  2. import 'package:appflowy/plugins/database_view/tar_bar/tar_bar_add_button.dart';
  3. import 'package:appflowy_backend/protobuf/flowy-folder2/view.pbenum.dart';
  4. import 'package:flutter_test/flutter_test.dart';
  5. import 'package:integration_test/integration_test.dart';
  6. import 'util/database_test_op.dart';
  7. import 'util/util.dart';
  8. void main() {
  9. IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  10. group('database field settings', () {
  11. testWidgets('field visibility', (tester) async {
  12. await tester.initializeAppFlowy();
  13. await tester.tapGoButton();
  14. await tester.createNewPageWithName(layout: ViewLayoutPB.Grid);
  15. await tester.tapCreateLinkedDatabaseViewButton(AddButtonAction.grid);
  16. // create a field
  17. await tester.scrollToRight(find.byType(GridPage));
  18. await tester.tapNewPropertyButton();
  19. await tester.renameField('New field 1');
  20. await tester.dismissFieldEditor();
  21. // hide the field
  22. await tester.tapGridFieldWithName('New field 1');
  23. await tester.tapHidePropertyButton();
  24. await tester.noFieldWithName('New field 1');
  25. // go back to inline database view, expect field to be shown
  26. await tester.tapTabBarLinkedViewByViewName('Untitled');
  27. await tester.findFieldWithName('New field 1');
  28. // go back to linked database view, expect field to be hidden
  29. await tester.tapTabBarLinkedViewByViewName('grid');
  30. await tester.noFieldWithName('New field 1');
  31. // use the settings button to show the field
  32. await tester.tapDatabaseSettingButton();
  33. await tester.tapViewPropertiesButton();
  34. await tester.tapViewTogglePropertyVisibilityButtonByName('New field 1');
  35. await tester.dismissFieldEditor();
  36. await tester.findFieldWithName('New field 1');
  37. // open first row in popup then hide the field
  38. await tester.openFirstRowDetailPage();
  39. await tester.tapGridFieldWithNameInRowDetailPage('New field 1');
  40. await tester.tapHidePropertyButtonInFieldEditor();
  41. await tester.dismissRowDetailPage();
  42. await tester.noFieldWithName('New field 1');
  43. });
  44. });
  45. }