import "dart:ui"; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:words999/main.dart'; import 'package:words999/services/lenormand_pairs_repository.dart'; import 'package:words999/services/tarot_majors_repository.dart'; import 'package:words999/services/settings_repository.dart'; import 'package:words999/services/traditions_repository.dart'; import 'package:words999/services/words_repository.dart'; void main() { testWidgets('App smoke test - launch oracle and verify navigation', (WidgetTester tester) async { tester.view.physicalSize = const Size(1080, 2400); tester.view.devicePixelRatio = 2.0; addTearDown(tester.view.resetPhysicalSize); addTearDown(tester.view.resetDevicePixelRatio); SharedPreferences.setMockInitialValues({}); await WordsRepository().init(remoteDailyShuffle: false); await TraditionsRepository().init(); await LenormandPairsRepository().init(); await TarotMajorsRepository().init(); await SettingsRepository().init(); await SettingsRepository().setRandomOrgApiKey(''); await tester.pumpWidget(const Words999App()); await tester.pump(); await tester.pump(const Duration(milliseconds: 300)); // Verify all tabs in order: Оракул, Матрица, Справочник, История, Настройки expect(find.text('Оракул'), findsAtLeast(1)); expect(find.text('Справочник'), findsOneWidget); expect(find.text('История'), findsOneWidget); expect(find.text('Настройки'), findsOneWidget); // Open Оракул 999 from hub to verify persona picker await tester.tap(find.text('Оракул 999')); await tester.pumpAndSettle(); expect(find.text('Кто толкует знаки'), findsWidgets); expect(find.text('Ясный оракул'), findsWidgets); // Go back to Hub await tester.pageBack(); await tester.pumpAndSettle(); // Navigate to Матрица from Divination Hub await tester.tap(find.text('Матрица 33×30')); await tester.pumpAndSettle(); expect(find.text('Полотно Домов 33×30'), findsOneWidget); await tester.pageBack(); await tester.pumpAndSettle(); // Navigate to Справочник tab await tester.tap(find.text('Справочник')); await tester.pumpAndSettle(); expect(find.text('Справочник 999'), findsOneWidget); expect(find.text('🔤 Слова Оракула'), findsNothing); expect(find.text('🏛️ Каноны Традиций'), findsNothing); await tester.tap(find.text('ᚱ Руны')); await tester.pumpAndSettle(); expect(find.text('24 из 24'), findsOneWidget); expect(find.textContaining('Феху'), findsOneWidget); await tester.ensureVisible(find.text('☯️ И Цзин')); await tester.pumpAndSettle(); await tester.tap(find.text('☯️ И Цзин')); await tester.pumpAndSettle(); expect(find.text('72 из 72'), findsOneWidget); await tester.enterText(find.byType(TextField), 'Вэй-цзи'); await tester.pumpAndSettle(); expect(find.textContaining('Гексаграмма 64'), findsOneWidget); await tester.enterText(find.byType(TextField), ''); await tester.pumpAndSettle(); await tester.ensureVisible(find.text('🪶 Ленорман')); await tester.pumpAndSettle(); await tester.tap(find.text('🪶 Ленорман')); await tester.pumpAndSettle(); expect(find.text('Описания и сочетания'), findsWidgets); await tester.tap(find.text('Описания и сочетания').first); await tester.pumpAndSettle(); expect(find.text('Значение'), findsOneWidget); await tester.scrollUntilVisible( find.textContaining('Сочетания ('), 400, scrollable: find.byType(Scrollable).last, ); expect(find.textContaining('Сочетания ('), findsOneWidget); await tester.pageBack(); await tester.pumpAndSettle(); // Navigate to Настройки tab await tester.tap(find.text('Настройки')); await tester.pumpAndSettle(); expect(find.text('Голос толкователя'), findsOneWidget); }); }