feat: use find.descendant for ExtendedTextField widgets

This commit is contained in:
Udhay-Adithya
2025-08-09 15:57:32 +05:30
parent 92bf9d9aa7
commit 58de8e6d06
5 changed files with 176 additions and 54 deletions

View File

@@ -91,11 +91,20 @@ void main() {
),
);
// Find the username field (first ExtendedTextField)
final textFields = find.byType(ExtendedTextField);
expect(textFields, findsAtLeastNWidgets(2));
// Find EnvAuthField widgets
final authFields = find.byType(EnvAuthField);
expect(authFields, findsNWidgets(2));
// Find the first EnvAuthField (username field)
final firstAuthField = authFields.first;
// Find ExtendedTextField within the first EnvAuthField using find.descendant
final usernameField = find.descendant(
of: firstAuthField,
matching: find.byType(ExtendedTextField),
);
expect(usernameField, findsOneWidget);
final usernameField = textFields.first;
await tester.tap(usernameField);
await tester.pumpAndSettle();
@@ -133,11 +142,20 @@ void main() {
),
);
// Find the password field (second ExtendedTextField)
final textFields = find.byType(ExtendedTextField);
expect(textFields, findsAtLeastNWidgets(2));
// Find EnvAuthField widgets
final authFields = find.byType(EnvAuthField);
expect(authFields, findsNWidgets(2));
// Find the last EnvAuthField (password field)
final lastAuthField = authFields.last;
// Find ExtendedTextField within the last EnvAuthField using find.descendant
final passwordField = find.descendant(
of: lastAuthField,
matching: find.byType(ExtendedTextField),
);
expect(passwordField, findsOneWidget);
final passwordField = textFields.last;
await tester.tap(passwordField);
await tester.pumpAndSettle();
@@ -245,10 +263,19 @@ void main() {
);
// Enter username
final textFields = find.byType(ExtendedTextField);
expect(textFields, findsAtLeastNWidgets(2));
final authFields = find.byType(EnvAuthField);
expect(authFields, findsNWidgets(2));
// Find the first EnvAuthField (username field)
final firstAuthField = authFields.first;
// Find ExtendedTextField within the first EnvAuthField using find.descendant
final usernameField = find.descendant(
of: firstAuthField,
matching: find.byType(ExtendedTextField),
);
expect(usernameField, findsOneWidget);
final usernameField = textFields.first;
await tester.tap(usernameField);
await tester.pumpAndSettle();