Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions dev/e2e_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -135,28 +135,28 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"

SPEC CHECKSUMS:
app_links: 76b66b60cc809390ca1ad69bfd66b998d2387ac7
app_links: f3e17e4ee5e357b39d8b95290a9b2c299fca71c6
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
file_saver: 6cdbcddd690cb02b0c1a0c225b37cd805c2bf8b6
file_picker: b159e0c068aef54932bb15dc9fd1571818edaf49
file_saver: 503e386464dbe118f630e17b4c2e1190fa0cf808
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_local_notifications: ad39620c743ea4c15127860f4b5641649a988100
flutter_timezone: 7c838e17ffd4645d261e87037e5bebf6d38fe544
geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
flutter_timezone: ac3da59ac941ff1c98a2e1f0293420e020120282
geolocator_apple: 66b711889fd333205763b83c9dcf0a57a28c7afd
Google-Maps-iOS-Utils: 66d6de12be1ce6d3742a54661e7a79cb317a9321
google_maps_flutter_ios: 0291eb2aa252298a769b04d075e4a9d747ff7264
google_maps_flutter_ios: e31555a04d1986ab130f2b9f24b6cdc861acc6d3
GoogleMaps: 8939898920281c649150e0af74aa291c60f2e77d
image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
patrol: cea8074f183a2a4232d0ebd10569ae05149ada42
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
patrol: d49fcd015892f19189a4cec572f21f3c3358e761
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
SDWebImage: 9f177d83116802728e122410fb25ad88f5c7608a
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
webview_flutter_wkwebview: 1821ceac936eba6f7984d89a9f3bcb4dea99ebb2
webview_flutter_wkwebview: a4af96a051138e28e29f60101d094683b9f82188

PODFILE CHECKSUM: 1519be22cbe2743b00cc5414e8330431e336b43c
PODFILE CHECKSUM: 59a478160b0a6f171b0d93666039c6b298688734

COCOAPODS: 1.16.2
23 changes: 23 additions & 0 deletions dev/e2e_app/patrol_test/enter_text_native_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'common.dart';

void main() {
patrol('enterText works with elementType selectors on iOS', ($) async {
await createApp($);

await $('Open webview (Hacker News)').scrollTo().tap();

await $.pump(Duration(seconds: 5));

await $.platform.mobile.tap(Selector(text: 'login'));
await $.platform.ios.enterText(
IOSSelector(elementType: IOSElementType.textField),
text: 'test@leancode.pl',
keyboardBehavior: KeyboardBehavior.showAndDismiss,
);
await $.platform.ios.enterText(
IOSSelector(elementType: IOSElementType.secureTextField),
text: 'ny4ncat',
keyboardBehavior: KeyboardBehavior.showAndDismiss,
);
}, tags: ['webview', 'ios']);
}
42 changes: 21 additions & 21 deletions dev/e2e_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.4.1"
checked_yaml:
dependency: transitive
description:
Expand All @@ -125,10 +125,10 @@ packages:
dependency: transitive
description:
name: cli_completion
sha256: "1e87700c029c77041d836e57f9016b5c90d353151c43c2ca0c36deaadc05aa3a"
sha256: "72e8ccc4545f24efa7bbdf3bff7257dc9d62b072dee77513cc54295575bc9220"
url: "https://pub.dev"
source: hosted
version: "0.4.0"
version: "0.5.1"
cli_config:
dependency: transitive
description:
Expand Down Expand Up @@ -716,26 +716,26 @@ packages:
dependency: transitive
description:
name: mason_logger
sha256: "1fdf5c76870eb6fc3611ed6fbae1973a3794abe581ea5e22e68af2f73c688b93"
sha256: "1d46102c6f299c0df7fe986dd3dd3271d57c2ec7c00ae590660b7c3018810048"
url: "https://pub.dev"
source: hosted
version: "0.2.16"
version: "0.3.5"
matcher:
dependency: transitive
description:
name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
url: "https://pub.dev"
source: hosted
version: "0.12.17"
version: "0.12.18"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.13.0"
meta:
dependency: "direct main"
description:
Expand Down Expand Up @@ -838,30 +838,30 @@ packages:
path: "../../packages/patrol"
relative: true
source: path
version: "4.3.0"
version: "4.5.0"
patrol_cli:
dependency: "direct dev"
description:
path: "../../packages/patrol_cli"
relative: true
source: path
version: "4.2.0"
version: "4.3.1"
patrol_finders:
dependency: transitive
description:
name: patrol_finders
sha256: ac0bfaf3eaaa6cc3d49c8a365329cc7f4361a5f486f1adb45edc96dbfc854da9
sha256: "9970eac0669a90b20ec7e1bcaabd0475655655998068ca656f4df9f6ec84f336"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.2.0"
patrol_log:
dependency: transitive
description:
name: patrol_log
sha256: b3bd2862c15bd6b163763d7d2a80ae07c24af6da07d62d202798ceea327045d7
sha256: a2360db165c34692665c0de146e5157887d6b584fdccca8f141f947a5acf1b2e
url: "https://pub.dev"
source: hosted
version: "0.7.1"
version: "0.8.0"
permission_handler:
dependency: "direct main"
description:
Expand Down Expand Up @@ -954,10 +954,10 @@ packages:
dependency: transitive
description:
name: pub_updater
sha256: "54e8dc865349059ebe7f163d6acce7c89eb958b8047e6d6e80ce93b13d7c9e60"
sha256: "739a0161d73a6974c0675b864fb0cf5147305f7b077b7f03a58fa7a9ab3e7e7d"
url: "https://pub.dev"
source: hosted
version: "0.4.0"
version: "0.5.0"
pubspec_parse:
dependency: transitive
description:
Expand Down Expand Up @@ -1071,10 +1071,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636"
url: "https://pub.dev"
source: hosted
version: "0.7.7"
version: "0.7.9"
timezone:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1204,5 +1204,5 @@ packages:
source: hosted
version: "3.1.3"
sdks:
dart: ">=3.8.0 <4.0.0"
dart: ">=3.9.0-0 <4.0.0"
flutter: ">=3.32.0"
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os

extension IOSSelector {
public func toTextFieldNSPredicate() -> NSPredicate {
public func toTextFieldNSPredicate() -> NSPredicate? {
var format = ""
var begun = false
var values = [String]()
Expand Down Expand Up @@ -46,6 +46,10 @@
values.append(identifier!)
}

if !begun {
return nil
}
Comment on lines +49 to +51
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?


let predicate = NSPredicate(format: format, argumentArray: values)

return predicate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,19 @@
// See:
// * https://developer.apple.com/documentation/xctest/xcuielementtype/xcuielementtypetextfield
// * https://developer.apple.com/documentation/xctest/xcuielementtype/xcuielementtypesecuretextfield
let contentPredicate = selector.toTextFieldNSPredicate()
let textFieldPredicate = NSPredicate(format: "elementType == 49")
let secureTextFieldPredicate = NSPredicate(format: "elementType == 50")

let finalPredicate = NSCompoundPredicate(andPredicateWithSubpredicates: [
contentPredicate,
NSCompoundPredicate(orPredicateWithSubpredicates: [
textFieldPredicate, secureTextFieldPredicate,
]
),
])
var subpredicates: [NSPredicate] = [NSCompoundPredicate(orPredicateWithSubpredicates: [
textFieldPredicate, secureTextFieldPredicate,
])]
Comment on lines +159 to +161
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)]


// toTextFieldNSPredicate() can be nil - depending on the selector user provided
if let contentPredicate = selector.toTextFieldNSPredicate() {
subpredicates.insert(contentPredicate, at: 0)
}

let finalPredicate = NSCompoundPredicate(andPredicateWithSubpredicates: subpredicates)

let query = app.descendants(matching: .any).matching(finalPredicate)
guard
Expand Down
Loading