import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:werwolf/models/player.dart'; import 'package:werwolf/models/role.dart'; import 'package:werwolf/screens/flippingcards.dart'; import 'package:werwolf/screens/gameboard.dart'; void main() { group('FlippingCard Screen Tests', () { List players = [ Player(name: 'Alice', role: Role.dorfbewohner, isDead: false), Player(name: 'Bob', role: Role.werwolf, isDead: false), // Add more players as needed ]; testWidgets('Displays player name on front of card', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp(home: FlipingCard(players: players))); expect(find.text('Alice'), findsOneWidget); expect(find.text('Klick um deine Rolle zu sehen!'), findsOneWidget); }); testWidgets('Flips card to show role', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp(home: FlipingCard(players: players))); await tester.tap(find.text('Klick um deine Rolle zu sehen!')); await tester.pumpAndSettle(); expect(find.text('Dorfbewohner'), findsOneWidget); }); testWidgets('Navigates to PlayerGridView on last player', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp(home: FlipingCard(players: players))); await tester.tap(find.text('Nächster Spieler')); await tester.pumpAndSettle(); await tester.tap(find.text('Spiel anfangen!')); await tester.pumpAndSettle(); expect(find.byType(PlayerGridView), findsOneWidget); }); }); }