Versione OK Pour l'onglet événements.
This commit is contained in:
@@ -1,92 +0,0 @@
|
||||
// Tests pour l'application UnionFlow Mobile
|
||||
//
|
||||
// Tests de base pour vérifier le bon fonctionnement des fonctionnalités principales
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
|
||||
import 'package:unionflow_mobile_apps/main.dart';
|
||||
import 'package:unionflow_mobile_apps/core/di/injection.dart';
|
||||
import 'package:unionflow_mobile_apps/features/members/presentation/pages/membre_create_page.dart';
|
||||
import 'package:unionflow_mobile_apps/shared/widgets/permission_widget.dart';
|
||||
|
||||
void main() {
|
||||
group('UnionFlow Mobile App Tests', () {
|
||||
setUpAll(() async {
|
||||
// Initialiser les dépendances pour les tests
|
||||
await configureDependencies();
|
||||
});
|
||||
|
||||
tearDownAll(() {
|
||||
// Nettoyer les dépendances après les tests
|
||||
GetIt.instance.reset();
|
||||
});
|
||||
|
||||
testWidgets('App should launch successfully', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const UnionFlowApp());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Verify that the app launches and shows the main interface
|
||||
expect(find.byType(MaterialApp), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('FloatingActionButton should be present in members list', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const UnionFlowApp());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Navigate to members tab if needed
|
||||
// This test assumes the members page is accessible
|
||||
|
||||
// Look for FloatingActionButton with add icon
|
||||
expect(find.byType(FloatingActionButton), findsWidgets);
|
||||
expect(find.byIcon(Icons.add), findsWidgets);
|
||||
});
|
||||
|
||||
testWidgets('PermissionFAB should handle permissions correctly', (WidgetTester tester) async {
|
||||
// Test the PermissionFAB widget in isolation
|
||||
bool wasPressed = false;
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
floatingActionButton: PermissionFAB(
|
||||
permission: () => true, // Mock permission granted
|
||||
onPressed: () => wasPressed = true,
|
||||
tooltip: 'Test Button',
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Find and tap the FAB
|
||||
await tester.tap(find.byType(FloatingActionButton));
|
||||
await tester.pump();
|
||||
|
||||
// Verify the callback was called
|
||||
expect(wasPressed, isTrue);
|
||||
});
|
||||
|
||||
testWidgets('MembreCreatePage should have required form fields', (WidgetTester tester) async {
|
||||
// Test the member creation page in isolation
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: MembreCreatePage(),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Verify that essential form fields are present
|
||||
expect(find.byType(TextFormField), findsWidgets);
|
||||
expect(find.byType(AppBar), findsOneWidget);
|
||||
|
||||
// Look for key form elements
|
||||
expect(find.text('Nom'), findsWidgets);
|
||||
expect(find.text('Prénom'), findsWidgets);
|
||||
expect(find.text('Email'), findsWidgets);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user