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
package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift
CHANGED
|
@@ -15,13 +15,15 @@ extension RunnerTests {
|
|
|
15
15
|
commandId: String? = nil
|
|
16
16
|
) -> TextEntryResult {
|
|
17
17
|
let totalStartedAt = Date()
|
|
18
|
+
let resolve = { (target: TextEntryTarget) in self.resolveTextEntryInput(app: app, target: target) }
|
|
19
|
+
var reader = TextEntryReader(target: target, resolve: resolve)
|
|
18
20
|
guard !text.isEmpty else {
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
if repairMode == .replacement {
|
|
24
|
-
guard let clearTarget =
|
|
26
|
+
guard let clearTarget = reader.input() else {
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
|
|
@@ -34,10 +36,10 @@ extension RunnerTests {
|
|
|
34
36
|
failure: .notFocused
|
|
35
37
|
)
|
|
36
38
|
}
|
|
37
|
-
clearTextInput(app: app, clearTarget)
|
|
39
|
+
reader.dispatch { clearTextInput(app: app, clearTarget) }
|
|
38
40
|
|
|
39
41
|
|
|
40
|
-
let observed = editableTextValue(for:
|
|
42
|
+
let observed = editableTextValue(for: reader.input()?.attributes, treatingPlaceholderAsEmpty: true)
|
|
41
43
|
logTextEntryPhase(commandId: commandId, phase: "total", startedAt: totalStartedAt, chars: 0, mode: repairMode)
|
|
42
44
|
return TextEntryResult(
|
|
43
45
|
verified: observed.map { $0.isEmpty },
|
|
@@ -49,7 +51,6 @@ extension RunnerTests {
|
|
|
49
51
|
logTextEntryPhase(commandId: commandId, phase: "total", startedAt: totalStartedAt, chars: 0, mode: repairMode)
|
|
50
52
|
return TextEntryResult(verified: true, repaired: false, expectedText: "", observedText: "")
|
|
51
53
|
}
|
|
52
|
-
var activeTarget = target
|
|
53
54
|
if repairMode == .replacement,
|
|
54
55
|
Self.shouldUseSynthesizedFirstResponderReplacement(
|
|
55
56
|
hasResolvedElement: target.element != nil,
|
|
@@ -73,19 +74,18 @@ extension RunnerTests {
|
|
|
73
74
|
case .completed(let result):
|
|
74
75
|
return result
|
|
75
76
|
case .fallback(let fallbackTarget):
|
|
76
|
-
|
|
77
|
+
reader = TextEntryReader(target: fallbackTarget, resolve: resolve)
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
let shouldUseSynthesizedFirstResponderType = Self.shouldUseSynthesizedFirstResponderType(
|
|
80
81
|
repairMode: repairMode,
|
|
81
82
|
text: text,
|
|
82
|
-
fromTapWitness:
|
|
83
|
+
fromTapWitness: reader.target.fromTapWitness,
|
|
83
84
|
softwareKeyboardVisible: isKeyboardVisible(app: app)
|
|
84
85
|
)
|
|
85
86
|
let initialResolveStartedAt = Date()
|
|
86
|
-
let initialTarget =
|
|
87
|
-
|
|
88
|
-
let currentText = editableTextValue(for: initialTarget, treatingPlaceholderAsEmpty: true)
|
|
87
|
+
let initialTarget = reader.input()
|
|
88
|
+
let currentText = editableTextValue(for: initialTarget?.attributes, treatingPlaceholderAsEmpty: true)
|
|
89
89
|
let initialText = repairMode == .append ? currentText : nil
|
|
90
90
|
let expectedText = expectedTextEntryValue(typedText: text, mode: repairMode, initialText: initialText)
|
|
91
91
|
var textEntryRoute: String?
|
|
@@ -100,7 +100,7 @@ extension RunnerTests {
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
guard initialTarget != nil || (
|
|
103
|
+
guard initialTarget != nil || (reader.target.prefersFocusedElement && isKeyboardVisible(app: app)) else {
|
|
104
104
|
logTextEntryPhase(
|
|
105
105
|
commandId: commandId,
|
|
106
106
|
phase: "total",
|
|
@@ -125,8 +125,7 @@ extension RunnerTests {
|
|
|
125
125
|
}
|
|
126
126
|
if currentText == nil || currentText?.isEmpty == false {
|
|
127
127
|
let clearStartedAt = Date()
|
|
128
|
-
clearTextInput(app: app, replacementTarget)
|
|
129
|
-
activeTarget = activeTarget.withElement(replacementTarget)
|
|
128
|
+
reader.dispatch { clearTextInput(app: app, replacementTarget) }
|
|
130
129
|
logTextEntryPhase(
|
|
131
130
|
commandId: commandId,
|
|
132
131
|
phase: "clear",
|
|
@@ -135,7 +134,7 @@ extension RunnerTests {
|
|
|
135
134
|
mode: repairMode
|
|
136
135
|
)
|
|
137
136
|
}
|
|
138
|
-
entryBaseline = textEntryObservation(for:
|
|
137
|
+
entryBaseline = textEntryObservation(for: reader.input())
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
|
|
@@ -159,7 +158,7 @@ extension RunnerTests {
|
|
|
159
158
|
|
|
160
159
|
|
|
161
160
|
|
|
162
|
-
func typeApplicationWide(_ value: String, reason: String) ->
|
|
161
|
+
func typeApplicationWide(_ value: String, reason: String) -> TextEntryFailure? {
|
|
163
162
|
NSLog(
|
|
164
163
|
"AGENT_DEVICE_RUNNER_TEXT_ENTRY_ROUTE route=xctest-application-fallback reason=%@ chars=%d commandChars=%d",
|
|
165
164
|
reason,
|
|
@@ -167,23 +166,23 @@ extension RunnerTests {
|
|
|
167
166
|
text.count
|
|
168
167
|
)
|
|
169
168
|
textEntryRoute = "xctest-application-fallback"
|
|
170
|
-
app.typeText(value)
|
|
171
|
-
return
|
|
169
|
+
reader.dispatch { app.typeText(value) }
|
|
170
|
+
return nil
|
|
172
171
|
}
|
|
173
172
|
|
|
174
|
-
func typeIntoCurrentTarget(_ value: String) ->
|
|
173
|
+
func typeIntoCurrentTarget(_ value: String) -> TextEntryFailure? {
|
|
175
174
|
#if os(iOS)
|
|
176
175
|
if shouldUseSynthesizedFirstResponderType {
|
|
177
|
-
guard
|
|
178
|
-
return
|
|
176
|
+
guard reader.input() != nil else {
|
|
177
|
+
return .notFocused
|
|
179
178
|
}
|
|
180
179
|
textEntryRoute = "synthesized-first-responder"
|
|
181
180
|
NSLog("AGENT_DEVICE_RUNNER_TEXT_ENTRY_ROUTE route=synthesized-first-responder")
|
|
182
|
-
switch synthesizer.enterText(app: app, text: value, replacingExistingText: false) {
|
|
181
|
+
switch reader.dispatch({ synthesizer.enterText(app: app, text: value, replacingExistingText: false) }) {
|
|
183
182
|
case .continueTyping:
|
|
184
|
-
return
|
|
183
|
+
return nil
|
|
185
184
|
case .fallback:
|
|
186
|
-
return
|
|
185
|
+
return .synthesisUnavailable
|
|
187
186
|
case .raise(let message):
|
|
188
187
|
NSException(
|
|
189
188
|
name: NSExceptionName.internalInconsistencyException,
|
|
@@ -192,11 +191,11 @@ extension RunnerTests {
|
|
|
192
191
|
}
|
|
193
192
|
}
|
|
194
193
|
#endif
|
|
195
|
-
if let currentTarget =
|
|
194
|
+
if let currentTarget = reader.input() {
|
|
196
195
|
textEntryRoute = "xctest-element"
|
|
197
|
-
currentTarget.typeText(value)
|
|
198
|
-
return
|
|
199
|
-
} else if
|
|
196
|
+
reader.dispatch { currentTarget.element.typeText(value) }
|
|
197
|
+
return nil
|
|
198
|
+
} else if reader.target.boundIdentity == nil && reader.target.prefersFocusedElement && isKeyboardVisible(app: app) {
|
|
200
199
|
#if os(iOS)
|
|
201
200
|
|
|
202
201
|
|
|
@@ -207,7 +206,7 @@ extension RunnerTests {
|
|
|
207
206
|
}
|
|
208
207
|
textEntryRoute = "synthesized-first-responder"
|
|
209
208
|
NSLog("AGENT_DEVICE_RUNNER_TEXT_ENTRY_ROUTE route=synthesized-first-responder")
|
|
210
|
-
switch synthesizer.enterText(app: app, text: value, replacingExistingText: false) {
|
|
209
|
+
switch reader.dispatch({ synthesizer.enterText(app: app, text: value, replacingExistingText: false) }) {
|
|
211
210
|
case .fallback:
|
|
212
211
|
return typeApplicationWide(value, reason: "synthesis-unavailable")
|
|
213
212
|
case .raise(let message):
|
|
@@ -219,11 +218,11 @@ extension RunnerTests {
|
|
|
219
218
|
break
|
|
220
219
|
}
|
|
221
220
|
#else
|
|
222
|
-
app.typeText(value)
|
|
221
|
+
reader.dispatch { app.typeText(value) }
|
|
223
222
|
#endif
|
|
224
|
-
return
|
|
223
|
+
return nil
|
|
225
224
|
}
|
|
226
|
-
return
|
|
225
|
+
return .notFocused
|
|
227
226
|
}
|
|
228
227
|
|
|
229
228
|
func dispatchFailureResult(_ failure: TextEntryFailure) -> TextEntryResult {
|
|
@@ -237,6 +236,13 @@ extension RunnerTests {
|
|
|
237
236
|
)
|
|
238
237
|
}
|
|
239
238
|
|
|
239
|
+
func pauseAfterWarmupRead() {
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
reader.dispatch { sleepFor(TextEntryTiming.pollInterval) }
|
|
244
|
+
}
|
|
245
|
+
|
|
240
246
|
func readBackWarmupCharacter(_ peeledCharacter: String) {
|
|
241
247
|
|
|
242
248
|
|
|
@@ -252,18 +258,17 @@ extension RunnerTests {
|
|
|
252
258
|
}
|
|
253
259
|
let deadline = Date().addingTimeInterval(TextEntryTiming.warmupValueTimeout)
|
|
254
260
|
while Date() < deadline {
|
|
255
|
-
let observed = textValueRead(for:
|
|
261
|
+
let observed = textValueRead(for: reader.input()?.attributes)
|
|
256
262
|
if !observed.warmupReadIsPending(expectedText: warmupExpectedText) {
|
|
257
|
-
if observed == .unreadable {
|
|
263
|
+
if observed == .unreadable { pauseAfterWarmupRead() }
|
|
258
264
|
return
|
|
259
265
|
}
|
|
260
|
-
|
|
266
|
+
pauseAfterWarmupRead()
|
|
261
267
|
}
|
|
262
268
|
}
|
|
263
269
|
|
|
264
270
|
|
|
265
271
|
|
|
266
|
-
var typedTarget: XCUIElement?
|
|
267
272
|
var sawWarmupPost = false
|
|
268
273
|
var planFailure: TextEntryResult?
|
|
269
274
|
var stepStartedAt = Date()
|
|
@@ -271,18 +276,12 @@ extension RunnerTests {
|
|
|
271
276
|
runSynthesizedTextPlan(
|
|
272
277
|
synthesizedTypePlan,
|
|
273
278
|
text: text,
|
|
274
|
-
post: { slice,
|
|
279
|
+
post: { slice, _ in
|
|
275
280
|
stepStartedAt = Date()
|
|
276
|
-
let
|
|
277
|
-
if let failure = dispatch.failure {
|
|
281
|
+
if let failure = typeIntoCurrentTarget(slice) {
|
|
278
282
|
planFailure = dispatchFailureResult(failure)
|
|
279
283
|
return .stop
|
|
280
284
|
}
|
|
281
|
-
typedTarget = dispatch.element ?? typedTarget
|
|
282
|
-
if step.warmsUpField {
|
|
283
|
-
|
|
284
|
-
activeTarget = activeTarget.withElement(typedTarget)
|
|
285
|
-
}
|
|
286
285
|
return .posted
|
|
287
286
|
},
|
|
288
287
|
waitAfterWarmupCharacter: { peeledCharacter in
|
|
@@ -332,7 +331,6 @@ extension RunnerTests {
|
|
|
332
331
|
if let failure = planFailure {
|
|
333
332
|
return failure
|
|
334
333
|
}
|
|
335
|
-
activeTarget = activeTarget.withElement(typedTarget)
|
|
336
334
|
if repairMode == .none {
|
|
337
335
|
logTextEntryPhase(commandId: commandId, phase: "total", startedAt: totalStartedAt, chars: text.count, mode: repairMode)
|
|
338
336
|
return TextEntryResult(
|
|
@@ -346,9 +344,9 @@ extension RunnerTests {
|
|
|
346
344
|
let verifyStartedAt = Date()
|
|
347
345
|
var result: TextEntryResult
|
|
348
346
|
if repairMode == .replacement {
|
|
349
|
-
result = observeReplacementTextEntry(app: app,
|
|
347
|
+
result = observeReplacementTextEntry(app: app, reader: &reader, requested: text, baseline: entryBaseline)
|
|
350
348
|
} else {
|
|
351
|
-
result = verifyAppendTextEntryWithRepairIfNeeded(app: app,
|
|
349
|
+
result = verifyAppendTextEntryWithRepairIfNeeded(app: app, reader: &reader, expectedText: expectedText)
|
|
352
350
|
}
|
|
353
351
|
logTextEntryPhase(
|
|
354
352
|
commandId: commandId,
|
|
@@ -392,13 +390,14 @@ extension RunnerTests {
|
|
|
392
390
|
|
|
393
391
|
private func observeReplacementTextEntry(
|
|
394
392
|
app: XCUIApplication,
|
|
395
|
-
|
|
393
|
+
reader: inout TextEntryReader,
|
|
396
394
|
requested: String,
|
|
397
395
|
baseline: TextEntryObservation?
|
|
398
396
|
) -> TextEntryResult {
|
|
399
397
|
var confirmation = ReplacementTextEntryConfirmation(requested: requested, baseline: baseline, startedAt: Date())
|
|
400
398
|
while true {
|
|
401
|
-
guard let
|
|
399
|
+
guard let input = reader.input() else {
|
|
400
|
+
let target = reader.target
|
|
402
401
|
let failure: TextEntryFailure? = target.boundIdentity != nil && !boundTextEntryInputIsGone(app: app, target: target)
|
|
403
402
|
? .commitNotObserved : nil
|
|
404
403
|
if target.boundIdentity != nil && failure == nil {
|
|
@@ -406,7 +405,7 @@ extension RunnerTests {
|
|
|
406
405
|
}
|
|
407
406
|
return TextEntryResult(verified: nil, repaired: false, expectedText: requested, observedText: nil, failure: failure)
|
|
408
407
|
}
|
|
409
|
-
guard let observed = textEntryObservation(for:
|
|
408
|
+
guard let observed = textEntryObservation(for: input) else {
|
|
410
409
|
return TextEntryResult(verified: nil, repaired: false, expectedText: requested, observedText: nil)
|
|
411
410
|
}
|
|
412
411
|
if let result = confirmation.observe(observed, at: Date()) {
|
|
@@ -415,17 +414,17 @@ extension RunnerTests {
|
|
|
415
414
|
}
|
|
416
415
|
return result
|
|
417
416
|
}
|
|
418
|
-
sleepFor(TextEntryTiming.pollInterval)
|
|
417
|
+
reader.dispatch { sleepFor(TextEntryTiming.pollInterval) }
|
|
419
418
|
}
|
|
420
419
|
}
|
|
421
420
|
|
|
422
421
|
private func verifyAppendTextEntryWithRepairIfNeeded(
|
|
423
422
|
app: XCUIApplication,
|
|
424
|
-
|
|
423
|
+
reader: inout TextEntryReader,
|
|
425
424
|
expectedText: String?
|
|
426
425
|
) -> TextEntryResult {
|
|
427
|
-
if
|
|
428
|
-
guard boundTextEntryInputIsGone(app: app, target: target) else {
|
|
426
|
+
if reader.input() == nil, reader.target.boundIdentity != nil {
|
|
427
|
+
guard boundTextEntryInputIsGone(app: app, target: reader.target) else {
|
|
429
428
|
return TextEntryResult(
|
|
430
429
|
verified: nil,
|
|
431
430
|
repaired: false,
|
|
@@ -440,8 +439,7 @@ extension RunnerTests {
|
|
|
440
439
|
return TextEntryResult(verified: nil, repaired: false, expectedText: expectedText, observedText: nil)
|
|
441
440
|
}
|
|
442
441
|
let initialResult = verifyTextEntry(
|
|
443
|
-
|
|
444
|
-
target: target,
|
|
442
|
+
reader: &reader,
|
|
445
443
|
expectedText: expectedText,
|
|
446
444
|
repaired: false
|
|
447
445
|
)
|
|
@@ -452,70 +450,69 @@ extension RunnerTests {
|
|
|
452
450
|
return initialResult
|
|
453
451
|
}
|
|
454
452
|
guard shouldRepairAppendTextEntry(
|
|
455
|
-
|
|
456
|
-
target: target,
|
|
453
|
+
reader: &reader,
|
|
457
454
|
expectedText: expectedText
|
|
458
455
|
) else {
|
|
459
456
|
return verifyTextEntry(
|
|
460
|
-
|
|
461
|
-
target: target,
|
|
457
|
+
reader: &reader,
|
|
462
458
|
expectedText: expectedText,
|
|
463
459
|
repaired: false
|
|
464
460
|
)
|
|
465
461
|
}
|
|
466
|
-
guard Self.textEntryRepairCanTarget(boundIdentity: target.boundIdentity) else {
|
|
462
|
+
guard Self.textEntryRepairCanTarget(boundIdentity: reader.target.boundIdentity) else {
|
|
467
463
|
NSLog("AGENT_DEVICE_RUNNER_TEXT_ENTRY_REPAIR_REFUSED reason=unidentified-input")
|
|
468
464
|
return verifyTextEntry(
|
|
469
|
-
|
|
470
|
-
target: target,
|
|
465
|
+
reader: &reader,
|
|
471
466
|
expectedText: expectedText,
|
|
472
467
|
repaired: false
|
|
473
468
|
)
|
|
474
469
|
}
|
|
475
470
|
|
|
476
|
-
guard let repairTarget =
|
|
471
|
+
guard let repairTarget = reader.input() else {
|
|
477
472
|
return initialResult
|
|
478
473
|
}
|
|
479
|
-
let observedText = editableTextValue(for: repairTarget) ?? ""
|
|
474
|
+
let observedText = editableTextValue(for: repairTarget.attributes) ?? ""
|
|
480
475
|
NSLog(
|
|
481
476
|
"AGENT_DEVICE_RUNNER_REPAIR_TEXT_ENTRY expectedLength=%d observedLength=%d",
|
|
482
477
|
expectedText.count,
|
|
483
478
|
observedText.count
|
|
484
479
|
)
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
480
|
+
reader.dispatch {
|
|
481
|
+
clearTextInput(app: app, repairTarget)
|
|
482
|
+
repairTarget.element.typeText(expectedText)
|
|
483
|
+
}
|
|
484
|
+
return verifyTextEntry(
|
|
485
|
+
reader: &reader,
|
|
491
486
|
expectedText: expectedText,
|
|
492
487
|
repaired: true
|
|
493
488
|
)
|
|
494
|
-
return repairedResult
|
|
495
489
|
#else
|
|
496
490
|
return initialResult
|
|
497
491
|
#endif
|
|
498
492
|
}
|
|
499
493
|
|
|
500
494
|
private func verifyTextEntry(
|
|
501
|
-
|
|
502
|
-
target: TextEntryTarget,
|
|
495
|
+
reader: inout TextEntryReader,
|
|
503
496
|
expectedText: String?,
|
|
504
497
|
repaired: Bool
|
|
505
498
|
) -> TextEntryResult {
|
|
506
|
-
let
|
|
499
|
+
let targetInput = reader.input()
|
|
507
500
|
guard let expectedText else {
|
|
508
501
|
return TextEntryResult(
|
|
509
502
|
verified: nil,
|
|
510
503
|
repaired: repaired,
|
|
511
504
|
expectedText: nil,
|
|
512
|
-
observedText: editableTextValue(for:
|
|
505
|
+
observedText: editableTextValue(for: targetInput?.attributes)
|
|
513
506
|
)
|
|
514
507
|
}
|
|
515
|
-
guard let observedText = editableTextValue(for:
|
|
508
|
+
guard let observedText = editableTextValue(for: targetInput?.attributes) else {
|
|
516
509
|
return TextEntryResult(verified: nil, repaired: repaired, expectedText: expectedText, observedText: nil)
|
|
517
510
|
}
|
|
518
|
-
guard textEntryValueMatchesExpected(
|
|
511
|
+
guard textEntryValueMatchesExpected(
|
|
512
|
+
targetInput?.attributes.elementType,
|
|
513
|
+
observedText: observedText,
|
|
514
|
+
expectedText: expectedText
|
|
515
|
+
) else {
|
|
519
516
|
return TextEntryResult(
|
|
520
517
|
verified: false,
|
|
521
518
|
repaired: repaired,
|
|
@@ -526,13 +523,14 @@ extension RunnerTests {
|
|
|
526
523
|
let stableDeadline = Date().addingTimeInterval(TextEntryTiming.verificationStabilityWindow)
|
|
527
524
|
var latestObservedText = observedText
|
|
528
525
|
while Date() < stableDeadline {
|
|
529
|
-
sleepFor(TextEntryTiming.pollInterval)
|
|
530
|
-
|
|
526
|
+
reader.dispatch { sleepFor(TextEntryTiming.pollInterval) }
|
|
527
|
+
let nextInput = reader.input()
|
|
528
|
+
guard let nextObservedText = editableTextValue(for: nextInput?.attributes) else {
|
|
531
529
|
return TextEntryResult(verified: nil, repaired: repaired, expectedText: expectedText, observedText: nil)
|
|
532
530
|
}
|
|
533
531
|
latestObservedText = nextObservedText
|
|
534
532
|
guard textEntryValueMatchesExpected(
|
|
535
|
-
|
|
533
|
+
nextInput?.attributes.elementType,
|
|
536
534
|
observedText: nextObservedText,
|
|
537
535
|
expectedText: expectedText
|
|
538
536
|
) else {
|
|
@@ -553,14 +551,14 @@ extension RunnerTests {
|
|
|
553
551
|
}
|
|
554
552
|
|
|
555
553
|
private func textEntryValueMatchesExpected(
|
|
556
|
-
_
|
|
554
|
+
_ elementType: XCUIElement.ElementType?,
|
|
557
555
|
observedText: String,
|
|
558
556
|
expectedText: String
|
|
559
557
|
) -> Bool {
|
|
560
558
|
if observedText == expectedText {
|
|
561
559
|
return true
|
|
562
560
|
}
|
|
563
|
-
guard
|
|
561
|
+
guard elementType != .textView else {
|
|
564
562
|
return false
|
|
565
563
|
}
|
|
566
564
|
return observedText == Self.textEntryRequestWithoutSubmitKeys(expectedText)
|
|
@@ -585,19 +583,21 @@ extension RunnerTests {
|
|
|
585
583
|
}
|
|
586
584
|
|
|
587
585
|
private func shouldRepairAppendTextEntry(
|
|
588
|
-
|
|
589
|
-
target: TextEntryTarget,
|
|
586
|
+
reader: inout TextEntryReader,
|
|
590
587
|
expectedText: String
|
|
591
588
|
) -> Bool {
|
|
592
589
|
#if os(iOS)
|
|
593
590
|
var latestObservedText: String?
|
|
591
|
+
var latestElementType: XCUIElement.ElementType?
|
|
594
592
|
let deadline = Date().addingTimeInterval(TextEntryTiming.verificationStabilityWindow)
|
|
595
593
|
repeat {
|
|
596
|
-
|
|
594
|
+
let input = reader.input()
|
|
595
|
+
guard let observedText = editableTextValue(for: input?.attributes) else {
|
|
597
596
|
return false
|
|
598
597
|
}
|
|
598
|
+
latestElementType = input?.attributes.elementType
|
|
599
599
|
if textEntryValueMatchesExpected(
|
|
600
|
-
|
|
600
|
+
latestElementType,
|
|
601
601
|
observedText: observedText,
|
|
602
602
|
expectedText: expectedText
|
|
603
603
|
) {
|
|
@@ -610,14 +610,14 @@ extension RunnerTests {
|
|
|
610
610
|
) {
|
|
611
611
|
return false
|
|
612
612
|
}
|
|
613
|
-
sleepFor(TextEntryTiming.pollInterval)
|
|
613
|
+
reader.dispatch { sleepFor(TextEntryTiming.pollInterval) }
|
|
614
614
|
} while Date() < deadline
|
|
615
615
|
|
|
616
616
|
guard let latestObservedText else {
|
|
617
617
|
return false
|
|
618
618
|
}
|
|
619
619
|
guard !textEntryValueMatchesExpected(
|
|
620
|
-
|
|
620
|
+
latestElementType,
|
|
621
621
|
observedText: latestObservedText,
|
|
622
622
|
expectedText: expectedText
|
|
623
623
|
) else {
|
|
@@ -125,9 +125,7 @@ final class RunnerTests: XCTestCase {
|
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
let snapshotXCTestChannelPenaltyLock = NSLock()
|
|
128
|
-
var
|
|
129
|
-
var snapshotXCTestChannelPenaltyUntil = Date.distantPast
|
|
130
|
-
let snapshotXCTestChannelPenaltyDuration: TimeInterval = 120
|
|
128
|
+
var snapshotXCTestChannelPenalty = SnapshotXCTestChannelPenalty()
|
|
131
129
|
let snapshotXCTestPenaltyWarmupExemption = SnapshotXCTestPenaltyWarmupExemption()
|
|
132
130
|
|
|
133
131
|
|
|
@@ -224,6 +222,9 @@ final class RunnerTests: XCTestCase {
|
|
|
224
222
|
|
|
225
223
|
|
|
226
224
|
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
227
228
|
|
|
228
229
|
|
|
229
230
|
|
package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.h
CHANGED
|
@@ -77,6 +77,19 @@ FOUNDATION_EXPORT NSString * _Nullable RunnerResolveWindowDisplayID(
|
|
|
77
77
|
NSUInteger *displayID
|
|
78
78
|
);
|
|
79
79
|
|
|
80
|
+
// Reads the display ID of the device's only screen, for a gesture whose app window XCTest cannot
|
|
81
|
+
// resolve because the app's accessibility tree is too deep to serialize. On an iPhone with exactly
|
|
82
|
+
// one screen that screen hosts the full-screen app, so no window is needed to name it. Anywhere else
|
|
83
|
+
// this returns a message and leaves `displayID` untouched: an iPad can show the app in part of its
|
|
84
|
+
// screen, and only a window can say which panel lights a foldable's app.
|
|
85
|
+
FOUNDATION_EXPORT NSString * _Nullable RunnerResolveSoleScreenDisplayID(NSUInteger *displayID);
|
|
86
|
+
|
|
87
|
+
// Resolves the screen and display identity under the same sole-screen rule used by synthesis.
|
|
88
|
+
FOUNDATION_EXPORT NSString * _Nullable RunnerResolveSoleScreen(
|
|
89
|
+
id _Nullable *screen,
|
|
90
|
+
NSUInteger *displayID
|
|
91
|
+
);
|
|
92
|
+
|
|
80
93
|
FOUNDATION_EXPORT NSString * _Nullable RunnerRequireClass(
|
|
81
94
|
Class cls,
|
|
82
95
|
NSString *className,
|
package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.m
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
#import "RunnerXCTestEventBridge.h"
|
|
2
2
|
#import "RunnerObjCExceptionCatcher.h"
|
|
3
3
|
#import <CoreGraphics/CoreGraphics.h>
|
|
4
|
+
#import <XCTest/XCTest.h>
|
|
4
5
|
#import <math.h>
|
|
6
|
+
#if TARGET_OS_IOS
|
|
7
|
+
#import <UIKit/UIKit.h>
|
|
8
|
+
#endif
|
|
5
9
|
|
|
6
10
|
NSString * _Nullable RunnerResolveXCTestEventBridge(
|
|
7
11
|
id application,
|
|
@@ -214,6 +218,47 @@ BOOL RunnerResolveApplicationScreen(
|
|
|
214
218
|
// routed by the same window its reference frame was measured on. The window still resolves here:
|
|
215
219
|
// its frame is read before its screen, and a window that answers empty or raises fails closed with
|
|
216
220
|
// the same reasons the application walk gives.
|
|
221
|
+
NSString * _Nullable RunnerResolveSoleScreenDisplayID(NSUInteger *displayID) {
|
|
222
|
+
id screen = nil;
|
|
223
|
+
return RunnerResolveSoleScreen(&screen, displayID);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
NSString * _Nullable RunnerResolveSoleScreen(id _Nullable *screen, NSUInteger *displayID) {
|
|
227
|
+
*screen = nil;
|
|
228
|
+
#if TARGET_OS_IOS
|
|
229
|
+
// Only an iPhone keeps every app full-screen; an iPad can show one in part of its only screen.
|
|
230
|
+
if (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPhone) {
|
|
231
|
+
return @"private XCTest event synthesis unavailable: no resolved application window, and only an iPhone routes to its sole screen";
|
|
232
|
+
}
|
|
233
|
+
#else
|
|
234
|
+
return @"private XCTest event synthesis unavailable: no resolved application window";
|
|
235
|
+
#endif
|
|
236
|
+
__block NSUInteger screenCount = 0;
|
|
237
|
+
__block NSUInteger readDisplayID = 0;
|
|
238
|
+
__block XCUIScreen *soleScreen = nil;
|
|
239
|
+
NSString *exception = [RunnerObjCExceptionCatcher catchException:^{
|
|
240
|
+
NSArray<XCUIScreen *> *screens = XCUIScreen.screens;
|
|
241
|
+
screenCount = screens.count;
|
|
242
|
+
if (screenCount != 1) return;
|
|
243
|
+
NSNumber *identifier = [screens.firstObject valueForKey:@"displayID"];
|
|
244
|
+
if ([identifier isKindOfClass:NSNumber.class]) {
|
|
245
|
+
readDisplayID = identifier.unsignedIntegerValue;
|
|
246
|
+
soleScreen = screens.firstObject;
|
|
247
|
+
}
|
|
248
|
+
}];
|
|
249
|
+
if (exception != nil || screenCount != 1 || readDisplayID == 0) {
|
|
250
|
+
NSLog(
|
|
251
|
+
@"AGENT_DEVICE_RUNNER_APP_SCREEN_UNRESOLVED stage=sole-screen screens=%lu raised=%@",
|
|
252
|
+
(unsigned long)screenCount,
|
|
253
|
+
exception != nil ? @"yes" : @"no"
|
|
254
|
+
);
|
|
255
|
+
return @"private XCTest event synthesis unavailable: no resolved application window and no sole screen to route to";
|
|
256
|
+
}
|
|
257
|
+
*screen = soleScreen;
|
|
258
|
+
*displayID = readDisplayID;
|
|
259
|
+
return nil;
|
|
260
|
+
}
|
|
261
|
+
|
|
217
262
|
NSString * _Nullable RunnerResolveWindowDisplayID(id window, NSUInteger *displayID) {
|
|
218
263
|
__block CGRect frame = CGRectNull;
|
|
219
264
|
NSString *frameException = [RunnerObjCExceptionCatcher catchException:^{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{R as e,V as t}from"./sdk-contracts.js";import{o as n,s as r}from"./back-mode.js";import{t as i}from"./interaction-error.js";function a(t,n=`is`){return new e(`INVALID_ARGS`,r(t,n),{command:n,predicate:`absent`,rejectedOption:t})}function o(t,r,a=`is`){let o=`firstMatch`in r?r.firstMatch:void 0,s={command:a,reason:i.predicateFailed,predicate:`absent`,selector:t,matches:r.matches,observation:r.kind,...o?{firstMatch:o}:{},...r.kind===`sparse`?{snapshotQuality:r.quality}:{},...r.kind===`truncated`?{truncated:!0}:{}};if(r.kind===`present`){let n=r.matches>1;return new e(`COMMAND_FAILED`,`${a} absent failed for selector ${t}: ${r.matches} match${n?`es`:``} found`,{...s,...n?{hint:`Refine the selector to match no elements.`}:{}})}return new e(`COMMAND_FAILED`,`${a} absent could not prove absence for selector ${t}: ${n[r.kind]}`,{...s,hint:`Retry after the accessibility capture is complete.`})}function s(n,r,a=`is`){let o=t(r),s=typeof o.details?.reason==`string`?o.details.reason:typeof o.details?.androidSnapshotHelperFailureReason==`string`?o.details.androidSnapshotHelperFailureReason:void 0;return new e(`COMMAND_FAILED`,`${a} absent could not prove absence for selector ${n}: capture was unreadable`,{command:a,reason:i.predicateFailed,predicate:`absent`,selector:n,matches:0,observation:`unreadable`,captureErrorCode:o.code,...s?{captureErrorReason:s}:{},hint:`Retry after the accessibility capture is readable.`},o)}export{o as n,s as r,a as t};
|