Fix/3051 enter text on ios doesnt work with specific selectors#3053
Fix/3051 enter text on ios doesnt work with specific selectors#3053jBorkowska wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates several dependencies in Podfile.lock and pubspec.lock, adds an E2E test for iOS text entry using element type selectors, and refactors the iOS native automator to handle optional predicates. Feedback was provided regarding the iOS text field search logic, which currently ignores specific elementType values in favor of a hardcoded search for both regular and secure text fields; a code suggestion was offered to respect the user-specified type for more precise targeting.
| var subpredicates: [NSPredicate] = [NSCompoundPredicate(orPredicateWithSubpredicates: [ | ||
| textFieldPredicate, secureTextFieldPredicate, | ||
| ])] |
There was a problem hiding this comment.
The current implementation ignores the specific elementType if it is provided in the selector. It always searches for both regular text fields (49) and secure text fields (50). If a user explicitly specifies an elementType in their selector, it should be respected to ensure the correct element is targeted, especially when multiple text input elements of different types are present.
| var subpredicates: [NSPredicate] = [NSCompoundPredicate(orPredicateWithSubpredicates: [ | |
| textFieldPredicate, secureTextFieldPredicate, | |
| ])] | |
| var typePredicates = [textFieldPredicate, secureTextFieldPredicate] | |
| if let type = selector.elementType { | |
| let rawType = getXCUIElementType(elementType: type).rawValue | |
| if rawType == 49 || rawType == 50 { | |
| typePredicates = [NSPredicate(format: "elementType == %d", rawType)] | |
| } | |
| } | |
| var subpredicates: [NSPredicate] = [NSCompoundPredicate(orPredicateWithSubpredicates: typePredicates)] |
| if !begun { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
Can you add comment explaining why?
This PR fixes #3051.