mirror of
https://github.com/foss42/apidash.git
synced 2025-12-08 22:20:44 +08:00
feat: use find.descendant for ExtendedTextField widgets
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user