import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mobile_app/app.dart'; import 'package:mobile_app/data/repositories/match_repository.dart'; void main() { testWidgets('App smoke test - renders match results, navigates to settings', ( WidgetTester tester, ) async { final directory = await Directory.systemTemp.createTemp('match-results-'); addTearDown(() => directory.delete(recursive: true)); await tester.pumpWidget( MobileApp( matchRepository: MatchRepository( documentsDirectoryProvider: () async => directory, ), ), ); await tester.pumpAndSettle(); expect(find.text('Match Results'), findsOneWidget); expect(find.text('Home'), findsWidgets); expect(find.text('Away'), findsWidgets); expect( find.textContaining(RegExp(r'[A-Z][a-z]{2} \d{2}-\d{2}-\d{2} \d{2}:\d{2}')), findsWidgets, ); expect(find.byType(ExpansionTile), findsWidgets); await tester.tap( find.textContaining(RegExp(r'[A-Z][a-z]{2} \d{2}-\d{2}-\d{2} \d{2}:\d{2}')).first, ); await tester.pumpAndSettle(); expect(find.text('Field goal'), findsWidgets); expect(find.text('Away'), findsWidgets); expect(find.byType(Divider), findsNothing); final matchTile = tester.widget( find.byType(ExpansionTile).first, ); expect(matchTile.shape, const Border()); expect(matchTile.collapsedShape, const Border()); // Switch to Settings tab final settingsNav = find.text('Settings'); expect(settingsNav, findsWidgets); await tester.tap(settingsNav.first); await tester.pumpAndSettle(); // Verify Settings is displayed expect(find.text('Appearance'), findsOneWidget); expect(find.text('Supported Platforms'), findsOneWidget); expect(find.text('Android & iOS (iPhone/iPad)'), findsOneWidget); // Switch back to Dashboard final resultsNav = find.text('Results'); await tester.tap(resultsNav.first); await tester.pumpAndSettle(); expect(find.text('Match Results'), findsOneWidget); final firstMatchFinder = find.byType(Dismissible).first; final firstMatch = tester.widget(firstMatchFinder); final firstMatchKey = firstMatch.key; await tester.fling(firstMatchFinder, const Offset(-600, 0), 1000); await tester.pumpAndSettle(); expect(find.byKey(firstMatchKey!), findsNothing); }); }