database_setting_test.dart 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pbenum.dart';
  2. import 'package:flutter_test/flutter_test.dart';
  3. import 'package:integration_test/integration_test.dart';
  4. import 'util/database_test_op.dart';
  5. import 'util/util.dart';
  6. void main() {
  7. IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  8. group('grid', () {
  9. const location = 'appflowy';
  10. setUp(() async {
  11. await TestFolder.cleanTestLocation(location);
  12. await TestFolder.setTestLocation(location);
  13. });
  14. tearDown(() async {
  15. await TestFolder.cleanTestLocation(location);
  16. });
  17. tearDownAll(() async {
  18. await TestFolder.cleanTestLocation(null);
  19. });
  20. testWidgets('update layout', (tester) async {
  21. await tester.initializeAppFlowy();
  22. await tester.tapGoButton();
  23. await tester.tapAddButton();
  24. await tester.tapCreateGridButton();
  25. // open setting
  26. await tester.tapDatabaseSettingButton();
  27. // select the layout
  28. await tester.tapDatabaseLayoutButton();
  29. // select layout by board
  30. await tester.selectDatabaseLayoutType(DatabaseLayoutPB.Board);
  31. await tester.assertCurrentDatabaseLayoutType(DatabaseLayoutPB.Board);
  32. await tester.pumpAndSettle();
  33. });
  34. testWidgets('update layout multiple times', (tester) async {
  35. await tester.initializeAppFlowy();
  36. await tester.tapGoButton();
  37. await tester.tapAddButton();
  38. await tester.tapCreateGridButton();
  39. // open setting
  40. await tester.tapDatabaseSettingButton();
  41. await tester.tapDatabaseLayoutButton();
  42. await tester.selectDatabaseLayoutType(DatabaseLayoutPB.Board);
  43. await tester.assertCurrentDatabaseLayoutType(DatabaseLayoutPB.Board);
  44. await tester.tapDatabaseSettingButton();
  45. await tester.tapDatabaseLayoutButton();
  46. await tester.selectDatabaseLayoutType(DatabaseLayoutPB.Calendar);
  47. await tester.assertCurrentDatabaseLayoutType(DatabaseLayoutPB.Calendar);
  48. await tester.pumpAndSettle();
  49. });
  50. });
  51. }