start quesitonnaire

This commit is contained in:
verboomp
2026-02-19 11:04:02 +01:00
parent 168fc986f2
commit 9b3446685a
47 changed files with 2456 additions and 97 deletions

View File

@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fotodocumentation/utils/global_router.dart';
import 'package:fotodocumentation/utils/login_credentials.dart';
import 'package:mockito/mockito.dart';
import 'package:fotodocumentation/controller/customer_controller.dart';
import 'package:fotodocumentation/dto/customer_dto.dart';
import 'package:fotodocumentation/utils/di_container.dart';
import '../../../testing/test_utils.dart';
import '../../../testing/test_utils.mocks.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
DiContainer.instance.initState();
DiContainer.instance.put(LoginCredentials, getDefaultLoginCredentials());
group('Customer List Test', () {
testWidgets('Customer list screen search test', (WidgetTester tester) async {
await _searchtest(tester);
});
});
}
List<CustomerListDto> _list = [CustomerListDto(id: 1, customerNumber: "CODE1", name: "Customer 1"), CustomerListDto(id: 2, customerNumber: "CODE2", name: "Customer 2")];
Future<void> _searchtest(WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
String searchText = 'Henk';
var controller = MockCustomerController();
DiContainer.instance.put(CustomerController, controller);
when(controller.getAll("", "")).thenAnswer((_) async => _list);
when(controller.getAll(searchText, "")).thenAnswer((_) async => [_list.first]);
await pumpAppConfig(tester, GlobalRouter.pathFotoHome);
verify(controller.getAll(argThat(equals("")), argThat(equals("")))).called(1);
await tester.enterText(find.byKey(Key("Search_text_field")), searchText);
await tester.testTextInput.receiveAction(TextInputAction.done);
await tester.pumpAndSettle();
verify(controller.getAll(searchText, "")).called(1);
}

View File

@@ -0,0 +1,126 @@
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fotodocumentation/dto/picture_dto.dart';
import 'package:fotodocumentation/pages/foto/customer/foto_picture_delete_dialog.dart';
import 'package:fotodocumentation/pages/foto/customer/foto_picture_widget.dart';
import 'package:fotodocumentation/utils/global_router.dart';
import 'package:fotodocumentation/utils/login_credentials.dart';
import 'package:mockito/mockito.dart';
import 'package:fotodocumentation/controller/customer_controller.dart';
import 'package:fotodocumentation/controller/picture_controller.dart';
import 'package:fotodocumentation/dto/customer_dto.dart';
import 'package:fotodocumentation/utils/di_container.dart';
import 'package:flutter_image_test_utils/flutter_image_test_utils.dart';
import '../../../testing/test_utils.dart';
import '../../../testing/test_utils.mocks.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
DiContainer.instance.initState();
DiContainer.instance.put(LoginCredentials, getDefaultLoginCredentials());
group('Customer Test', () {
testWidgets('Customer screen', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
var controller = MockCustomerController();
var pictureController = MockPictureController();
DiContainer.instance.put(PictureController, pictureController);
DiContainer.instance.put(CustomerController, controller);
when(controller.get(id: 1)).thenAnswer((_) async => _dto);
when(controller.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1");
verify(controller.get(id: 1)).called(1);
// Click on the first row (InkWell) to open the picture popup
await tester.tap(find.byKey(Key("table_row_1")).first);
await tester.pumpAndSettle();
// Verify that the popup is shown by checking for the PictureWidget
expect(find.byType(FotoPictureWidget), findsOneWidget);
});
});
testWidgets('Customer delete yes', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
var controller = MockCustomerController();
var pictureController = MockPictureController();
DiContainer.instance.put(PictureController, pictureController);
DiContainer.instance.put(CustomerController, controller);
when(controller.get(id: 1)).thenAnswer((_) async => _dto);
when(controller.getAll("", "")).thenAnswer((_) async => _list);
when(pictureController.delete(argThat(isA<PictureDto>()))).thenAnswer((_) async => true);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1");
verify(controller.get(id: 1)).called(1);
// Click on the first row (InkWell) to open the picture popup
await tester.tap(find.byKey(Key("table_row_delete_1")).first);
await tester.pumpAndSettle();
// Verify that the popup is shown by checking for the PictureWidget
expect(find.byType(FotoPictureDeleteDialog), findsOneWidget);
// Click the yes button to confirm delete
await tester.tap(find.byKey(Key("picture_delete_yes")));
await tester.pumpAndSettle();
// Verify that the delete method was called on the picture controller
verify(pictureController.delete(argThat(isA<PictureDto>()))).called(1);
});
});
testWidgets('Customer delete no', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
var controller = MockCustomerController();
var pictureController = MockPictureController();
DiContainer.instance.put(PictureController, pictureController);
DiContainer.instance.put(CustomerController, controller);
when(controller.get(id: 1)).thenAnswer((_) async => _dto);
when(controller.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1");
verify(controller.get(id: 1)).called(1);
// Click on the first row (InkWell) to open the picture popup
await tester.tap(find.byKey(Key("table_row_delete_1")).first);
await tester.pumpAndSettle();
// Verify that the popup is shown by checking for the PictureWidget
expect(find.byType(FotoPictureDeleteDialog), findsOneWidget);
// Click the yes button to confirm delete
await tester.tap(find.byKey(Key("picture_delete_no")));
await tester.pumpAndSettle();
// Verify that the delete method was called on the picture controller
verifyNever(pictureController.delete(argThat(isA<PictureDto>())));
});
});
});
}
CustomerDto _dto = CustomerDto(id: 1, customerNumber: "CODE1", name: "Customer 1", pictures: [
PictureDto(
id: 1,
comment: "Some comment",
category: "category",
pictureDate: DateTime.now(),
username: "username",
imageUrl: "https://en.wikipedia.org/wiki/File:Keir_Starmer_meets_T%C3%B4_L%C3%A2m_29-10-2025_(6)_(cropped).jpg",
evaluation: 1,
normalSizeUrl: "https://en.wikipedia.org/wiki/File:Keir_Starmer_meets_T%C3%B4_L%C3%A2m_29-10-2025_(6)_(cropped).jpg",
thumbnailSizeUrl: "https://en.wikipedia.org/wiki/File:Keir_Starmer_meets_T%C3%B4_L%C3%A2m_29-10-2025_(6)_(cropped).jpg"),
]);
List<CustomerListDto> _list = [CustomerListDto(id: 1, customerNumber: "CODE1", name: "Customer 1"), CustomerListDto(id: 2, customerNumber: "CODE2", name: "Customer 2")];

View File

@@ -0,0 +1,270 @@
import 'package:flutter/material.dart';
import 'package:flutter_image_test_utils/image_test/image_test_io.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fotodocumentation/controller/customer_controller.dart';
import 'package:fotodocumentation/dto/customer_dto.dart' show CustomerDto, CustomerListDto;
import 'package:fotodocumentation/dto/picture_dto.dart';
import 'package:fotodocumentation/pages/foto/customer/foto_picture_fullscreen_dialog.dart';
import 'package:fotodocumentation/utils/di_container.dart';
import 'package:fotodocumentation/utils/global_router.dart';
import 'package:fotodocumentation/utils/login_credentials.dart';
import 'package:mockito/mockito.dart';
import '../../../testing/test_utils.dart';
import '../../../testing/test_utils.mocks.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
DiContainer.instance.initState();
DiContainer.instance.put(LoginCredentials, getDefaultLoginCredentials());
late CustomerDto customerDto;
late PictureDto pictureDto1;
late PictureDto pictureDto2;
late PictureDto pictureDto3;
late MockCustomerController mockCustomerController;
setUp(() {
pictureDto1 = PictureDto(
id: 1,
comment: 'First picture comment',
category: 'category1',
pictureDate: DateTime(2024, 1, 15),
username: 'user1',
evaluation: 1,
imageUrl: "",
normalSizeUrl: "",
thumbnailSizeUrl: "",
);
pictureDto2 = PictureDto(
id: 2,
comment: 'Second picture comment',
category: 'category2',
pictureDate: DateTime(2024, 2, 20),
username: 'user2',
evaluation: 1,
imageUrl: "",
normalSizeUrl: "",
thumbnailSizeUrl: "",
);
pictureDto3 = PictureDto(
id: 3,
comment: null,
category: 'category3',
pictureDate: DateTime(2024, 3, 25),
username: 'user3',
evaluation: 1,
imageUrl: "",
normalSizeUrl: "",
thumbnailSizeUrl: "",
);
customerDto = CustomerDto(
id: 1,
name: 'Test Apotheke',
customerNumber: 'CUST001',
pictures: [pictureDto1, pictureDto2, pictureDto3],
);
mockCustomerController = MockCustomerController();
DiContainer.instance.put(CustomerController, mockCustomerController);
});
group('PictureWidget', () {
testWidgets('displays customer information correctly', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => customerDto);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/1");
await tester.pumpAndSettle();
// Verify customer name is displayed
expect(find.text('Test Apotheke'), findsOneWidget);
// Verify customer number is displayed
expect(find.text('CUST001'), findsOneWidget);
// Verify labels are displayed
expect(find.text('KUNDENNUMMER'), findsOneWidget);
expect(find.text('KOMMENTAR'), findsOneWidget);
});
});
testWidgets('displays picture comment', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => customerDto);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/1");
await tester.pumpAndSettle();
// Verify the comment is displayed
expect(find.text('First picture comment'), findsOneWidget);
});
});
testWidgets('displays empty string when comment is null', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => customerDto);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/1");
await tester.pumpAndSettle();
// The comment field should be empty but the label should exist
expect(find.text('KOMMENTAR'), findsOneWidget);
});
});
testWidgets('shows both navigation buttons at bottom', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => customerDto);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/1");
await tester.pumpAndSettle();
// Both navigation buttons should always be visible at the bottom
expect(find.byKey(Key("navigate_left")), findsOneWidget);
expect(find.byKey(Key("navigate_right")), findsOneWidget);
});
});
testWidgets('shows both navigation buttons when on middle picture', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => customerDto);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/1");
await tester.pumpAndSettle();
// Both navigation buttons should be visible
expect(find.byKey(Key("navigate_left")), findsOneWidget);
expect(find.byKey(Key("navigate_right")), findsOneWidget);
});
});
testWidgets('shows both navigation buttons on last picture', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => customerDto);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/1");
await tester.pumpAndSettle();
// Both navigation buttons should be visible (right one is disabled)
expect(find.byKey(Key("navigate_left")), findsOneWidget);
expect(find.byKey(Key("navigate_right")), findsOneWidget);
});
});
testWidgets('navigates to next picture when right button is tapped', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => customerDto);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/1");
await tester.pumpAndSettle();
// Verify first picture comment is shown
expect(find.text('First picture comment'), findsOneWidget);
// Tap right navigation button
await tester.tap(find.byKey(Key("navigate_right")));
await tester.pumpAndSettle();
// Verify second picture comment is now shown
expect(find.text('Second picture comment'), findsOneWidget);
expect(find.text('First picture comment'), findsNothing);
});
});
testWidgets('navigates to previous picture when left button is tapped', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => customerDto);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/2");
await tester.pumpAndSettle();
// Verify second picture comment is shown
expect(find.text('Second picture comment'), findsOneWidget);
// Tap left navigation button
await tester.tap(find.byKey(Key("navigate_left")));
await tester.pumpAndSettle();
// Verify first picture comment is now shown
expect(find.text('First picture comment'), findsOneWidget);
expect(find.text('Second picture comment'), findsNothing);
});
});
testWidgets('shows disabled navigation buttons when only one picture', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
final singlePictureCustomer = CustomerDto(
id: 1,
name: 'Test Apotheke',
customerNumber: 'CUST001',
pictures: [pictureDto1],
);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => singlePictureCustomer);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/1");
await tester.pumpAndSettle();
// Both navigation buttons should be shown but disabled
expect(find.byKey(Key("navigate_left")), findsOneWidget);
expect(find.byKey(Key("navigate_right")), findsOneWidget);
});
});
testWidgets('opens fullscreen dialog when image is tapped', (WidgetTester tester) async {
setScreenSize(tester, 2048, 2048);
when(mockCustomerController.get(id: 1)).thenAnswer((_) async => customerDto);
when(mockCustomerController.getAll("", "")).thenAnswer((_) async => _list);
provideMockedNetworkImages(() async {
await pumpAppConfig(tester, "${GlobalRouter.pathFotoHome}${GlobalRouter.pathFotoCustomer}/1${GlobalRouter.pathFotoPicture}/1");
await tester.pumpAndSettle();
// Find the GestureDetector with the image key
final imageFinder = find.byKey(const Key("image"));
expect(imageFinder, findsOneWidget);
// Ensure the widget is visible first
await tester.ensureVisible(imageFinder);
await tester.pumpAndSettle();
// Tap the image - use warnIfMissed: false since the Image.memory may have
// rendering issues in test environment but the GestureDetector should still work
await tester.tap(imageFinder, warnIfMissed: false);
await tester.pumpAndSettle();
// Verify fullscreen dialog is shown
expect(find.byType(FotoPictureFullscreenDialog), findsOneWidget);
});
});
});
}
List<CustomerListDto> _list = [CustomerListDto(id: 1, customerNumber: "CODE1", name: "Customer 1"), CustomerListDto(id: 2, customerNumber: "CODE2", name: "Customer 2")];

View File

@@ -0,0 +1,200 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fotodocumentation/controller/login_controller.dart';
import 'package:fotodocumentation/dto/jwt_token_pair_dto.dart';
import 'package:fotodocumentation/pages/foto/login/foto_login_widget.dart';
import 'package:fotodocumentation/utils/di_container.dart';
import 'package:fotodocumentation/utils/global_router.dart';
import 'package:fotodocumentation/utils/login_credentials.dart';
import 'package:mockito/mockito.dart';
import '../../../testing/test_utils.dart';
import '../../../testing/test_utils.mocks.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
DiContainer.instance.initState();
late MockLoginController mockLoginController;
late MockLoginCredentials mockLoginCredentials;
setUp(() {
mockLoginController = MockLoginController();
mockLoginCredentials = MockLoginCredentials();
when(mockLoginCredentials.isLoggedIn).thenReturn(false);
DiContainer.instance.put(LoginController, mockLoginController);
DiContainer.instance.put(LoginCredentials, mockLoginCredentials);
});
group('LoginWidget', () {
testWidgets('displays login title', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
await pumpApp(tester, const FotoLoginWidget());
await tester.pumpAndSettle();
// Verify the login title is displayed (German localization)
expect(find.byKey(const Key('login_title')), findsOneWidget);
});
testWidgets('displays username and password fields', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
await pumpApp(tester, const FotoLoginWidget());
await tester.pumpAndSettle();
// Verify username field exists
expect(find.byKey(const Key("username")), findsOneWidget);
// Verify password field exists
expect(find.byKey(const Key("password")), findsOneWidget);
});
testWidgets('displays login button', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
await pumpApp(tester, const FotoLoginWidget());
await tester.pumpAndSettle();
// Verify login button exists
expect(find.byKey(const Key("SubmitWidgetButton")), findsOneWidget);
});
testWidgets('can enter username and password', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
await pumpApp(tester, const FotoLoginWidget());
await tester.pumpAndSettle();
// Enter username
await tester.enterText(find.byKey(const Key("username")), 'testuser');
await tester.pumpAndSettle();
// Enter password
await tester.enterText(find.byKey(const Key("password")), 'testpassword');
await tester.pumpAndSettle();
// Verify text was entered
expect(find.text('testuser'), findsOneWidget);
});
testWidgets('calls authenticate on login button tap', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
final jwtTokenPairDto = JwtTokenPairDto(
accessToken: 'test_access_token',
refreshToken: 'test_refresh_token',
);
when(mockLoginController.authenticate('testuser', 'testpassword'))
.thenAnswer((_) async => (jwtTokenPairDto: jwtTokenPairDto));
await pumpAppConfig(tester, GlobalRouter.pathFotoLogin);
await tester.pumpAndSettle();
// Enter credentials
await tester.enterText(find.byKey(const Key("username")), 'testuser');
await tester.enterText(find.byKey(const Key("password")), 'testpassword');
await tester.pumpAndSettle();
// Tap login button
await tester.tap(find.byKey(const Key("SubmitWidgetButton")));
await tester.pumpAndSettle();
// Verify authenticate was called with correct credentials
verify(mockLoginController.authenticate('testuser', 'testpassword')).called(1);
});
testWidgets('sets logged in on successful authentication', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
final jwtTokenPairDto = JwtTokenPairDto(
accessToken: 'test_access_token',
refreshToken: 'test_refresh_token',
);
when(mockLoginController.authenticate('testuser', 'testpassword'))
.thenAnswer((_) async => (jwtTokenPairDto: jwtTokenPairDto));
await pumpAppConfig(tester, GlobalRouter.pathFotoLogin);
await tester.pumpAndSettle();
// Enter credentials
await tester.enterText(find.byKey(const Key("username")), 'testuser');
await tester.enterText(find.byKey(const Key("password")), 'testpassword');
await tester.pumpAndSettle();
// Tap login button
await tester.tap(find.byKey(const Key("SubmitWidgetButton")));
await tester.pumpAndSettle();
// Verify setLoggedIn was called
verify(mockLoginCredentials.setLoggedIn(true)).called(1);
});
testWidgets('displays error message on failed authentication', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockLoginController.authenticate('testuser', 'wrongpassword'))
.thenAnswer((_) async => (jwtTokenPairDto: null));
await pumpAppConfig(tester, GlobalRouter.pathFotoLogin);
await tester.pumpAndSettle();
// Enter credentials
await tester.enterText(find.byKey(const Key("username")), 'testuser');
await tester.enterText(find.byKey(const Key("password")), 'wrongpassword');
await tester.pumpAndSettle();
// Tap login button
await tester.tap(find.byKey(const Key("SubmitWidgetButton")));
await tester.pumpAndSettle();
// Verify error message is displayed (German localization)
expect(find.text('Falscher Benutzername oder Passwort'), findsOneWidget);
});
testWidgets('does not call setLoggedIn on failed authentication', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
when(mockLoginController.authenticate('testuser', 'wrongpassword'))
.thenAnswer((_) async => (jwtTokenPairDto: null));
await pumpApp(tester, const FotoLoginWidget());
await tester.pumpAndSettle();
// Enter credentials
await tester.enterText(find.byKey(const Key("username")), 'testuser');
await tester.enterText(find.byKey(const Key("password")), 'wrongpassword');
await tester.pumpAndSettle();
// Tap login button
await tester.tap(find.byKey(const Key("SubmitWidgetButton")));
await tester.pumpAndSettle();
// Verify setLoggedIn was NOT called
verifyNever(mockLoginCredentials.setLoggedIn(any));
});
testWidgets('password field obscures text', (WidgetTester tester) async {
setScreenSize(tester, 1024, 1024);
await pumpApp(tester, const FotoLoginWidget());
await tester.pumpAndSettle();
// Find the EditableText descendant of the password field
// TextFormField wraps TextField which contains EditableText
final passwordFieldFinder = find.byKey(const Key("password"));
final editableTextFinder = find.descendant(
of: passwordFieldFinder,
matching: find.byType(EditableText),
);
final editableText = tester.widget<EditableText>(editableTextFinder);
// Verify obscureText is true
expect(editableText.obscureText, isTrue);
});
});
}