board_test.dart 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import 'package:appflowy_board/appflowy_board.dart';
  2. import 'package:flutter_test/flutter_test.dart';
  3. import 'package:integration_test/integration_test.dart';
  4. import 'util/util.dart';
  5. /// Integration tests for an empty board. The [TestWorkspaceService] will load
  6. /// a workspace from an empty board `assets/test/workspaces/board.zip` for all
  7. /// tests.
  8. ///
  9. /// To create another integration test with a preconfigured workspace.
  10. /// Use the following steps.
  11. /// 1. Create a new workspace from the AppFlowy launch screen.
  12. /// 2. Modify the workspace until it is suitable as the starting point for
  13. /// the integration test you need to land.
  14. /// 3. Use a zip utility program to zip the workspace folder that you created.
  15. /// 4. Add the zip file under `assets/test/workspaces/`
  16. /// 5. Add a new enumeration to [TestWorkspace] in `integration_test/utils/data.dart`.
  17. /// For example, if you added a workspace called `empty_calendar.zip`,
  18. /// then [TestWorkspace] should have the following value:
  19. /// ```dart
  20. /// enum TestWorkspace {
  21. /// board('board'),
  22. /// empty_calendar('empty_calendar');
  23. ///
  24. /// /* code */
  25. /// }
  26. /// ```
  27. /// 6. Double check that the .zip file that you added is included as an asset in
  28. /// the pubspec.yaml file under appflowy_flutter.
  29. void main() {
  30. IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  31. const service = TestWorkspaceService(TestWorkspace.board);
  32. group('board', () {
  33. setUpAll(() async => await service.setUpAll());
  34. setUp(() async => await service.setUp());
  35. testWidgets(
  36. 'integration test unzips the proper workspace and loads it correctly.',
  37. (tester) async {
  38. await tester.initializeAppFlowy();
  39. expect(find.byType(AppFlowyBoard), findsOneWidget);
  40. });
  41. });
  42. }