rocketwright 3.12.0__py3-none-macosx_14_0_universal2.whl
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.
- rocketwright/__init__.py +6 -0
- rocketwright/__main__.py +7 -0
- rocketwright/_bin/rocketwright-helper +0 -0
- rocketwright/_helper_src/Package.swift +43 -0
- rocketwright/_helper_src/Sources/HelperCore/Accessibility.swift +179 -0
- rocketwright/_helper_src/Sources/HelperCore/Arguments.swift +245 -0
- rocketwright/_helper_src/Sources/HelperCore/Capture.swift +202 -0
- rocketwright/_helper_src/Sources/HelperCore/FrameScheduler.swift +72 -0
- rocketwright/_helper_src/Sources/HelperCore/Input.swift +171 -0
- rocketwright/_helper_src/Sources/HelperCore/JSON.swift +84 -0
- rocketwright/_helper_src/Sources/HelperCore/MacWindow.swift +152 -0
- rocketwright/_helper_src/Sources/HelperCore/Orientation.swift +131 -0
- rocketwright/_helper_src/Sources/HelperCore/Overlay.swift +285 -0
- rocketwright/_helper_src/Sources/HelperCore/Recording.swift +434 -0
- rocketwright/_helper_src/Sources/HelperCore/Requests.swift +159 -0
- rocketwright/_helper_src/Sources/HelperCore/Rotation.swift +58 -0
- rocketwright/_helper_src/Sources/HelperCore/Screen.swift +142 -0
- rocketwright/_helper_src/Sources/HelperCore/Server.swift +223 -0
- rocketwright/_helper_src/Sources/HelperCore/Video.swift +125 -0
- rocketwright/_helper_src/Sources/HelperCore/Wire.swift +122 -0
- rocketwright/_helper_src/Sources/HelperPlatform/AccessibilityReader.swift +204 -0
- rocketwright/_helper_src/Sources/HelperPlatform/CaptureDevice.swift +195 -0
- rocketwright/_helper_src/Sources/HelperPlatform/Disclaimed.swift +46 -0
- rocketwright/_helper_src/Sources/HelperPlatform/Framebuffer.swift +141 -0
- rocketwright/_helper_src/Sources/HelperPlatform/Frameworks.swift +84 -0
- rocketwright/_helper_src/Sources/HelperPlatform/H264Stream.swift +295 -0
- rocketwright/_helper_src/Sources/HelperPlatform/HIDTransports.swift +149 -0
- rocketwright/_helper_src/Sources/HelperPlatform/MacAccessibility.swift +241 -0
- rocketwright/_helper_src/Sources/HelperPlatform/MacOverlay.swift +352 -0
- rocketwright/_helper_src/Sources/HelperPlatform/MacPermissions.swift +34 -0
- rocketwright/_helper_src/Sources/HelperPlatform/MacWindowCapture.swift +76 -0
- rocketwright/_helper_src/Sources/HelperPlatform/MacWindowDevice.swift +153 -0
- rocketwright/_helper_src/Sources/HelperPlatform/Pictures.swift +73 -0
- rocketwright/_helper_src/Sources/HelperPlatform/PixelSource.swift +91 -0
- rocketwright/_helper_src/Sources/HelperPlatform/RecordingRenderer.swift +395 -0
- rocketwright/_helper_src/Sources/HelperPlatform/ScreenFeed.swift +60 -0
- rocketwright/_helper_src/Sources/HelperPlatform/SimDeviceHandle.swift +67 -0
- rocketwright/_helper_src/Sources/HelperPlatform/SimulatorDevice.swift +154 -0
- rocketwright/_helper_src/Sources/HelperPlatform/UnixSocket.swift +119 -0
- rocketwright/_helper_src/Sources/HelperPlatform/UsbCapture.swift +245 -0
- rocketwright/_helper_src/Sources/HelperPlatform/Warming.swift +29 -0
- rocketwright/_helper_src/Sources/ObjCGuard/ObjCGuard.m +11 -0
- rocketwright/_helper_src/Sources/ObjCGuard/include/ObjCGuard.h +12 -0
- rocketwright/_helper_src/Sources/rocketwright-helper/main.swift +162 -0
- rocketwright/_helper_src/Support/Info.plist +12 -0
- rocketwright/_helper_src/Tests/Fixtures/wire-vectors.json +69 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/AccessibilityTests.swift +73 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/ArgumentsTests.swift +63 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/CaptureTests.swift +108 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/InputTests.swift +90 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/MacWindowTests.swift +101 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/OrientationTests.swift +128 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/OverlayTests.swift +283 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/PictureTests.swift +129 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/RecordingTests.swift +261 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/RotationTests.swift +41 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/ServerTests.swift +293 -0
- rocketwright/_helper_src/Tests/HelperCoreTests/WireTests.swift +122 -0
- rocketwright/_version.py +4 -0
- rocketwright/api.py +103 -0
- rocketwright/build/__init__.py +2 -0
- rocketwright/build/checkouts.py +271 -0
- rocketwright/build/derived.py +111 -0
- rocketwright/build/destination.py +102 -0
- rocketwright/build/flutter.py +542 -0
- rocketwright/build/flutter_log.py +205 -0
- rocketwright/build/flutter_run.py +343 -0
- rocketwright/build/folders.py +38 -0
- rocketwright/build/gradle.py +489 -0
- rocketwright/build/gradle_log.py +73 -0
- rocketwright/build/junit.py +125 -0
- rocketwright/build/project_files.py +52 -0
- rocketwright/build/provider.py +461 -0
- rocketwright/build/runner.py +601 -0
- rocketwright/build/schemes.py +129 -0
- rocketwright/build/source.py +59 -0
- rocketwright/build/stamp.py +192 -0
- rocketwright/build/wda.py +147 -0
- rocketwright/build/xcodebuild.py +734 -0
- rocketwright/build/xcresult.py +365 -0
- rocketwright/build/xctestplan.py +105 -0
- rocketwright/cli/__init__.py +2 -0
- rocketwright/cli/android.py +135 -0
- rocketwright/cli/app_command.py +129 -0
- rocketwright/cli/config_command.py +150 -0
- rocketwright/cli/context.py +187 -0
- rocketwright/cli/device_command.py +58 -0
- rocketwright/cli/devices.py +142 -0
- rocketwright/cli/doctor.py +82 -0
- rocketwright/cli/helper.py +251 -0
- rocketwright/cli/login.py +113 -0
- rocketwright/cli/main.py +80 -0
- rocketwright/cli/mcp.py +56 -0
- rocketwright/cli/open_viewer.py +53 -0
- rocketwright/cli/record.py +130 -0
- rocketwright/cli/serve.py +76 -0
- rocketwright/cli/settings_command.py +38 -0
- rocketwright/cli/stop.py +209 -0
- rocketwright/cli/tokens.py +88 -0
- rocketwright/cli/tools.py +29 -0
- rocketwright/cli/version.py +31 -0
- rocketwright/cli/wda.py +285 -0
- rocketwright/cli/xcode.py +90 -0
- rocketwright/config/__init__.py +3 -0
- rocketwright/config/discovery.py +19 -0
- rocketwright/config/env.py +34 -0
- rocketwright/config/model.py +174 -0
- rocketwright/config/observe_languages.py +91 -0
- rocketwright/config/provenance.py +39 -0
- rocketwright/config/schema.py +1103 -0
- rocketwright/config/settings_store.py +34 -0
- rocketwright/config/toml_source.py +139 -0
- rocketwright/config/writer.py +218 -0
- rocketwright/connectors/__init__.py +8 -0
- rocketwright/connectors/android/__init__.py +2 -0
- rocketwright/connectors/android/adb_input.py +134 -0
- rocketwright/connectors/android/connector.py +230 -0
- rocketwright/connectors/android/geometry.py +115 -0
- rocketwright/connectors/android/keys.py +59 -0
- rocketwright/connectors/android/scrcpy.py +269 -0
- rocketwright/connectors/android/scrcpy_roles.py +202 -0
- rocketwright/connectors/android/scrcpy_source.py +204 -0
- rocketwright/connectors/android/screen.py +69 -0
- rocketwright/connectors/android/uiautomator.py +256 -0
- rocketwright/connectors/app/__init__.py +12 -0
- rocketwright/connectors/app/client.py +160 -0
- rocketwright/connectors/app/discovery.py +182 -0
- rocketwright/connectors/app/document.py +229 -0
- rocketwright/connectors/app/errors.py +30 -0
- rocketwright/connectors/app/merge.py +95 -0
- rocketwright/connectors/app/reader.py +218 -0
- rocketwright/connectors/app/wire.py +37 -0
- rocketwright/connectors/base.py +375 -0
- rocketwright/connectors/helper_process.py +414 -0
- rocketwright/connectors/idb/__init__.py +2 -0
- rocketwright/connectors/idb/companion.py +195 -0
- rocketwright/connectors/idb/connector.py +93 -0
- rocketwright/connectors/idb/engine.py +202 -0
- rocketwright/connectors/idb/frameworks.py +51 -0
- rocketwright/connectors/idb/orientation.py +157 -0
- rocketwright/connectors/idb/proto/__init__.py +8 -0
- rocketwright/connectors/idb/proto/idb.proto +1301 -0
- rocketwright/connectors/idb/proto/idb_grpc.py +776 -0
- rocketwright/connectors/idb/proto/idb_pb2.py +452 -0
- rocketwright/connectors/iphone/__init__.py +2 -0
- rocketwright/connectors/iphone/cable.py +49 -0
- rocketwright/connectors/iphone/capture.py +147 -0
- rocketwright/connectors/iphone/connector.py +409 -0
- rocketwright/connectors/iphone/screen.py +78 -0
- rocketwright/connectors/iphone/wda.py +320 -0
- rocketwright/connectors/iphone/wda_client.py +347 -0
- rocketwright/connectors/iphone/wda_roles.py +520 -0
- rocketwright/connectors/iphone/wda_setup.py +178 -0
- rocketwright/connectors/iphone/wda_source.py +247 -0
- rocketwright/connectors/mac/__init__.py +2 -0
- rocketwright/connectors/mac/connector.py +344 -0
- rocketwright/connectors/mcpbridge/__init__.py +3 -0
- rocketwright/connectors/mcpbridge/client.py +140 -0
- rocketwright/connectors/mcpbridge/connector.py +84 -0
- rocketwright/connectors/mcpbridge/hierarchy.py +225 -0
- rocketwright/connectors/mcpbridge/merge.py +68 -0
- rocketwright/connectors/mcpbridge/reader.py +221 -0
- rocketwright/connectors/native/__init__.py +2 -0
- rocketwright/connectors/native/client.py +275 -0
- rocketwright/connectors/native/connector.py +182 -0
- rocketwright/connectors/native/helper.py +490 -0
- rocketwright/connectors/native/wire.py +98 -0
- rocketwright/connectors/registry.py +231 -0
- rocketwright/connectors/simctl/__init__.py +2 -0
- rocketwright/connectors/simctl/capture.py +66 -0
- rocketwright/connectors/simctl/connector.py +78 -0
- rocketwright/core/__init__.py +3 -0
- rocketwright/core/actions.py +1825 -0
- rocketwright/core/activity.py +155 -0
- rocketwright/core/android_backend.py +256 -0
- rocketwright/core/android_control.py +442 -0
- rocketwright/core/android_devices.py +260 -0
- rocketwright/core/availability.py +63 -0
- rocketwright/core/backends.py +277 -0
- rocketwright/core/cleanup.py +127 -0
- rocketwright/core/contact_sheet.py +75 -0
- rocketwright/core/control.py +457 -0
- rocketwright/core/device_changes.py +300 -0
- rocketwright/core/device_logs.py +168 -0
- rocketwright/core/device_settings.py +112 -0
- rocketwright/core/devices.py +564 -0
- rocketwright/core/drivers.py +150 -0
- rocketwright/core/events.py +46 -0
- rocketwright/core/flows.py +353 -0
- rocketwright/core/frames.py +413 -0
- rocketwright/core/gestures.py +268 -0
- rocketwright/core/given.py +89 -0
- rocketwright/core/instance.py +244 -0
- rocketwright/core/login.py +252 -0
- rocketwright/core/mac_backend.py +168 -0
- rocketwright/core/manager.py +1536 -0
- rocketwright/core/masking.py +113 -0
- rocketwright/core/reaper.py +98 -0
- rocketwright/core/recording_sources.py +168 -0
- rocketwright/core/recordings.py +1101 -0
- rocketwright/core/refusals.py +275 -0
- rocketwright/core/render.py +97 -0
- rocketwright/core/runtime.py +600 -0
- rocketwright/core/screen_input.py +269 -0
- rocketwright/core/screen_relay.py +327 -0
- rocketwright/core/selections.py +194 -0
- rocketwright/core/signing.py +94 -0
- rocketwright/core/status.py +69 -0
- rocketwright/core/text_entry.py +126 -0
- rocketwright/core/text_overlay.py +71 -0
- rocketwright/core/tickets.py +43 -0
- rocketwright/core/touch.py +225 -0
- rocketwright/daemon/__init__.py +2 -0
- rocketwright/daemon/app.py +550 -0
- rocketwright/daemon/auth.py +210 -0
- rocketwright/daemon/confirmations.py +110 -0
- rocketwright/daemon/health.py +47 -0
- rocketwright/daemon/lease.py +76 -0
- rocketwright/daemon/lifecycle.py +105 -0
- rocketwright/daemon/passes.py +151 -0
- rocketwright/daemon/pauses.py +46 -0
- rocketwright/daemon/policy.py +39 -0
- rocketwright/daemon/scope_names.py +81 -0
- rocketwright/daemon/tokens.py +302 -0
- rocketwright/doctor/__init__.py +2 -0
- rocketwright/doctor/android.py +118 -0
- rocketwright/doctor/checks.py +548 -0
- rocketwright/doctor/flutter.py +32 -0
- rocketwright/doctor/macos.py +104 -0
- rocketwright/doctor/real_devices.py +250 -0
- rocketwright/doctor/report.py +59 -0
- rocketwright/doctor/tap.py +142 -0
- rocketwright/doctor/worktree.py +90 -0
- rocketwright/host_copy.py +436 -0
- rocketwright/hosting.py +221 -0
- rocketwright/legacy.py +72 -0
- rocketwright/mcp/__init__.py +3 -0
- rocketwright/mcp/launcher.py +685 -0
- rocketwright/mcp/relay.py +794 -0
- rocketwright/perception/__init__.py +9 -0
- rocketwright/perception/backtracking.py +276 -0
- rocketwright/perception/bar_names.py +49 -0
- rocketwright/perception/budget.py +66 -0
- rocketwright/perception/capture.py +36 -0
- rocketwright/perception/imagehash.py +81 -0
- rocketwright/perception/in_front.py +116 -0
- rocketwright/perception/model.py +92 -0
- rocketwright/perception/occlusion.py +393 -0
- rocketwright/perception/ocr.py +289 -0
- rocketwright/perception/orientation.py +177 -0
- rocketwright/perception/readers.py +488 -0
- rocketwright/perception/settle.py +241 -0
- rocketwright/perception/snapshot.py +500 -0
- rocketwright/perception/system_alert.py +87 -0
- rocketwright/perception/vision/__init__.py +3 -0
- rocketwright/perception/vision/helper.py +355 -0
- rocketwright/perception/vision/probe.py +24 -0
- rocketwright/perception/vision/text_recognizer.swift +144 -0
- rocketwright/perception/wait.py +236 -0
- rocketwright/platform/__init__.py +3 -0
- rocketwright/platform/adb.py +488 -0
- rocketwright/platform/android_sdk.py +171 -0
- rocketwright/platform/codesign.py +38 -0
- rocketwright/platform/developer_dir.py +72 -0
- rocketwright/platform/device_data.py +65 -0
- rocketwright/platform/devicectl.py +414 -0
- rocketwright/platform/emulator.py +268 -0
- rocketwright/platform/errors.py +15 -0
- rocketwright/platform/flutter.py +142 -0
- rocketwright/platform/git.py +63 -0
- rocketwright/platform/identifiers.py +84 -0
- rocketwright/platform/images.py +61 -0
- rocketwright/platform/java.py +71 -0
- rocketwright/platform/json_lines.py +266 -0
- rocketwright/platform/keyboard.py +110 -0
- rocketwright/platform/keychain.py +79 -0
- rocketwright/platform/keymap.py +95 -0
- rocketwright/platform/local_signing.py +241 -0
- rocketwright/platform/lockdown.py +192 -0
- rocketwright/platform/macos.py +221 -0
- rocketwright/platform/passwords.py +393 -0
- rocketwright/platform/process.py +118 -0
- rocketwright/platform/simctl.py +400 -0
- rocketwright/platform/swift.py +76 -0
- rocketwright/platform/swiftpm.py +52 -0
- rocketwright/platform/usbmux.py +205 -0
- rocketwright/platform/xcode.py +30 -0
- rocketwright/platform/xcrun.py +129 -0
- rocketwright/protocol/__init__.py +47 -0
- rocketwright/protocol/_generated.py +1249 -0
- rocketwright/protocol/messages.py +220 -0
- rocketwright/py.typed +0 -0
- rocketwright/scope.py +106 -0
- rocketwright/seams.py +255 -0
- rocketwright/server/__init__.py +3 -0
- rocketwright/server/agent_routes.py +54 -0
- rocketwright/server/envelope.py +28 -0
- rocketwright/server/http_routes.py +291 -0
- rocketwright/server/log_redaction.py +68 -0
- rocketwright/server/pages.py +86 -0
- rocketwright/server/security.py +161 -0
- rocketwright/server/settings_routes.py +189 -0
- rocketwright/server/settings_view.py +92 -0
- rocketwright/server/socket_routes.py +61 -0
- rocketwright/server/static/viewer/embed.html +14 -0
- rocketwright/server/static/viewer/index.html +14 -0
- rocketwright/server/static/viewer/start.js +61 -0
- rocketwright/storage/__init__.py +3 -0
- rocketwright/storage/app_support.py +116 -0
- rocketwright/storage/claims.py +147 -0
- rocketwright/storage/private.py +135 -0
- rocketwright/testing/__init__.py +2 -0
- rocketwright/testing/adb.py +422 -0
- rocketwright/testing/android_sdk.py +44 -0
- rocketwright/testing/app_sdk.py +211 -0
- rocketwright/testing/asgi.py +96 -0
- rocketwright/testing/checkouts.py +72 -0
- rocketwright/testing/contract.py +120 -0
- rocketwright/testing/daemon.py +94 -0
- rocketwright/testing/fakes.py +1115 -0
- rocketwright/testing/fixtures/README.md +6 -0
- rocketwright/testing/fixtures/android-am-start-bad.txt +3 -0
- rocketwright/testing/fixtures/android-am-start.txt +8 -0
- rocketwright/testing/fixtures/android-logcat-uid.txt +12 -0
- rocketwright/testing/fixtures/android-package-missing.txt +1 -0
- rocketwright/testing/fixtures/android-package.txt +45 -0
- rocketwright/testing/fixtures/android-pm-uid.txt +2 -0
- rocketwright/testing/fixtures/android-uiautomator-landscape.xml +1 -0
- rocketwright/testing/fixtures/android-uiautomator-search.xml +1 -0
- rocketwright/testing/fixtures/android-uiautomator-settings.xml +1 -0
- rocketwright/testing/fixtures/android-window-search.txt +493 -0
- rocketwright/testing/fixtures/android-window-settings.txt +491 -0
- rocketwright/testing/fixtures/ax-alert-ios27.json +162 -0
- rocketwright/testing/fixtures/ax-alert-ipad-landscape-left-ios26.json +551 -0
- rocketwright/testing/fixtures/ax-alert-ipad-upside-down-ios26.json +491 -0
- rocketwright/testing/fixtures/ax-alert-turned-left-ios26.json +457 -0
- rocketwright/testing/fixtures/ax-alert-turned-right-ios26.json +491 -0
- rocketwright/testing/fixtures/ax-alert-upright-ios26.json +469 -0
- rocketwright/testing/fixtures/ax-app-sdk-alert.json +137 -0
- rocketwright/testing/fixtures/ax-app-sdk-keyboard.json +1257 -0
- rocketwright/testing/fixtures/ax-app-sdk-swiftui.json +340 -0
- rocketwright/testing/fixtures/ax-app-sdk-tagged.json +237 -0
- rocketwright/testing/fixtures/ax-app-sdk-uikit.json +340 -0
- rocketwright/testing/fixtures/ax-files-navigation-bar-de-ios26.json +551 -0
- rocketwright/testing/fixtures/ax-files-tab-bar-de-ios26.json +495 -0
- rocketwright/testing/fixtures/ax-floating-button-ios26.json +541 -0
- rocketwright/testing/fixtures/ax-health-tab-bar-ios26.json +488 -0
- rocketwright/testing/fixtures/ax-home-complete.json +1 -0
- rocketwright/testing/fixtures/ax-home-ios27.json +447 -0
- rocketwright/testing/fixtures/ax-keyboard-ios27.json +1261 -0
- rocketwright/testing/fixtures/ax-macos-chromium.json +5525 -0
- rocketwright/testing/fixtures/ax-macos-webkit.json +5927 -0
- rocketwright/testing/fixtures/ax-native-files-navigation-bar-de-ios26.json +427 -0
- rocketwright/testing/fixtures/ax-probe-ios27.json +444 -0
- rocketwright/testing/fixtures/ax-probe-ipad-upside-down-ios26.json +133 -0
- rocketwright/testing/fixtures/ax-probe-rotated-left-ios26.json +133 -0
- rocketwright/testing/fixtures/ax-safari-ios27.json +188 -0
- rocketwright/testing/fixtures/ax-safari-typed.json +1 -0
- rocketwright/testing/fixtures/ax-settings-back-button-ios26.json +395 -0
- rocketwright/testing/fixtures/ax-settings-interactable.json +1 -0
- rocketwright/testing/fixtures/ax-settings-ios27.json +425 -0
- rocketwright/testing/fixtures/ax-settings-search-field-ios26.json +426 -0
- rocketwright/testing/fixtures/ax-settings-toolbar-ja-ios26.json +397 -0
- rocketwright/testing/fixtures/ax-settings-under-navigation-bar-ios26.json +533 -0
- rocketwright/testing/fixtures/ax-turned-landscape-left-ios26.json +363 -0
- rocketwright/testing/fixtures/ax-turned-landscape-right-ios26.json +363 -0
- rocketwright/testing/fixtures/ax-turned-maps-alert-ios26.json +382 -0
- rocketwright/testing/fixtures/ax-turned-portrait-ios26.json +370 -0
- rocketwright/testing/fixtures/ax-turned-reminders-portrait-ios26.json +345 -0
- rocketwright/testing/fixtures/ax-turned-safari-landscape-left-ios26.json +1166 -0
- rocketwright/testing/fixtures/ax-turned-safari-landscape-right-ios26.json +1166 -0
- rocketwright/testing/fixtures/development-certificate.pem +24 -0
- rocketwright/testing/fixtures/devicectl-appearance.json +46 -0
- rocketwright/testing/fixtures/devicectl-apps.json +59 -0
- rocketwright/testing/fixtures/devicectl-devices.json +1065 -0
- rocketwright/testing/fixtures/devicectl-displays.json +63 -0
- rocketwright/testing/fixtures/devicectl-launch-missing.json +58 -0
- rocketwright/testing/fixtures/devicectl-launch.json +53 -0
- rocketwright/testing/fixtures/devicectl-lock-state.json +27 -0
- rocketwright/testing/fixtures/devicectl-processes.json +39 -0
- rocketwright/testing/fixtures/devicectl-screenshot.json +31 -0
- rocketwright/testing/fixtures/flutter-build-ios-error.log +24 -0
- rocketwright/testing/fixtures/flutter-integration-results.json +20 -0
- rocketwright/testing/fixtures/flutter-unit-results.json +16 -0
- rocketwright/testing/fixtures/gradle-aapt-error.log +55 -0
- rocketwright/testing/fixtures/gradle-kotlin-error.log +51 -0
- rocketwright/testing/fixtures/gradle-output-metadata.json +21 -0
- rocketwright/testing/fixtures/gradle-test-failure.log +166 -0
- rocketwright/testing/fixtures/junit-android-failure.xml +48 -0
- rocketwright/testing/fixtures/mcpbridge-answers.json +183 -0
- rocketwright/testing/fixtures/mcpbridge-hierarchy-alert.txt +46 -0
- rocketwright/testing/fixtures/mcpbridge-hierarchy-home.txt +257 -0
- rocketwright/testing/fixtures/mcpbridge-hierarchy-keyboard.txt +92 -0
- rocketwright/testing/fixtures/mcpbridge-hierarchy-probe.txt +39 -0
- rocketwright/testing/fixtures/mcpbridge-hierarchy-safari.txt +77 -0
- rocketwright/testing/fixtures/mcpbridge-hierarchy-settings.txt +169 -0
- rocketwright/testing/fixtures/simctl-devices.json +73 -0
- rocketwright/testing/fixtures/simctl-runtimes.json +114 -0
- rocketwright/testing/fixtures/xcodebuild-list-names.json +20 -0
- rocketwright/testing/fixtures/xcodebuild-list.json +17 -0
- rocketwright/testing/fixtures/xcodebuild-settings-test.json +55 -0
- rocketwright/testing/fixtures/xcodebuild-settings.json +13 -0
- rocketwright/testing/fixtures/xcodebuild-test-plans-none.json +3 -0
- rocketwright/testing/fixtures/xcodebuild-test-plans.json +10 -0
- rocketwright/testing/fixtures/xcresult-build-broken.json +32 -0
- rocketwright/testing/fixtures/xcresult-build-ok.json +27 -0
- rocketwright/testing/fixtures/xcresult-build-results-unbuilt.json +36 -0
- rocketwright/testing/fixtures/xcresult-test-summary-retries.json +56 -0
- rocketwright/testing/fixtures/xcresult-test-summary-swift-testing-xcode27.json +63 -0
- rocketwright/testing/fixtures/xcresult-test-summary-swift-testing.json +60 -0
- rocketwright/testing/fixtures/xcresult-test-summary-unbuilt.json +24 -0
- rocketwright/testing/fixtures/xcresult-test-summary.json +49 -0
- rocketwright/testing/fixtures/xcresult-test-tests-retries.json +165 -0
- rocketwright/testing/fixtures/xcresult-test-tests-swift-testing-xcode27.json +135 -0
- rocketwright/testing/fixtures/xcresult-test-tests-swift-testing.json +125 -0
- rocketwright/testing/fixtures/xcresult-test-tests.json +93 -0
- rocketwright/testing/fixtures/xcscheme-staging.xcscheme +91 -0
- rocketwright/testing/fixtures/xcscheme-test-plans.xcscheme +86 -0
- rocketwright/testing/fixtures/xctestplan-everything.xctestplan +38 -0
- rocketwright/testing/fixtures/xctestplan-units-only.xctestplan +42 -0
- rocketwright/testing/flutter.py +277 -0
- rocketwright/testing/gradle.py +123 -0
- rocketwright/testing/guards.py +190 -0
- rocketwright/testing/macos.py +92 -0
- rocketwright/testing/native.py +243 -0
- rocketwright/testing/pictures.py +58 -0
- rocketwright/testing/recording.py +67 -0
- rocketwright/testing/results.py +16 -0
- rocketwright/testing/rig.py +225 -0
- rocketwright/testing/scrcpy.py +148 -0
- rocketwright/testing/usbmux.py +236 -0
- rocketwright/testing/vision.py +86 -0
- rocketwright/testing/wda.py +278 -0
- rocketwright/tools/__init__.py +2 -0
- rocketwright/tools/act.py +86 -0
- rocketwright/tools/app.py +209 -0
- rocketwright/tools/context.py +232 -0
- rocketwright/tools/device.py +510 -0
- rocketwright/tools/flow.py +356 -0
- rocketwright/tools/login.py +281 -0
- rocketwright/tools/matrix.py +397 -0
- rocketwright/tools/record.py +184 -0
- rocketwright/tools/registry.py +116 -0
- rocketwright/tools/results.py +48 -0
- rocketwright/tools/schemas.py +648 -0
- rocketwright/tools/screenshot.py +158 -0
- rocketwright/tools/snapshot.py +36 -0
- rocketwright/validation.py +46 -0
- rocketwright-3.12.0.dist-info/METADATA +324 -0
- rocketwright-3.12.0.dist-info/RECORD +455 -0
- rocketwright-3.12.0.dist-info/WHEEL +4 -0
- rocketwright-3.12.0.dist-info/entry_points.txt +3 -0
- rocketwright-3.12.0.dist-info/licenses/LICENSE +202 -0
- rocketwright-3.12.0.dist-info/licenses/NOTICE +20 -0
- rocketwright-3.12.0.dist-info/licenses/THIRD_PARTY_LICENSES.md +158 -0
rocketwright/__init__.py
ADDED
rocketwright/__main__.py
ADDED
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// swift-tools-version:6.0
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// Rocketwright's native helper: the screen, input and element tree of one booted simulator, served to Rocketwright on a unix
|
|
5
|
+
// socket -- without idb_companion.
|
|
6
|
+
//
|
|
7
|
+
// `HelperCore` is everything that can be decided without a simulator: the wire protocol, what a screenshot or a stream
|
|
8
|
+
// is cut to, how input maps onto each HID transport, and how an accessibility tree becomes Rocketwright's document. It is
|
|
9
|
+
// unit-tested to the per-file coverage bar. `HelperPlatform` is the thin layer that reaches Apple's private simulator
|
|
10
|
+
// frameworks through the Objective-C runtime; it is exercised against real simulators by Rocketwright's live suite.
|
|
11
|
+
|
|
12
|
+
import PackageDescription
|
|
13
|
+
|
|
14
|
+
let package = Package(
|
|
15
|
+
name: "RocketwrightHelper",
|
|
16
|
+
platforms: [.macOS(.v14)],
|
|
17
|
+
products: [
|
|
18
|
+
.executable(name: "rocketwright-helper", targets: ["rocketwright-helper"]),
|
|
19
|
+
],
|
|
20
|
+
targets: [
|
|
21
|
+
.target(name: "HelperCore"),
|
|
22
|
+
.target(name: "ObjCGuard"),
|
|
23
|
+
.target(
|
|
24
|
+
name: "HelperPlatform",
|
|
25
|
+
dependencies: ["HelperCore", "ObjCGuard"],
|
|
26
|
+
swiftSettings: [.swiftLanguageMode(.v5)]
|
|
27
|
+
),
|
|
28
|
+
.executableTarget(
|
|
29
|
+
name: "rocketwright-helper",
|
|
30
|
+
dependencies: ["HelperCore", "HelperPlatform"],
|
|
31
|
+
swiftSettings: [.swiftLanguageMode(.v5)],
|
|
32
|
+
// The Info.plist macOS reads to ask for the Camera, which reading a cabled device's screen needs, embedded
|
|
33
|
+
// in the program itself.
|
|
34
|
+
linkerSettings: [
|
|
35
|
+
.unsafeFlags([
|
|
36
|
+
"-Xlinker", "-sectcreate", "-Xlinker", "__TEXT", "-Xlinker", "__info_plist",
|
|
37
|
+
"-Xlinker", "\(Context.packageDirectory)/Support/Info.plist",
|
|
38
|
+
]),
|
|
39
|
+
]
|
|
40
|
+
),
|
|
41
|
+
.testTarget(name: "HelperCoreTests", dependencies: ["HelperCore"]),
|
|
42
|
+
]
|
|
43
|
+
)
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import Foundation
|
|
3
|
+
|
|
4
|
+
/// A rectangle in points, from the top left.
|
|
5
|
+
public struct Rect: Equatable, Sendable {
|
|
6
|
+
public let x: Double
|
|
7
|
+
public let y: Double
|
|
8
|
+
public let width: Double
|
|
9
|
+
public let height: Double
|
|
10
|
+
|
|
11
|
+
public init(x: Double, y: Double, width: Double, height: Double) {
|
|
12
|
+
self.x = x
|
|
13
|
+
self.y = y
|
|
14
|
+
self.width = width
|
|
15
|
+
self.height = height
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var json: JSONValue {
|
|
19
|
+
.object(["x": .number(x), "y": .number(y), "width": .number(width), "height": .number(height)])
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// An accessibility value: text, a number, or a switch's state.
|
|
24
|
+
public enum AccessibilityValue: Equatable, Sendable {
|
|
25
|
+
case text(String)
|
|
26
|
+
case number(Double)
|
|
27
|
+
|
|
28
|
+
var json: JSONValue {
|
|
29
|
+
switch self {
|
|
30
|
+
case .text(let text): return .string(text)
|
|
31
|
+
case .number(let number): return .number(number)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// One element of a screen's accessibility tree, read from the device.
|
|
37
|
+
///
|
|
38
|
+
/// Only what Rocketwright reads of an element is kept. Each attribute is a round trip to the simulator, and a snapshot
|
|
39
|
+
/// reads every element, so an attribute nothing reads -- help text, custom actions -- is not asked for at all. A role's
|
|
40
|
+
/// description is asked of a group only: it is how a navigation bar says what it is.
|
|
41
|
+
public struct AXNode: Equatable, Sendable {
|
|
42
|
+
/// The role of an element that only holds others, as a navigation bar, a tab bar and a toolbar are listed.
|
|
43
|
+
public static let groupRole = "AXGroup"
|
|
44
|
+
|
|
45
|
+
/// Its role as the accessibility API says it, ``AXButton``.
|
|
46
|
+
public var role: String?
|
|
47
|
+
public var subrole: String?
|
|
48
|
+
/// What its role is called, in the device's language: ``Nav bar`` for a navigation bar UIKit lists as a group.
|
|
49
|
+
public var roleDescription: String?
|
|
50
|
+
public var label: String?
|
|
51
|
+
public var title: String?
|
|
52
|
+
public var identifier: String?
|
|
53
|
+
public var value: AccessibilityValue?
|
|
54
|
+
public var frame: Rect
|
|
55
|
+
/// Its traits as the bits iOS keeps them in; nil when it does not say.
|
|
56
|
+
public var traits: UInt64?
|
|
57
|
+
public var enabled: Bool
|
|
58
|
+
public var children: [AXNode]
|
|
59
|
+
|
|
60
|
+
public var isSecure: Bool { role == "AXSecureTextField" || subrole == "AXSecureTextField" }
|
|
61
|
+
|
|
62
|
+
public init(
|
|
63
|
+
role: String? = nil, subrole: String? = nil, roleDescription: String? = nil, label: String? = nil,
|
|
64
|
+
title: String? = nil, identifier: String? = nil, value: AccessibilityValue? = nil,
|
|
65
|
+
frame: Rect = Rect(x: 0, y: 0, width: 0, height: 0), traits: UInt64? = nil, enabled: Bool = true,
|
|
66
|
+
children: [AXNode] = []
|
|
67
|
+
) {
|
|
68
|
+
self.role = role
|
|
69
|
+
self.subrole = subrole
|
|
70
|
+
self.roleDescription = roleDescription
|
|
71
|
+
self.label = label
|
|
72
|
+
self.title = title
|
|
73
|
+
self.identifier = identifier
|
|
74
|
+
self.value = value
|
|
75
|
+
self.frame = frame
|
|
76
|
+
self.traits = traits
|
|
77
|
+
self.enabled = enabled
|
|
78
|
+
self.children = children
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/// The names of the traits iOS gives an element, bit by bit.
|
|
83
|
+
///
|
|
84
|
+
/// The bits are AXRuntime's ``kAX*Trait`` constants, which run from 0 upward in this order; the names are the constants
|
|
85
|
+
/// less their prefix and suffix, which is how idb_companion names them too.
|
|
86
|
+
public enum AXTraits {
|
|
87
|
+
public static let names = [
|
|
88
|
+
"Button", "Link", "Image", "Selected", "PlaysSound", "KeyboardKey", "StaticText", "SummaryElement",
|
|
89
|
+
"NotEnabled", "UpdatesFrequently", "SearchField", "StartsMediaSession", "Adjustable",
|
|
90
|
+
"AllowsDirectInteraction", "CausesPageTurn", "TabBar", "Header", "WebContent", "TextEntry", "PickerElement",
|
|
91
|
+
"RadioButton", "IsEditing", "LaunchIcon", "StatusBarElement", "SecureTextField", "Inactive", "Footer",
|
|
92
|
+
"BackButton", "TabButton", "AutoCorrectCandidate", "DeleteKey", "SelectionDismissesItem", "Visited",
|
|
93
|
+
"Scrollable", "Spacer", "TableIndex", "Map", "TextOperationsAvailable", "Draggable", "GesturePracticeRegion",
|
|
94
|
+
"PopupButton", "AllowsNativeSliding", "MathEquation", "ContainedByTable", "ContainedByList", "TouchContainer",
|
|
95
|
+
"SupportsZoom", "TextArea", "BookContent", "ContainedByLandmark", "FolderIcon", "ReadOnly", "MenuItem",
|
|
96
|
+
"Toggle", "IgnoreItemChooser", "SupportsTrackingDetail", "Alert", "ContainedByFieldset",
|
|
97
|
+
"AllowsLayoutChangeInStatusBar",
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
/// The names of the bits set: ``None`` for none, and ``Unknown`` for bits no name is known for.
|
|
101
|
+
public static func names(_ mask: UInt64) -> [String] {
|
|
102
|
+
guard mask != 0 else { return ["None"] }
|
|
103
|
+
var found = names.indices.filter { mask & (1 << UInt64($0)) != 0 }.map { names[$0] }
|
|
104
|
+
if mask >> UInt64(names.count) != 0 { found.append("Unknown") }
|
|
105
|
+
return found
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// The document Rocketwright reads a screen from: the tree of the elements a person or an agent can act on or read.
|
|
110
|
+
///
|
|
111
|
+
/// Its shape is idb_companion's consolidated accessibility document, with the keys Rocketwright reads, so Rocketwright reads
|
|
112
|
+
/// either one the same way. The
|
|
113
|
+
/// tree keeps what is worth reporting -- an element with a label, an identifier, or a role that is acted on -- and an
|
|
114
|
+
/// element that is not has its kept descendants take its place, so a button inside an unlabelled group is kept.
|
|
115
|
+
public enum AXDocument {
|
|
116
|
+
/// The roles, less their ``AX`` prefix, that are kept whatever they say.
|
|
117
|
+
public static let actionableRoles: Set<String> = [
|
|
118
|
+
"Button", "Cell", "TextField", "SecureTextField", "SearchField", "Switch", "Toggle", "Link", "MenuItem",
|
|
119
|
+
"Slider", "CheckBox", "RadioButton", "SegmentedControl", "Stepper", "PopUpButton", "Picker", "PickerWheel",
|
|
120
|
+
"Tab", "Key", "DisclosureTriangle",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
/// The document of a tree. Its frames are the interface's points, and its ``orientation`` says how that interface
|
|
124
|
+
/// lies on the screen, whose portrait size ``screen`` is.
|
|
125
|
+
public static func make(_ tree: AXTree, screen: ScreenGeometry) -> JSONValue {
|
|
126
|
+
let elements = kept(tree.root)
|
|
127
|
+
return .object([
|
|
128
|
+
"backend": .string("native"),
|
|
129
|
+
"elements": .array(elements),
|
|
130
|
+
"modal": .null,
|
|
131
|
+
"orientation": .string(tree.orientation.rawValue),
|
|
132
|
+
"screen": .object([
|
|
133
|
+
"coordinate_space": .string("screen"),
|
|
134
|
+
"width": .int(screen.widthPt),
|
|
135
|
+
"height": .int(screen.heightPt),
|
|
136
|
+
]),
|
|
137
|
+
"truncated": .bool(false),
|
|
138
|
+
])
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// What was found at points of the screen: each element alone, as the document writes one, or null.
|
|
142
|
+
public static func found(_ nodes: [AXNode?]) -> JSONValue {
|
|
143
|
+
.object(["elements": .array(nodes.map { $0.map { element($0, children: []) } ?? .null })])
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/// A role without its ``AX`` prefix: ``AXButton`` is ``Button``.
|
|
147
|
+
public static func type(of role: String?) -> String? {
|
|
148
|
+
guard let role else { return nil }
|
|
149
|
+
return role.hasPrefix("AX") ? String(role.dropFirst(2)) : role
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
static func keeps(_ node: AXNode) -> Bool {
|
|
153
|
+
if let label = node.label, !label.isEmpty { return true }
|
|
154
|
+
if let identifier = node.identifier, !identifier.isEmpty { return true }
|
|
155
|
+
return type(of: node.role).map(actionableRoles.contains) ?? false
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
static func kept(_ node: AXNode) -> [JSONValue] {
|
|
159
|
+
let children = node.isSecure ? [] : node.children.flatMap(kept)
|
|
160
|
+
guard keeps(node) else { return children }
|
|
161
|
+
return [element(node, children: children)]
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
static func element(_ node: AXNode, children: [JSONValue]) -> JSONValue {
|
|
165
|
+
.object([
|
|
166
|
+
"type": .text(node.isSecure ? "SecureTextField" : type(of: node.role)),
|
|
167
|
+
"subrole": .text(node.subrole),
|
|
168
|
+
"role_description": .text(node.roleDescription),
|
|
169
|
+
"label": .text(node.label),
|
|
170
|
+
"title": .text(node.title),
|
|
171
|
+
"identifier": .text(node.identifier),
|
|
172
|
+
"value": node.isSecure ? .null : node.value?.json ?? .null,
|
|
173
|
+
"frame": node.frame.json,
|
|
174
|
+
"traits": node.traits.map { .array(AXTraits.names($0).map(JSONValue.string)) } ?? .null,
|
|
175
|
+
"enabled": .bool(node.enabled),
|
|
176
|
+
"children": .array(children),
|
|
177
|
+
])
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import Foundation
|
|
3
|
+
|
|
4
|
+
/// What the helper was started to do.
|
|
5
|
+
public enum Command: Equatable, Sendable {
|
|
6
|
+
/// Print its versions as JSON and exit.
|
|
7
|
+
case version
|
|
8
|
+
/// Check this helper's macOS permissions without requesting either grant.
|
|
9
|
+
case macApps
|
|
10
|
+
case window(MacWindowOptions)
|
|
11
|
+
case permissions
|
|
12
|
+
/// Serve one device on a unix socket until Rocketwright lets go of it.
|
|
13
|
+
case serve(ServeOptions)
|
|
14
|
+
/// Reach a device the way serving would -- its screen, a picture, input and the element tree -- say what worked as
|
|
15
|
+
/// JSON, and exit 0 only if all of it did.
|
|
16
|
+
case selfCheck(DeviceOptions)
|
|
17
|
+
/// Render a recording as the job at a path asks -- an MP4, a GIF, its touches drawn in -- say what it wrote as JSON,
|
|
18
|
+
/// and exit.
|
|
19
|
+
case render(job: String)
|
|
20
|
+
/// Serve a cabled real device's screen, read through AVFoundation, on a unix socket until Rocketwright lets go of it.
|
|
21
|
+
case capture(CaptureOptions)
|
|
22
|
+
|
|
23
|
+
public static let usage = """
|
|
24
|
+
usage: rocketwright-helper version
|
|
25
|
+
rocketwright-helper permissions
|
|
26
|
+
rocketwright-helper mac-apps
|
|
27
|
+
rocketwright-helper window --pid PID --socket PATH [--window-id ID] [--parent-pid PID] [--accessibility on|off]
|
|
28
|
+
[--overlay on|off]
|
|
29
|
+
rocketwright-helper serve --udid UDID --socket PATH [--parent-pid PID] [--hid auto|dtuhid|indigo]
|
|
30
|
+
[--idle-key-frames on|off] [--log-level debug|info|warning|error]
|
|
31
|
+
rocketwright-helper self-check --udid UDID [--hid auto|dtuhid|indigo]
|
|
32
|
+
rocketwright-helper render --job PATH
|
|
33
|
+
rocketwright-helper capture --udid UDID --name NAME --socket PATH --width-px N --height-px N --scale N
|
|
34
|
+
[--capture-id ID] [--reference PATH] [--parent-pid PID] [--wait SECONDS] [--linger SECONDS]
|
|
35
|
+
[--idle-key-frames on|off] [--log-level debug|info|warning|error]
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
public static func parse(_ arguments: [String]) throws -> Command {
|
|
39
|
+
guard let verb = arguments.first else { throw HelperFailure(usage, status: 400) }
|
|
40
|
+
var options = try flags(Array(arguments.dropFirst()))
|
|
41
|
+
switch verb {
|
|
42
|
+
case "version":
|
|
43
|
+
try refuseLeftovers(options)
|
|
44
|
+
return .version
|
|
45
|
+
case "mac-apps":
|
|
46
|
+
try refuseLeftovers(options)
|
|
47
|
+
return .macApps
|
|
48
|
+
case "window":
|
|
49
|
+
let window = try MacWindowOptions.take(&options)
|
|
50
|
+
try refuseLeftovers(options)
|
|
51
|
+
return .window(window)
|
|
52
|
+
case "permissions":
|
|
53
|
+
try refuseLeftovers(options)
|
|
54
|
+
return .permissions
|
|
55
|
+
case "serve":
|
|
56
|
+
let device = try DeviceOptions.take(&options)
|
|
57
|
+
guard let socket = options.removeValue(forKey: "socket"), !socket.isEmpty else {
|
|
58
|
+
throw HelperFailure("serve needs --socket\n\(usage)", status: 400)
|
|
59
|
+
}
|
|
60
|
+
let parent = try options.removeValue(forKey: "parent-pid").map(pid)
|
|
61
|
+
let idle = try options.removeValue(forKey: "idle-key-frames").map(onOff) ?? true
|
|
62
|
+
let level = try options.removeValue(forKey: "log-level").map(logLevel) ?? .info
|
|
63
|
+
try refuseLeftovers(options)
|
|
64
|
+
return .serve(ServeOptions(device: device, socket: socket, parentPid: parent, idleKeyFrames: idle, logLevel: level))
|
|
65
|
+
case "self-check":
|
|
66
|
+
let device = try DeviceOptions.take(&options)
|
|
67
|
+
try refuseLeftovers(options)
|
|
68
|
+
return .selfCheck(device)
|
|
69
|
+
case "render":
|
|
70
|
+
guard let job = options.removeValue(forKey: "job"), job.hasPrefix("/") else {
|
|
71
|
+
throw HelperFailure("render needs --job and the absolute path of its job\n\(usage)", status: 400)
|
|
72
|
+
}
|
|
73
|
+
try refuseLeftovers(options)
|
|
74
|
+
return .render(job: job)
|
|
75
|
+
case "capture":
|
|
76
|
+
let capture = try CaptureOptions.take(&options)
|
|
77
|
+
try refuseLeftovers(options)
|
|
78
|
+
return .capture(capture)
|
|
79
|
+
default:
|
|
80
|
+
throw HelperFailure("not a command: \(verb)\n\(usage)", status: 400)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static func flags(_ arguments: [String]) throws -> [String: String] {
|
|
85
|
+
var found: [String: String] = [:]
|
|
86
|
+
var rest = arguments[...]
|
|
87
|
+
while let flag = rest.popFirst() {
|
|
88
|
+
guard flag.hasPrefix("--"), flag.count > 2 else { throw HelperFailure("not a flag: \(flag)\n\(usage)", status: 400) }
|
|
89
|
+
guard let value = rest.popFirst() else { throw HelperFailure("\(flag) needs a value", status: 400) }
|
|
90
|
+
found[String(flag.dropFirst(2))] = value
|
|
91
|
+
}
|
|
92
|
+
return found
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static func refuseLeftovers(_ options: [String: String]) throws {
|
|
96
|
+
guard let unknown = options.keys.sorted().first else { return }
|
|
97
|
+
throw HelperFailure("not a flag here: --\(unknown)\n\(usage)", status: 400)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static func pid(_ text: String) throws -> Int32 {
|
|
101
|
+
guard let value = Int32(text), value > 1 else { throw HelperFailure("not a pid: \(text)", status: 400) }
|
|
102
|
+
return value
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static func onOff(_ text: String) throws -> Bool {
|
|
106
|
+
switch text {
|
|
107
|
+
case "on": return true
|
|
108
|
+
case "off": return false
|
|
109
|
+
default: throw HelperFailure("--idle-key-frames is on or off, not \(text)", status: 400)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static func logLevel(_ text: String) throws -> Log.Level {
|
|
114
|
+
guard let level = Log.Level(name: text) else { throw HelperFailure("not a log level: \(text)", status: 400) }
|
|
115
|
+
return level
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/// Which device, and how input should reach it.
|
|
120
|
+
public struct DeviceOptions: Equatable, Sendable {
|
|
121
|
+
public let udid: String
|
|
122
|
+
public let hid: TransportPolicy.Preference
|
|
123
|
+
|
|
124
|
+
public init(udid: String, hid: TransportPolicy.Preference = .auto) {
|
|
125
|
+
self.udid = udid
|
|
126
|
+
self.hid = hid
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static func take(_ options: inout [String: String]) throws -> DeviceOptions {
|
|
130
|
+
guard let udid = options.removeValue(forKey: "udid"), !udid.isEmpty else {
|
|
131
|
+
throw HelperFailure("a device is named with --udid\n\(Command.usage)", status: 400)
|
|
132
|
+
}
|
|
133
|
+
let hid = try options.removeValue(forKey: "hid").map { text in
|
|
134
|
+
guard let preference = TransportPolicy.Preference(rawValue: text) else {
|
|
135
|
+
throw HelperFailure("--hid is auto, dtuhid or indigo, not \(text)", status: 400)
|
|
136
|
+
}
|
|
137
|
+
return preference
|
|
138
|
+
} ?? .auto
|
|
139
|
+
return DeviceOptions(udid: udid, hid: hid)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public struct ServeOptions: Equatable, Sendable {
|
|
144
|
+
public let device: DeviceOptions
|
|
145
|
+
public let socket: String
|
|
146
|
+
/// The process to outlive by no more than a moment: when it is gone, so is the helper.
|
|
147
|
+
public let parentPid: Int32?
|
|
148
|
+
public let idleKeyFrames: Bool
|
|
149
|
+
public let logLevel: Log.Level
|
|
150
|
+
|
|
151
|
+
public init(device: DeviceOptions, socket: String, parentPid: Int32? = nil, idleKeyFrames: Bool = true, logLevel: Log.Level = .info) {
|
|
152
|
+
self.device = device
|
|
153
|
+
self.socket = socket
|
|
154
|
+
self.parentPid = parentPid
|
|
155
|
+
self.idleKeyFrames = idleKeyFrames
|
|
156
|
+
self.logLevel = logLevel
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/// What `rocketwright-helper version` prints.
|
|
161
|
+
public struct VersionReport: Equatable, Sendable, Encodable {
|
|
162
|
+
/// What this helper can do besides serving a simulator, so Rocketwright asks only a helper that can.
|
|
163
|
+
public static let features = ["render", "capture", "rotate", "at", "mac-capture", "mac-overlay"]
|
|
164
|
+
|
|
165
|
+
public let version: String
|
|
166
|
+
public let wire: Int
|
|
167
|
+
public let coreSimulator: String?
|
|
168
|
+
public let features: [String]
|
|
169
|
+
|
|
170
|
+
public init(coreSimulator: String?) {
|
|
171
|
+
version = HelperVersion.current
|
|
172
|
+
wire = Wire.version
|
|
173
|
+
self.coreSimulator = coreSimulator
|
|
174
|
+
features = VersionReport.features
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
enum CodingKeys: String, CodingKey {
|
|
178
|
+
case version, wire, coreSimulator = "core_simulator", features
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
public func encode(to encoder: Encoder) throws {
|
|
182
|
+
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
183
|
+
try container.encode(version, forKey: .version)
|
|
184
|
+
try container.encode(wire, forKey: .wire)
|
|
185
|
+
try container.encode(coreSimulator, forKey: .coreSimulator)
|
|
186
|
+
try container.encode(features, forKey: .features)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/// What `rocketwright-helper self-check` prints: each part of a device and whether it was reached.
|
|
191
|
+
public struct SelfCheckReport: Equatable, Sendable, Encodable {
|
|
192
|
+
public struct Part: Equatable, Sendable, Encodable {
|
|
193
|
+
public let name: String
|
|
194
|
+
public let ok: Bool
|
|
195
|
+
public let detail: String
|
|
196
|
+
|
|
197
|
+
public init(name: String, ok: Bool, detail: String) {
|
|
198
|
+
self.name = name
|
|
199
|
+
self.ok = ok
|
|
200
|
+
self.detail = detail
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
public let parts: [Part]
|
|
205
|
+
public var ok: Bool { parts.allSatisfy(\.ok) }
|
|
206
|
+
|
|
207
|
+
public init(parts: [Part]) {
|
|
208
|
+
self.parts = parts
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
enum CodingKeys: String, CodingKey { case ok, parts }
|
|
212
|
+
|
|
213
|
+
public func encode(to encoder: Encoder) throws {
|
|
214
|
+
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
215
|
+
try container.encode(ok, forKey: .ok)
|
|
216
|
+
try container.encode(parts, forKey: .parts)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/// Check each part of a device in turn: a part that fails does not stop the next from being checked.
|
|
220
|
+
public static func run(_ device: Device) async -> SelfCheckReport {
|
|
221
|
+
var parts: [Part] = []
|
|
222
|
+
func check(_ name: String, _ body: () async throws -> String) async {
|
|
223
|
+
do {
|
|
224
|
+
parts.append(Part(name: name, ok: true, detail: try await body()))
|
|
225
|
+
} catch {
|
|
226
|
+
parts.append(Part(name: name, ok: false, detail: HelperFailure.from(error).message))
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
await check("screen") {
|
|
230
|
+
let screen = try device.screen()
|
|
231
|
+
return "\(screen.widthPx)x\(screen.heightPx) pixels, \(screen.widthPt)x\(screen.heightPt) points"
|
|
232
|
+
}
|
|
233
|
+
await check("screenshot") {
|
|
234
|
+
let jpeg = try await device.screenshot(ScreenshotRequest(maxWidth: 160, quality: 40))
|
|
235
|
+
return "\(jpeg.width)x\(jpeg.height), \(jpeg.data.count) bytes"
|
|
236
|
+
}
|
|
237
|
+
await check("input") { "through \(try device.input().transport.name)" }
|
|
238
|
+
await check("element tree") { "\(count(try await device.tree().root)) elements" }
|
|
239
|
+
return SelfCheckReport(parts: parts)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
static func count(_ node: AXNode) -> Int {
|
|
243
|
+
1 + node.children.reduce(0) { $0 + count($1) }
|
|
244
|
+
}
|
|
245
|
+
}
|