language_test.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import 'package:appflowy/workspace/presentation/settings/widgets/settings_language_view.dart';
  2. import 'package:flutter_test/flutter_test.dart';
  3. import 'package:integration_test/integration_test.dart';
  4. import 'util/util.dart';
  5. void main() {
  6. IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  7. group('document', () {
  8. const location = 'appflowy';
  9. setUpAll(() async {
  10. await TestFolder.setTestLocation(location);
  11. });
  12. tearDownAll(() async {
  13. await TestFolder.cleanTestLocation(null);
  14. });
  15. testWidgets(
  16. 'change the language successfully when launching the app for the first time',
  17. (tester) async {
  18. await tester.initializeAppFlowy();
  19. await tester.tapLanguageSelectorOnWelcomePage();
  20. expect(find.byType(LanguageItemsListView), findsOneWidget);
  21. await tester.tapLanguageItem(languageCode: 'zh', countryCode: 'CN');
  22. tester.expectToSeeText('开始');
  23. await tester.tapLanguageItem(languageCode: 'en', scrollDelta: -100);
  24. tester.expectToSeeText('Quick Start');
  25. await tester.tapLanguageItem(languageCode: 'it', countryCode: 'IT');
  26. tester.expectToSeeText('Andiamo');
  27. });
  28. /// Make sure this test is executed after the test above.
  29. testWidgets('check the language after relaunching the app', (tester) async {
  30. await tester.initializeAppFlowy();
  31. tester.expectToSeeText('Andiamo');
  32. });
  33. });
  34. }