This commit is contained in:
kejaro committed 2026-09-27 21:41:56 +01:00
1 parent 97c10c8d12
commit 212410f716
10 files changed
+1061 -32

No files matched your search

+26 -6
View File
@@ -1,30 +1,41 @@
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 {
await tester.pumpWidget(const MobileApp());
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'\d{4}-\d{2}-\d{2} \d{2}:\d{2}')),
find.textContaining(RegExp(r'[A-Z][a-z]{2} \d{2}-\d{2}-\d{2} \d{2}:\d{2}')),
findsWidgets,
);
expect(find.text('Field goal · Away · #32'), findsNothing);
expect(find.byType(ExpansionTile), findsWidgets);
await tester.tap(
find.textContaining(RegExp(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}')).first,
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 · Away · #32'), findsWidgets);
expect(find.textContaining('card · Away · #5 · 120s'), findsWidgets);
expect(find.text('Field goal'), findsWidgets);
expect(find.text('Away'), findsWidgets);
expect(find.byType(Divider), findsNothing);
final matchTile = tester.widget<ExpansionTile>(
find.byType(ExpansionTile).first,
@@ -49,5 +60,14 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('Match Results'), findsOneWidget);
final firstMatchFinder = find.byType(Dismissible).first;
final firstMatch = tester.widget<Dismissible>(firstMatchFinder);
final firstMatchKey = firstMatch.key;
await tester.fling(firstMatchFinder, const Offset(-600, 0), 1000);
await tester.pumpAndSettle();
expect(find.byKey(firstMatchKey!), findsNothing);
});
}