agent-device 0.21.30 → 0.21.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.30.apk → agent-device-android-ime-helper-0.21.31.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.31.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.30.manifest.json → agent-device-android-ime-helper-0.21.31.manifest.json} +4 -4
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.31.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.31.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.30.manifest.json → agent-device-android-snapshot-helper-0.21.31.manifest.json} +7 -7
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/BackgroundInteraction.swift +20 -6
- package/apple/snapshot-bridge/README.md +16 -3
- package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +33 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +110 -8
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAppScreenCapture.swift +20 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +4 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +1 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +30 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +14 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +81 -41
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +40 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotAcquisition.swift +5 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +74 -10
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +33 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +2 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +23 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedInteraction.swift +158 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +165 -70
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryConfirmation.swift +2 -3
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +49 -27
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryReadiness.swift +17 -9
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputProbe.swift +30 -28
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +87 -87
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +4 -3
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.h +13 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.m +45 -0
- package/dist/src/absence-observation-errors.js +1 -1
- package/dist/src/adapter.js +1 -1
- package/dist/src/adb-executor.js +1 -1
- package/dist/src/adb-failure.js +2 -2
- package/dist/src/agent-browser-lifecycle.js +1 -1
- package/dist/src/agent-browser-process-record.js +1 -1
- package/dist/src/agent-browser-provider.js +1 -1
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +1 -1
- package/dist/src/alert-tree-driver.js +1 -1
- package/dist/src/alert.js +1 -1
- package/dist/src/alert2.js +1 -1
- package/dist/src/android.js +1 -1
- package/dist/src/app-backend.js +1 -1
- package/dist/src/app-launch.js +1 -1
- package/dist/src/app-lifecycle.js +4 -4
- package/dist/src/app-log-runtime2.js +3 -3
- package/dist/src/app-log-session-resource.js +1 -1
- package/dist/src/app-resolution-facade.js +1 -1
- package/dist/src/app-resolution.js +2 -2
- package/dist/src/apple-runner-platform.js +1 -1
- package/dist/src/application-lifecycle-interaction.js +1 -1
- package/dist/src/artifact-tracking.js +1 -1
- package/dist/src/automation-helper-artifact.js +1 -1
- package/dist/src/automation-helper.js +1 -1
- package/dist/src/back-mode.js +1 -1
- package/dist/src/boot-diagnostics.js +1 -1
- package/dist/src/browser-launch.js +1 -1
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +35 -29
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +3 -3
- package/dist/src/client-metro-companion.js +1 -1
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +3 -3
- package/dist/src/cloud-artifacts.d.ts +5 -4
- package/dist/src/code-signature-cache.js +1 -1
- package/dist/src/command-metadata.js +10 -10
- package/dist/src/command-tools.js +2 -2
- package/dist/src/command.js +1 -1
- package/dist/src/composed-inventory-gateways.js +1 -1
- package/dist/src/connection-runtime.js +1 -1
- package/dist/src/connection.js +5 -5
- package/dist/src/contracts.js +1 -1
- package/dist/src/daemon-client-ensure.js +1 -1
- package/dist/src/daemon-client-lease-beat.js +1 -1
- package/dist/src/daemon-client-lifecycle.js +1 -1
- package/dist/src/daemon-client-liveness-probe.js +1 -1
- package/dist/src/daemon-client.js +1 -1
- package/dist/src/daemon-command-registry.js +1 -1
- package/dist/src/daemon-composition.js +1 -1
- package/dist/src/daemon-policy-file.js +1 -1
- package/dist/src/daemon-registration-owner.js +3 -3
- package/dist/src/daemon-resolution.js +1 -1
- package/dist/src/daemon-startup-diagnostics.js +1 -1
- package/dist/src/debug-symbols-facade.js +3 -3
- package/dist/src/device-claim-recovery.js +1 -1
- package/dist/src/device-claims.js +1 -1
- package/dist/src/device-inventory-context.js +1 -1
- package/dist/src/device-readiness-runtime.js +1 -1
- package/dist/src/device-selection-resolver.js +1 -1
- package/dist/src/device.js +1 -1
- package/dist/src/devicectl.js +1 -1
- package/dist/src/diagnostics.js +1 -1
- package/dist/src/display-inventory.js +1 -1
- package/dist/src/doctor-facade.js +1 -1
- package/dist/src/durable-capture-resource.js +1 -1
- package/dist/src/durable-resource.js +1 -1
- package/dist/src/engine-eval-script.js +1 -1
- package/dist/src/error.js +1 -1
- package/dist/src/explicit-session-resolution.js +1 -1
- package/dist/src/expo-dev-client-launch.js +1 -1
- package/dist/src/file.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/gesture-admission.js +1 -1
- package/dist/src/gesture-plan.js +1 -1
- package/dist/src/gesture-runtime.js +1 -1
- package/dist/src/hdc.js +1 -1
- package/dist/src/helper.js +2 -2
- package/dist/src/host.js +1 -1
- package/dist/src/host2.js +1 -1
- package/dist/src/host3.js +1 -1
- package/dist/src/host4.js +1 -1
- package/dist/src/host5.js +1 -0
- package/dist/src/human-control.js +1 -1
- package/dist/src/ime-rebind.js +1 -1
- package/dist/src/ime-state.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +1 -1
- package/dist/src/input-actions2.js +1 -1
- package/dist/src/install-source-network-transport.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-positionals.js +1 -1
- package/dist/src/interaction.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor-operation-catalog.js +1 -1
- package/dist/src/interactor.js +5 -5
- package/dist/src/interactor2.js +1 -1
- package/dist/src/interactor3.js +1 -1
- package/dist/src/interactor4.js +1 -1
- package/dist/src/interactor5.js +1 -1
- package/dist/src/interactors.js +1 -1
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +1 -1
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/inventory.js +1 -1
- package/dist/src/inventory2.js +1 -1
- package/dist/src/inventory6.js +1 -1
- package/dist/src/ios-node-interpretation.js +1 -1
- package/dist/src/ios-settings.js +1 -1
- package/dist/src/ios-snapshot-acquisition.js +1 -1
- package/dist/src/ios-snapshot-engine.js +1 -1
- package/dist/src/ios-snapshot-runtime.js +1 -1
- package/dist/src/keyboard-occlusion.js +1 -1
- package/dist/src/keyed-lock.js +1 -1
- package/dist/src/launch-confirmation.js +1 -1
- package/dist/src/launch-services-registration.js +4 -4
- package/dist/src/lease.js +1 -1
- package/dist/src/legacy.js +1 -1
- package/dist/src/limrun-runtime-dependencies.js +1 -1
- package/dist/src/local-interactor-operation-set.js +1 -1
- package/dist/src/mechanics.js +12 -12
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/observability.js +1 -1
- package/dist/src/output-path.js +1 -1
- package/dist/src/parameterized-recorded-fill.js +1 -1
- package/dist/src/perf-facade.js +1 -1
- package/dist/src/perf-runtime-operation-builder.js +1 -1
- package/dist/src/perf-target.js +1 -1
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/platform-runtime-android-adb-host.js +1 -1
- package/dist/src/platform-runtime-claim-recovery.js +1 -1
- package/dist/src/platform-runtime-daemon-services.js +1 -1
- package/dist/src/platform-runtime-host.js +1 -1
- package/dist/src/platform-runtime-open-target.js +1 -1
- package/dist/src/platform-runtime-operation-host.js +5 -5
- package/dist/src/platform-runtime-runtime-hints.js +2 -2
- package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
- package/dist/src/platform-runtime-unavailable.js +1 -1
- package/dist/src/platform-runtime.js +1 -1
- package/dist/src/platform-runtime2.js +1 -1
- package/dist/src/png-resize.js +1 -1
- package/dist/src/png-worker-client.js +1 -1
- package/dist/src/process-exit.js +1 -1
- package/dist/src/provider-device-runtime.d.ts +28 -0
- package/dist/src/provider-plugin-catalog.js +2 -0
- package/dist/src/provider-plugin.d.ts +1 -1
- package/dist/src/provider-webdriver.js +1 -1
- package/dist/src/proxy.js +1 -1
- package/dist/src/react-native-overlay2.js +1 -1
- package/dist/src/react-native.js +1 -1
- package/dist/src/react-profile-command.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/record-trace.js +1 -1
- package/dist/src/recording-scope.js +1 -1
- package/dist/src/recording.js +1 -1
- package/dist/src/registry.js +1 -1
- package/dist/src/remote-config-core.js +1 -1
- package/dist/src/replay-backend-host.js +1 -1
- package/dist/src/replay-divergence.js +1 -1
- package/dist/src/replay-maestro-backend.js +3 -3
- package/dist/src/replay-script-selection.js +1 -1
- package/dist/src/replay2.js +1 -1
- package/dist/src/request-runtime-binding.js +1 -1
- package/dist/src/request.js +1 -1
- package/dist/src/result-serialization.js +1 -1
- package/dist/src/retry.js +1 -1
- package/dist/src/runner-cache-retention.js +1 -1
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-dev-tools-security.js +1 -1
- package/dist/src/runner-device-readiness.js +1 -1
- package/dist/src/runner-device-set.js +1 -1
- package/dist/src/runner-error-classification.js +2 -2
- package/dist/src/runner-exchange.js +1 -1
- package/dist/src/runner-lease.js +1 -1
- package/dist/src/runner-operations-facade.js +1 -1
- package/dist/src/runner-retention.js +1 -1
- package/dist/src/runner-selector-query.js +1 -1
- package/dist/src/runner-start-budget.js +1 -1
- package/dist/src/runner-startup-transport.js +1 -1
- package/dist/src/runner-toolchain-probe.js +1 -1
- package/dist/src/runner.js +2 -2
- package/dist/src/runtime-admission.js +1 -1
- package/dist/src/runtime-deployment.js +1 -1
- package/dist/src/runtime-factory.js +1 -1
- package/dist/src/runtime-session.js +1 -1
- package/dist/src/runtime.js +4 -4
- package/dist/src/runtime10.js +2 -2
- package/dist/src/runtime2.js +1 -1
- package/dist/src/runtime3.js +5 -5
- package/dist/src/runtime4.js +1 -1
- package/dist/src/runtime5.js +1 -1
- package/dist/src/runtime6.js +1 -1
- package/dist/src/runtime7.js +1 -1
- package/dist/src/runtime8.js +1 -1
- package/dist/src/runtime9.js +2 -2
- package/dist/src/screen-recording-transport.js +1 -1
- package/dist/src/screenshot-density.js +1 -1
- package/dist/src/screenshot-runtime.js +1 -1
- package/dist/src/screenshot3.js +1 -1
- package/dist/src/sdk-batch-runner.js +2 -2
- package/dist/src/sdk-batch.js +2 -2
- package/dist/src/sdk-contracts.d.ts +9 -0
- package/dist/src/sdk-contracts.js +2 -2
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-finders.js +1 -1
- package/dist/src/sdk-io.js +5 -5
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selection.js +0 -0
- package/dist/src/selector-pipeline-policy.js +1 -1
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/server-startup.js +1 -1
- package/dist/src/session-paths.js +1 -1
- package/dist/src/session-replay-vars.js +1 -1
- package/dist/src/session-runtime.js +1 -1
- package/dist/src/session-store.js +3 -3
- package/dist/src/session.js +1 -1
- package/dist/src/session2.js +5 -5
- package/dist/src/settings-bluetooth.js +1 -1
- package/dist/src/settings.js +1 -1
- package/dist/src/settings2.js +1 -1
- package/dist/src/settle-observation-capture.js +1 -1
- package/dist/src/simctl-settings.js +1 -1
- package/dist/src/simctl.js +1 -1
- package/dist/src/simulator-boot.js +1 -1
- package/dist/src/simulator-state.js +1 -1
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-chrome.js +1 -1
- package/dist/src/snapshot-desktop-projection.js +1 -1
- package/dist/src/snapshot-helper-install.js +6 -6
- package/dist/src/snapshot-node-lookup.js +1 -1
- package/dist/src/snapshot-occlusion.js +1 -1
- package/dist/src/snapshot-runtime-binding.js +1 -1
- package/dist/src/snapshot-runtime-capture-input.js +1 -1
- package/dist/src/snapshot-runtime.js +1 -1
- package/dist/src/snapshot-state.js +1 -1
- package/dist/src/snapshot.js +1 -1
- package/dist/src/snapshot3.js +1 -1
- package/dist/src/src.js +1 -1
- package/dist/src/src3.js +1 -1
- package/dist/src/src4.js +1 -1
- package/dist/src/store.js +1 -1
- package/dist/src/tap-keyboard-occlusion.js +1 -1
- package/dist/src/target-evidence-tree.js +1 -1
- package/dist/src/target-evidence.js +1 -1
- package/dist/src/telephony-runtime.js +1 -1
- package/dist/src/text-entry-focus.js +1 -1
- package/dist/src/tool-provider.js +3 -3
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/tool-provider3.js +1 -1
- package/dist/src/toolchain-probe.js +1 -1
- package/dist/src/touch-reference-frame.js +1 -1
- package/dist/src/touch-runtime.js +1 -1
- package/dist/src/touch-runtime2.js +1 -1
- package/dist/src/tree.js +1 -1
- package/dist/src/tv-remote-runtime.js +1 -1
- package/dist/src/tv-remote.js +2 -2
- package/dist/src/type-text-runtime.js +1 -1
- package/dist/src/update-check.js +1 -1
- package/dist/src/vega-executable.js +1 -1
- package/dist/src/video.js +1 -1
- package/dist/src/webdriver-source.js +1 -1
- package/package.json +7 -6
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.30.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.30.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.30.apk.sha256 +0 -1
- package/dist/src/physical-device-apps.js +0 -1
|
@@ -64,27 +64,38 @@ extension RunnerTests {
|
|
|
64
64
|
keyboardVisibleBeforeTap: Bool? = nil
|
|
65
65
|
) -> TextEntryStabilization {
|
|
66
66
|
#if os(tvOS)
|
|
67
|
-
return TextEntryStabilization(element: target,
|
|
67
|
+
return TextEntryStabilization(element: target, evidence: .focusEngine)
|
|
68
68
|
#else
|
|
69
69
|
let keyboardVisibleAtEntry = keyboardVisibleBeforeTap ?? isKeyboardVisible(app: app)
|
|
70
70
|
let deadline = Date().addingTimeInterval(TextEntryTiming.focusTimeout)
|
|
71
71
|
while Date() < deadline {
|
|
72
72
|
if let focused = focusedTextInput(app: app) {
|
|
73
|
-
return TextEntryStabilization(element: focused,
|
|
73
|
+
return TextEntryStabilization(element: focused, evidence: .focusedInput)
|
|
74
74
|
}
|
|
75
|
+
#if os(iOS)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
let read = target.flatMap(ResolvedTextEntryInput.init(reading:))
|
|
81
|
+
if let read, let snapshot = read.snapshot, snapshotHasKeyboardFocus(snapshot) {
|
|
82
|
+
return TextEntryStabilization(element: read.element, evidence: .inputReportsKeyboardFocus(read))
|
|
83
|
+
}
|
|
84
|
+
#endif
|
|
75
85
|
|
|
76
86
|
|
|
77
87
|
if keyboardBecameVisible(app: app, wasVisibleAtEntry: keyboardVisibleAtEntry) {
|
|
78
|
-
return TextEntryStabilization(element: target,
|
|
88
|
+
return TextEntryStabilization(element: target, evidence: .keyboardAppeared)
|
|
79
89
|
}
|
|
80
90
|
#if os(iOS)
|
|
81
|
-
|
|
82
|
-
|
|
91
|
+
|
|
92
|
+
if let read, keyboardFocusConfirmed(app: app, read: read) {
|
|
93
|
+
return TextEntryStabilization(element: target, evidence: .focusQueryMatchesInput)
|
|
83
94
|
}
|
|
84
95
|
#endif
|
|
85
96
|
sleepFor(TextEntryTiming.pollInterval)
|
|
86
97
|
}
|
|
87
|
-
return TextEntryStabilization(element: target,
|
|
98
|
+
return TextEntryStabilization(element: target, evidence: nil)
|
|
88
99
|
#endif
|
|
89
100
|
}
|
|
90
101
|
|
|
@@ -118,15 +129,11 @@ extension RunnerTests {
|
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
let keyboardVisibleBeforeTap = isKeyboardVisible(app: app)
|
|
121
|
-
let
|
|
132
|
+
let input = textInputAt(app: app, x: x, y: y)
|
|
133
|
+
let target = input?.element
|
|
122
134
|
let requestedPoint = CGPoint(x: x, y: y)
|
|
123
|
-
if let
|
|
124
|
-
|
|
125
|
-
if !frame.isEmpty {
|
|
126
|
-
_ = tapAt(app: app, x: frame.midX, y: frame.midY)
|
|
127
|
-
} else {
|
|
128
|
-
_ = tapAt(app: app, x: x, y: y)
|
|
129
|
-
}
|
|
135
|
+
if let frame = input?.attributes.frame, !frame.isEmpty {
|
|
136
|
+
_ = tapAt(app: app, x: frame.midX, y: frame.midY)
|
|
130
137
|
} else {
|
|
131
138
|
_ = tapAt(app: app, x: x, y: y)
|
|
132
139
|
}
|
|
@@ -134,17 +141,17 @@ extension RunnerTests {
|
|
|
134
141
|
|
|
135
142
|
|
|
136
143
|
if keyboardVisibleBeforeTap, let target {
|
|
137
|
-
return
|
|
138
|
-
element: target,
|
|
139
|
-
refreshPoint: textEntryRefreshPoint(for: target, fallbackTo: requestedPoint),
|
|
140
|
-
prefersFocusedElement: false
|
|
141
|
-
)
|
|
144
|
+
return focusedTextEntryTarget(target, requestedPoint: requestedPoint)
|
|
142
145
|
}
|
|
143
146
|
let stabilized = stabilizeTextInputBeforeTyping(
|
|
144
147
|
app: app,
|
|
145
148
|
target: target,
|
|
146
149
|
keyboardVisibleBeforeTap: keyboardVisibleBeforeTap
|
|
147
150
|
)
|
|
151
|
+
NSLog("AGENT_DEVICE_RUNNER_TEXT_ENTRY_FOCUS evidence=%@", stabilized.evidence?.name ?? "none")
|
|
152
|
+
if case .inputReportsKeyboardFocus(let read) = stabilized.evidence {
|
|
153
|
+
return focusedTextEntryTarget(read.element, read: read, requestedPoint: requestedPoint)
|
|
154
|
+
}
|
|
148
155
|
let readyTarget = TextEntryTarget(
|
|
149
156
|
element: stabilized.element ?? target,
|
|
150
157
|
refreshPoint: requestedPoint,
|
|
@@ -153,10 +160,28 @@ extension RunnerTests {
|
|
|
153
160
|
let element = stabilized.focusConfirmed
|
|
154
161
|
? readyTarget.element
|
|
155
162
|
: (waitForTextEntryReadiness(app: app, target: readyTarget) ?? readyTarget.element)
|
|
163
|
+
return focusedTextEntryTarget(element, requestedPoint: requestedPoint)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
private func focusedTextEntryTarget(_ element: XCUIElement?, requestedPoint: CGPoint) -> TextEntryTarget {
|
|
168
|
+
guard let element else {
|
|
169
|
+
return TextEntryTarget(element: nil, refreshPoint: requestedPoint, prefersFocusedElement: false)
|
|
170
|
+
}
|
|
171
|
+
return focusedTextEntryTarget(element, read: ResolvedTextEntryInput(reading: element), requestedPoint: requestedPoint)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
private func focusedTextEntryTarget(
|
|
176
|
+
_ element: XCUIElement,
|
|
177
|
+
read: ResolvedTextEntryInput?,
|
|
178
|
+
requestedPoint: CGPoint
|
|
179
|
+
) -> TextEntryTarget {
|
|
156
180
|
return TextEntryTarget(
|
|
157
181
|
element: element,
|
|
158
|
-
refreshPoint: textEntryRefreshPoint(
|
|
159
|
-
prefersFocusedElement: false
|
|
182
|
+
refreshPoint: textEntryRefreshPoint(frame: read?.snapshot?.frame, fallbackTo: requestedPoint),
|
|
183
|
+
prefersFocusedElement: false,
|
|
184
|
+
postFocusRead: read?.snapshot == nil ? nil : read
|
|
160
185
|
)
|
|
161
186
|
}
|
|
162
187
|
|
|
@@ -170,13 +195,10 @@ extension RunnerTests {
|
|
|
170
195
|
|
|
171
196
|
|
|
172
197
|
private func textEntryRefreshPoint(
|
|
173
|
-
|
|
174
|
-
fallbackTo requestedPoint: CGPoint
|
|
198
|
+
frame: CGRect?,
|
|
199
|
+
fallbackTo requestedPoint: CGPoint
|
|
175
200
|
) -> CGPoint? {
|
|
176
|
-
guard let
|
|
177
|
-
return requestedPoint
|
|
178
|
-
}
|
|
179
|
-
guard let frame = textEntrySnapshotFrame(element) else {
|
|
201
|
+
guard let frame else {
|
|
180
202
|
return nil
|
|
181
203
|
}
|
|
182
204
|
guard !frame.isEmpty else {
|
|
@@ -5,6 +5,7 @@ extension RunnerTests {
|
|
|
5
5
|
#if os(iOS)
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
return nil
|
|
9
10
|
#else
|
|
10
11
|
return safely("FOCUSED_INPUT_QUERY") {
|
|
@@ -31,7 +32,7 @@ extension RunnerTests {
|
|
|
31
32
|
timeout: TimeInterval = TextEntryTiming.readinessTimeout
|
|
32
33
|
) -> XCUIElement? {
|
|
33
34
|
#if os(iOS)
|
|
34
|
-
let candidate =
|
|
35
|
+
let candidate = resolveTextEntryInput(app: app, target: target)?.element
|
|
35
36
|
let keyboardVisibleAtEntry = isKeyboardVisible(app: app)
|
|
36
37
|
let deadline = Date().addingTimeInterval(timeout)
|
|
37
38
|
var hardwareKeyboardFallback = Date().addingTimeInterval(
|
|
@@ -66,7 +67,7 @@ extension RunnerTests {
|
|
|
66
67
|
}
|
|
67
68
|
return candidate
|
|
68
69
|
#else
|
|
69
|
-
return
|
|
70
|
+
return resolveTextEntryInput(app: app, target: target)?.element
|
|
70
71
|
#endif
|
|
71
72
|
}
|
|
72
73
|
|
|
@@ -128,13 +129,22 @@ extension RunnerTests {
|
|
|
128
129
|
|
|
129
130
|
func keyboardFocusConfirmed(app: XCUIApplication, element: XCUIElement) -> Bool {
|
|
130
131
|
#if os(iOS)
|
|
131
|
-
return
|
|
132
|
+
return ResolvedTextEntryInput(reading: element).map { keyboardFocusConfirmed(app: app, read: $0) } ?? false
|
|
133
|
+
#else
|
|
134
|
+
return false
|
|
135
|
+
#endif
|
|
136
|
+
}
|
|
132
137
|
|
|
138
|
+
#if os(iOS)
|
|
133
139
|
|
|
140
|
+
func keyboardFocusConfirmed(app: XCUIApplication, read: ResolvedTextEntryInput) -> Bool {
|
|
134
141
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
guard let expected = read.snapshot, !expected.frame.isEmpty else {
|
|
145
|
+
return false
|
|
146
|
+
}
|
|
147
|
+
return safely("TEXT_ENTRY_FOCUS_CONFIRMED", false) {
|
|
138
148
|
let focused = app
|
|
139
149
|
.descendants(matching: .any)
|
|
140
150
|
.matching(NSPredicate(format: "hasKeyboardFocus == 1"))
|
|
@@ -144,10 +154,8 @@ extension RunnerTests {
|
|
|
144
154
|
}
|
|
145
155
|
return observed.identifier == expected.identifier && observed.frame == expected.frame
|
|
146
156
|
}
|
|
147
|
-
#else
|
|
148
|
-
return false
|
|
149
|
-
#endif
|
|
150
157
|
}
|
|
158
|
+
#endif
|
|
151
159
|
|
|
152
160
|
private func keyboardElementExists(app: XCUIApplication) -> Bool {
|
|
153
161
|
#if os(iOS)
|
|
@@ -11,17 +11,17 @@ enum TextInputProbeFailure: String, Error {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
enum TextInputProbeOutcome {
|
|
14
|
-
case matches([
|
|
14
|
+
case matches([RunnerTests.ResolvedTextEntryInput])
|
|
15
15
|
case absent
|
|
16
16
|
case unavailable(TextInputProbeFailure)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
extension RunnerTests {
|
|
20
|
-
func textInputAt(app: XCUIApplication, x: Double, y: Double) ->
|
|
20
|
+
func textInputAt(app: XCUIApplication, x: Double, y: Double) -> ResolvedTextEntryInput? {
|
|
21
21
|
textInputCandidatesAt(app: app, point: CGPoint(x: x, y: y)).first
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
func textInputCandidatesAt(app: XCUIApplication, point: CGPoint) -> [
|
|
24
|
+
func textInputCandidatesAt(app: XCUIApplication, point: CGPoint) -> [ResolvedTextEntryInput] {
|
|
25
25
|
safely("TEXT_INPUT_AT_POINT", []) {
|
|
26
26
|
queryTextInputs(app: app, point: point, shouldStop: { false })
|
|
27
27
|
}
|
|
@@ -29,8 +29,8 @@ extension RunnerTests {
|
|
|
29
29
|
|
|
30
30
|
func coordinateTapTextInputAt(app: XCUIApplication, x: Double, y: Double) -> XCUIElement? {
|
|
31
31
|
switch probeTextInputs(app: app, point: CGPoint(x: x, y: y)) {
|
|
32
|
-
case .matches(let
|
|
33
|
-
return
|
|
32
|
+
case .matches(let inputs):
|
|
33
|
+
return inputs.first?.element
|
|
34
34
|
case .absent:
|
|
35
35
|
return nil
|
|
36
36
|
case .unavailable:
|
|
@@ -57,18 +57,13 @@ extension RunnerTests {
|
|
|
57
57
|
) -> CoordinateTextInputResolution {
|
|
58
58
|
let probed = containingTextInputProbeIssues(fallback: CoordinateTextInputResolution.unavailable) {
|
|
59
59
|
shouldStop -> CoordinateTextInputResolution in
|
|
60
|
-
guard let
|
|
61
|
-
else {
|
|
60
|
+
guard let input = queryTextInputs(app: app, point: CGPoint(x: x, y: y), shouldStop: shouldStop).first else {
|
|
62
61
|
return .absent
|
|
63
62
|
}
|
|
64
|
-
|
|
65
|
-
case .input(let identity):
|
|
66
|
-
return .input(TextInputAtPoint(element: element, identity: identity))
|
|
67
|
-
case .noMatch:
|
|
68
|
-
return .absent
|
|
69
|
-
case .unavailable:
|
|
63
|
+
guard let identity = input.identity else {
|
|
70
64
|
return .unavailable
|
|
71
65
|
}
|
|
66
|
+
return .input(TextInputAtPoint(element: input.element, identity: identity))
|
|
72
67
|
}
|
|
73
68
|
switch probed {
|
|
74
69
|
case .success(let resolution):
|
|
@@ -80,19 +75,19 @@ extension RunnerTests {
|
|
|
80
75
|
|
|
81
76
|
|
|
82
77
|
|
|
83
|
-
func
|
|
84
|
-
let probed = containingTextInputProbeIssues(fallback:
|
|
85
|
-
input.element.
|
|
78
|
+
func textInputIfStillResolves(_ input: TextInputAtPoint) -> ResolvedTextEntryInput? {
|
|
79
|
+
let probed = containingTextInputProbeIssues(fallback: nil as ResolvedTextEntryInput?) { _ in
|
|
80
|
+
ResolvedTextEntryInput(reading: input.element).flatMap { $0.identity == input.identity ? $0 : nil }
|
|
86
81
|
}
|
|
87
|
-
guard case .success(let
|
|
88
|
-
return
|
|
82
|
+
guard case .success(let read) = probed else { return nil }
|
|
83
|
+
return read
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
|
|
92
87
|
|
|
93
88
|
func clearedFieldRead(app: XCUIApplication, target: TextEntryTarget) -> TextValueRead {
|
|
94
89
|
let probed = containingTextInputProbeIssues(fallback: TextValueRead.unavailable) { _ in
|
|
95
|
-
textValueRead(for:
|
|
90
|
+
textValueRead(for: resolveTextEntryInput(app: app, target: target)?.attributes, treatingPlaceholderAsEmpty: true)
|
|
96
91
|
}
|
|
97
92
|
guard case .success(let read) = probed else { return .unavailable }
|
|
98
93
|
return read
|
|
@@ -102,8 +97,8 @@ extension RunnerTests {
|
|
|
102
97
|
switch containingTextInputProbeIssues(fallback: [], { shouldStop in
|
|
103
98
|
queryTextInputs(app: app, point: point, shouldStop: shouldStop)
|
|
104
99
|
}) {
|
|
105
|
-
case .success(let
|
|
106
|
-
return
|
|
100
|
+
case .success(let inputs):
|
|
101
|
+
return inputs.isEmpty ? .absent : .matches(inputs)
|
|
107
102
|
case .failure(let failure):
|
|
108
103
|
return .unavailable(failure)
|
|
109
104
|
}
|
|
@@ -156,22 +151,29 @@ extension RunnerTests {
|
|
|
156
151
|
app: XCUIApplication,
|
|
157
152
|
point: CGPoint,
|
|
158
153
|
shouldStop: () -> Bool
|
|
159
|
-
) -> [
|
|
160
|
-
var
|
|
154
|
+
) -> [ResolvedTextEntryInput] {
|
|
155
|
+
var inputs: [ResolvedTextEntryInput] = []
|
|
161
156
|
for query in [app.textFields, app.secureTextFields, app.searchFields, app.textViews] {
|
|
162
157
|
if shouldStop() { break }
|
|
163
|
-
candidates
|
|
158
|
+
let candidates = query.allElementsBoundByIndex
|
|
159
|
+
|
|
164
160
|
|
|
165
161
|
|
|
166
162
|
|
|
167
163
|
|
|
168
164
|
|
|
169
165
|
|
|
166
|
+
|
|
167
|
+
for element in candidates {
|
|
168
|
+
if shouldStop() { break }
|
|
169
|
+
guard let candidate = ResolvedTextEntryInput(readingListed: element) else { continue }
|
|
170
|
+
let attributes = candidate.attributes
|
|
171
|
+
if isCoordinateTextInputCandidate(enabled: attributes.isEnabled, frame: attributes.frame, point: point) {
|
|
172
|
+
inputs.append(candidate)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
170
175
|
}
|
|
171
176
|
guard !shouldStop() else { return [] }
|
|
172
|
-
return
|
|
173
|
-
guard !shouldStop(), element.exists else { return false }
|
|
174
|
-
return isCoordinateTextInputCandidate(enabled: element.isEnabled, frame: element.frame, point: point)
|
|
175
|
-
}.sorted(by: smallestElementFirst)
|
|
177
|
+
return inputs.sorted { smallestElementFirst($0.attributes, $1.attributes) }
|
|
176
178
|
}
|
|
177
179
|
}
|