database_row_test.dart 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import 'package:flutter_test/flutter_test.dart';
  2. import 'package:integration_test/integration_test.dart';
  3. import 'util/database_test_op.dart';
  4. import 'util/util.dart';
  5. void main() {
  6. IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  7. group('grid', () {
  8. const location = 'appflowy';
  9. setUp(() async {
  10. await TestFolder.cleanTestLocation(location);
  11. await TestFolder.setTestLocation(location);
  12. });
  13. tearDown(() async {
  14. await TestFolder.cleanTestLocation(location);
  15. });
  16. tearDownAll(() async {
  17. await TestFolder.cleanTestLocation(null);
  18. });
  19. testWidgets('create row of the grid', (tester) async {
  20. await tester.initializeAppFlowy();
  21. await tester.tapGoButton();
  22. await tester.tapAddButton();
  23. await tester.tapCreateGridButton();
  24. await tester.tapCreateRowButtonInGrid();
  25. // The initial number of rows is 3
  26. await tester.assertNumberOfRowsInGridPage(4);
  27. await tester.pumpAndSettle();
  28. });
  29. testWidgets('create row from row menu of the grid', (tester) async {
  30. await tester.initializeAppFlowy();
  31. await tester.tapGoButton();
  32. await tester.tapAddButton();
  33. await tester.tapCreateGridButton();
  34. await tester.hoverOnFirstRowOfGrid();
  35. await tester.tapCreateRowButtonInRowMenuOfGrid();
  36. // The initial number of rows is 3
  37. await tester.assertNumberOfRowsInGridPage(4);
  38. await tester.assertRowCountInGridPage(4);
  39. await tester.pumpAndSettle();
  40. });
  41. testWidgets('delete row of the grid', (tester) async {
  42. await tester.initializeAppFlowy();
  43. await tester.tapGoButton();
  44. await tester.tapAddButton();
  45. await tester.tapCreateGridButton();
  46. await tester.hoverOnFirstRowOfGrid();
  47. // Open the row menu and then click the delete
  48. await tester.tapRowMenuButtonInGrid();
  49. await tester.tapDeleteOnRowMenu();
  50. // The initial number of rows is 3
  51. await tester.assertNumberOfRowsInGridPage(2);
  52. await tester.assertRowCountInGridPage(2);
  53. await tester.pumpAndSettle();
  54. });
  55. testWidgets('check number of row indicator in the initial grid',
  56. (tester) async {
  57. await tester.initializeAppFlowy();
  58. await tester.tapGoButton();
  59. await tester.tapAddButton();
  60. await tester.tapCreateGridButton();
  61. await tester.assertRowCountInGridPage(3);
  62. await tester.pumpAndSettle();
  63. });
  64. });
  65. }