Skip to content

Fix/3051 enter text on ios doesnt work with specific selectors#3053

Open
jBorkowska wants to merge 2 commits into
masterfrom
fix/3051-enter-text-on-ios-doesnt-work-with-specific-selectors
Open

Fix/3051 enter text on ios doesnt work with specific selectors#3053
jBorkowska wants to merge 2 commits into
masterfrom
fix/3051-enter-text-on-ios-doesnt-work-with-specific-selectors

Conversation

@jBorkowska
Copy link
Copy Markdown
Collaborator

This PR fixes #3051.

@github-actions github-actions Bot added the package: patrol Related to the patrol package (native automation, test bundling) label May 7, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +159 to +161
var subpredicates: [NSPredicate] = [NSCompoundPredicate(orPredicateWithSubpredicates: [
textFieldPredicate, secureTextFieldPredicate,
])]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
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)]

Comment on lines +49 to +51
if !begun {
return nil
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add comment explaining why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: patrol Related to the patrol package (native automation, test bundling)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

$.platform.ios.enterText Crashes

2 participants