@limrun/appium-xcuitest-driver 10.4.3-lim.1
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/CHANGELOG.md +2600 -0
- package/LICENSE +201 -0
- package/README.md +55 -0
- package/build/index.d.ts +5 -0
- package/build/index.js +41 -0
- package/build/lib/app-infos-cache.d.ts +62 -0
- package/build/lib/app-infos-cache.d.ts.map +1 -0
- package/build/lib/app-infos-cache.js +180 -0
- package/build/lib/app-infos-cache.js.map +1 -0
- package/build/lib/app-utils.d.ts +89 -0
- package/build/lib/app-utils.d.ts.map +1 -0
- package/build/lib/app-utils.js +657 -0
- package/build/lib/app-utils.js.map +1 -0
- package/build/lib/commands/active-app-info.d.ts +9 -0
- package/build/lib/commands/active-app-info.d.ts.map +1 -0
- package/build/lib/commands/active-app-info.js +14 -0
- package/build/lib/commands/active-app-info.js.map +1 -0
- package/build/lib/commands/advanced-battery-types.d.ts +444 -0
- package/build/lib/commands/advanced-battery-types.d.ts.map +1 -0
- package/build/lib/commands/advanced-battery-types.js +8 -0
- package/build/lib/commands/advanced-battery-types.js.map +1 -0
- package/build/lib/commands/alert.d.ts +45 -0
- package/build/lib/commands/alert.d.ts.map +1 -0
- package/build/lib/commands/alert.js +87 -0
- package/build/lib/commands/alert.js.map +1 -0
- package/build/lib/commands/app-management.d.ts +153 -0
- package/build/lib/commands/app-management.d.ts.map +1 -0
- package/build/lib/commands/app-management.js +323 -0
- package/build/lib/commands/app-management.js.map +1 -0
- package/build/lib/commands/app-strings.d.ts +16 -0
- package/build/lib/commands/app-strings.d.ts.map +1 -0
- package/build/lib/commands/app-strings.js +30 -0
- package/build/lib/commands/app-strings.js.map +1 -0
- package/build/lib/commands/appearance.d.ts +22 -0
- package/build/lib/commands/appearance.d.ts.map +1 -0
- package/build/lib/commands/appearance.js +74 -0
- package/build/lib/commands/appearance.js.map +1 -0
- package/build/lib/commands/audit.d.ts +43 -0
- package/build/lib/commands/audit.d.ts.map +1 -0
- package/build/lib/commands/audit.js +31 -0
- package/build/lib/commands/audit.js.map +1 -0
- package/build/lib/commands/battery.d.ts +13 -0
- package/build/lib/commands/battery.d.ts.map +1 -0
- package/build/lib/commands/battery.js +49 -0
- package/build/lib/commands/battery.js.map +1 -0
- package/build/lib/commands/bidi/constants.d.ts +6 -0
- package/build/lib/commands/bidi/constants.d.ts.map +1 -0
- package/build/lib/commands/bidi/constants.js +10 -0
- package/build/lib/commands/bidi/constants.js.map +1 -0
- package/build/lib/commands/bidi/models.d.ts +9 -0
- package/build/lib/commands/bidi/models.d.ts.map +1 -0
- package/build/lib/commands/bidi/models.js +54 -0
- package/build/lib/commands/bidi/models.js.map +1 -0
- package/build/lib/commands/bidi/types.d.ts +26 -0
- package/build/lib/commands/bidi/types.d.ts.map +1 -0
- package/build/lib/commands/bidi/types.js +4 -0
- package/build/lib/commands/bidi/types.js.map +1 -0
- package/build/lib/commands/biometric.d.ts +32 -0
- package/build/lib/commands/biometric.d.ts.map +1 -0
- package/build/lib/commands/biometric.js +54 -0
- package/build/lib/commands/biometric.js.map +1 -0
- package/build/lib/commands/certificate.d.ts +50 -0
- package/build/lib/commands/certificate.d.ts.map +1 -0
- package/build/lib/commands/certificate.js +454 -0
- package/build/lib/commands/certificate.js.map +1 -0
- package/build/lib/commands/clipboard.d.ts +21 -0
- package/build/lib/commands/clipboard.d.ts.map +1 -0
- package/build/lib/commands/clipboard.js +36 -0
- package/build/lib/commands/clipboard.js.map +1 -0
- package/build/lib/commands/condition.d.ts +102 -0
- package/build/lib/commands/condition.d.ts.map +1 -0
- package/build/lib/commands/condition.js +146 -0
- package/build/lib/commands/condition.js.map +1 -0
- package/build/lib/commands/content-size.d.ts +30 -0
- package/build/lib/commands/content-size.d.ts.map +1 -0
- package/build/lib/commands/content-size.js +67 -0
- package/build/lib/commands/content-size.js.map +1 -0
- package/build/lib/commands/context.d.ts +191 -0
- package/build/lib/commands/context.d.ts.map +1 -0
- package/build/lib/commands/context.js +625 -0
- package/build/lib/commands/context.js.map +1 -0
- package/build/lib/commands/deviceInfo.d.ts +12 -0
- package/build/lib/commands/deviceInfo.d.ts.map +1 -0
- package/build/lib/commands/deviceInfo.js +25 -0
- package/build/lib/commands/deviceInfo.js.map +1 -0
- package/build/lib/commands/element.d.ts +108 -0
- package/build/lib/commands/element.d.ts.map +1 -0
- package/build/lib/commands/element.js +395 -0
- package/build/lib/commands/element.js.map +1 -0
- package/build/lib/commands/enum.d.ts +105 -0
- package/build/lib/commands/enum.d.ts.map +1 -0
- package/build/lib/commands/enum.js +113 -0
- package/build/lib/commands/enum.js.map +1 -0
- package/build/lib/commands/execute.d.ts +33 -0
- package/build/lib/commands/execute.d.ts.map +1 -0
- package/build/lib/commands/execute.js +142 -0
- package/build/lib/commands/execute.js.map +1 -0
- package/build/lib/commands/file-movement.d.ts +90 -0
- package/build/lib/commands/file-movement.d.ts.map +1 -0
- package/build/lib/commands/file-movement.js +477 -0
- package/build/lib/commands/file-movement.js.map +1 -0
- package/build/lib/commands/find.d.ts +21 -0
- package/build/lib/commands/find.d.ts.map +1 -0
- package/build/lib/commands/find.js +199 -0
- package/build/lib/commands/find.js.map +1 -0
- package/build/lib/commands/general.d.ts +137 -0
- package/build/lib/commands/general.d.ts.map +1 -0
- package/build/lib/commands/general.js +270 -0
- package/build/lib/commands/general.js.map +1 -0
- package/build/lib/commands/geolocation.d.ts +57 -0
- package/build/lib/commands/geolocation.d.ts.map +1 -0
- package/build/lib/commands/geolocation.js +58 -0
- package/build/lib/commands/geolocation.js.map +1 -0
- package/build/lib/commands/gesture.d.ts +283 -0
- package/build/lib/commands/gesture.d.ts.map +1 -0
- package/build/lib/commands/gesture.js +565 -0
- package/build/lib/commands/gesture.js.map +1 -0
- package/build/lib/commands/hid-event.d.ts +2773 -0
- package/build/lib/commands/hid-event.d.ts.map +1 -0
- package/build/lib/commands/hid-event.js +1633 -0
- package/build/lib/commands/hid-event.js.map +1 -0
- package/build/lib/commands/increase-contrast.d.ts +24 -0
- package/build/lib/commands/increase-contrast.d.ts.map +1 -0
- package/build/lib/commands/increase-contrast.js +49 -0
- package/build/lib/commands/increase-contrast.js.map +1 -0
- package/build/lib/commands/iohid.d.ts +1372 -0
- package/build/lib/commands/iohid.d.ts.map +1 -0
- package/build/lib/commands/iohid.js +63 -0
- package/build/lib/commands/iohid.js.map +1 -0
- package/build/lib/commands/keyboard.d.ts +32 -0
- package/build/lib/commands/keyboard.d.ts.map +1 -0
- package/build/lib/commands/keyboard.js +67 -0
- package/build/lib/commands/keyboard.js.map +1 -0
- package/build/lib/commands/keychains.d.ts +10 -0
- package/build/lib/commands/keychains.d.ts.map +1 -0
- package/build/lib/commands/keychains.js +22 -0
- package/build/lib/commands/keychains.js.map +1 -0
- package/build/lib/commands/localization.d.ts +17 -0
- package/build/lib/commands/localization.d.ts.map +1 -0
- package/build/lib/commands/localization.js +34 -0
- package/build/lib/commands/localization.js.map +1 -0
- package/build/lib/commands/location.d.ts +40 -0
- package/build/lib/commands/location.d.ts.map +1 -0
- package/build/lib/commands/location.js +121 -0
- package/build/lib/commands/location.js.map +1 -0
- package/build/lib/commands/lock.d.ts +23 -0
- package/build/lib/commands/lock.d.ts.map +1 -0
- package/build/lib/commands/lock.js +49 -0
- package/build/lib/commands/lock.js.map +1 -0
- package/build/lib/commands/log.d.ts +68 -0
- package/build/lib/commands/log.d.ts.map +1 -0
- package/build/lib/commands/log.js +287 -0
- package/build/lib/commands/log.js.map +1 -0
- package/build/lib/commands/memory.d.ts +11 -0
- package/build/lib/commands/memory.d.ts.map +1 -0
- package/build/lib/commands/memory.js +49 -0
- package/build/lib/commands/memory.js.map +1 -0
- package/build/lib/commands/navigation.d.ts +44 -0
- package/build/lib/commands/navigation.d.ts.map +1 -0
- package/build/lib/commands/navigation.js +121 -0
- package/build/lib/commands/navigation.js.map +1 -0
- package/build/lib/commands/notifications.d.ts +28 -0
- package/build/lib/commands/notifications.d.ts.map +1 -0
- package/build/lib/commands/notifications.js +64 -0
- package/build/lib/commands/notifications.js.map +1 -0
- package/build/lib/commands/pasteboard.d.ts +23 -0
- package/build/lib/commands/pasteboard.d.ts.map +1 -0
- package/build/lib/commands/pasteboard.js +43 -0
- package/build/lib/commands/pasteboard.js.map +1 -0
- package/build/lib/commands/pcap.d.ts +54 -0
- package/build/lib/commands/pcap.d.ts.map +1 -0
- package/build/lib/commands/pcap.js +149 -0
- package/build/lib/commands/pcap.js.map +1 -0
- package/build/lib/commands/performance.d.ts +85 -0
- package/build/lib/commands/performance.d.ts.map +1 -0
- package/build/lib/commands/performance.js +331 -0
- package/build/lib/commands/performance.js.map +1 -0
- package/build/lib/commands/permissions.d.ts +36 -0
- package/build/lib/commands/permissions.d.ts.map +1 -0
- package/build/lib/commands/permissions.js +80 -0
- package/build/lib/commands/permissions.js.map +1 -0
- package/build/lib/commands/proxy-helper.d.ts +15 -0
- package/build/lib/commands/proxy-helper.d.ts.map +1 -0
- package/build/lib/commands/proxy-helper.js +117 -0
- package/build/lib/commands/proxy-helper.js.map +1 -0
- package/build/lib/commands/record-audio.d.ts +69 -0
- package/build/lib/commands/record-audio.d.ts.map +1 -0
- package/build/lib/commands/record-audio.js +228 -0
- package/build/lib/commands/record-audio.js.map +1 -0
- package/build/lib/commands/recordscreen.d.ts +89 -0
- package/build/lib/commands/recordscreen.d.ts.map +1 -0
- package/build/lib/commands/recordscreen.js +326 -0
- package/build/lib/commands/recordscreen.js.map +1 -0
- package/build/lib/commands/screenshots.d.ts +16 -0
- package/build/lib/commands/screenshots.d.ts.map +1 -0
- package/build/lib/commands/screenshots.js +129 -0
- package/build/lib/commands/screenshots.js.map +1 -0
- package/build/lib/commands/simctl.d.ts +27 -0
- package/build/lib/commands/simctl.d.ts.map +1 -0
- package/build/lib/commands/simctl.js +65 -0
- package/build/lib/commands/simctl.js.map +1 -0
- package/build/lib/commands/source.d.ts +16 -0
- package/build/lib/commands/source.d.ts.map +1 -0
- package/build/lib/commands/source.js +128 -0
- package/build/lib/commands/source.js.map +1 -0
- package/build/lib/commands/timeouts.d.ts +53 -0
- package/build/lib/commands/timeouts.d.ts.map +1 -0
- package/build/lib/commands/timeouts.js +71 -0
- package/build/lib/commands/timeouts.js.map +1 -0
- package/build/lib/commands/types.d.ts +539 -0
- package/build/lib/commands/types.d.ts.map +1 -0
- package/build/lib/commands/types.js +3 -0
- package/build/lib/commands/types.js.map +1 -0
- package/build/lib/commands/web.d.ts +297 -0
- package/build/lib/commands/web.d.ts.map +1 -0
- package/build/lib/commands/web.js +1029 -0
- package/build/lib/commands/web.js.map +1 -0
- package/build/lib/commands/xctest-record-screen.d.ts +92 -0
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -0
- package/build/lib/commands/xctest-record-screen.js +193 -0
- package/build/lib/commands/xctest-record-screen.js.map +1 -0
- package/build/lib/commands/xctest.d.ts +71 -0
- package/build/lib/commands/xctest.d.ts.map +1 -0
- package/build/lib/commands/xctest.js +257 -0
- package/build/lib/commands/xctest.js.map +1 -0
- package/build/lib/css-converter.d.ts +10 -0
- package/build/lib/css-converter.d.ts.map +1 -0
- package/build/lib/css-converter.js +258 -0
- package/build/lib/css-converter.js.map +1 -0
- package/build/lib/desired-caps.d.ts +506 -0
- package/build/lib/desired-caps.d.ts.map +1 -0
- package/build/lib/desired-caps.js +400 -0
- package/build/lib/desired-caps.js.map +1 -0
- package/build/lib/device-connections-factory.d.ts +13 -0
- package/build/lib/device-connections-factory.d.ts.map +1 -0
- package/build/lib/device-connections-factory.js +244 -0
- package/build/lib/device-connections-factory.js.map +1 -0
- package/build/lib/device-log/helpers.d.ts +10 -0
- package/build/lib/device-log/helpers.d.ts.map +1 -0
- package/build/lib/device-log/helpers.js +37 -0
- package/build/lib/device-log/helpers.js.map +1 -0
- package/build/lib/device-log/ios-crash-log.d.ts +34 -0
- package/build/lib/device-log/ios-crash-log.d.ts.map +1 -0
- package/build/lib/device-log/ios-crash-log.js +141 -0
- package/build/lib/device-log/ios-crash-log.js.map +1 -0
- package/build/lib/device-log/ios-device-log.d.ts +19 -0
- package/build/lib/device-log/ios-device-log.d.ts.map +1 -0
- package/build/lib/device-log/ios-device-log.js +42 -0
- package/build/lib/device-log/ios-device-log.js.map +1 -0
- package/build/lib/device-log/ios-log.d.ts +24 -0
- package/build/lib/device-log/ios-log.d.ts.map +1 -0
- package/build/lib/device-log/ios-log.js +50 -0
- package/build/lib/device-log/ios-log.js.map +1 -0
- package/build/lib/device-log/ios-performance-log.d.ts +18 -0
- package/build/lib/device-log/ios-performance-log.d.ts.map +1 -0
- package/build/lib/device-log/ios-performance-log.js +43 -0
- package/build/lib/device-log/ios-performance-log.js.map +1 -0
- package/build/lib/device-log/ios-simulator-log.d.ts +38 -0
- package/build/lib/device-log/ios-simulator-log.d.ts.map +1 -0
- package/build/lib/device-log/ios-simulator-log.js +184 -0
- package/build/lib/device-log/ios-simulator-log.js.map +1 -0
- package/build/lib/device-log/line-consuming-log.d.ts +9 -0
- package/build/lib/device-log/line-consuming-log.d.ts.map +1 -0
- package/build/lib/device-log/line-consuming-log.js +16 -0
- package/build/lib/device-log/line-consuming-log.js.map +1 -0
- package/build/lib/device-log/safari-console-log.d.ts +67 -0
- package/build/lib/device-log/safari-console-log.d.ts.map +1 -0
- package/build/lib/device-log/safari-console-log.js +81 -0
- package/build/lib/device-log/safari-console-log.js.map +1 -0
- package/build/lib/device-log/safari-network-log.d.ts +75 -0
- package/build/lib/device-log/safari-network-log.d.ts.map +1 -0
- package/build/lib/device-log/safari-network-log.js +47 -0
- package/build/lib/device-log/safari-network-log.js.map +1 -0
- package/build/lib/doctor/checks.d.ts +3 -0
- package/build/lib/doctor/checks.d.ts.map +1 -0
- package/build/lib/doctor/checks.js +39 -0
- package/build/lib/doctor/checks.js.map +1 -0
- package/build/lib/doctor/optional-checks.d.ts +46 -0
- package/build/lib/doctor/optional-checks.d.ts.map +1 -0
- package/build/lib/doctor/optional-checks.js +129 -0
- package/build/lib/doctor/optional-checks.js.map +1 -0
- package/build/lib/doctor/required-checks.d.ts +42 -0
- package/build/lib/doctor/required-checks.d.ts.map +1 -0
- package/build/lib/doctor/required-checks.js +94 -0
- package/build/lib/doctor/required-checks.js.map +1 -0
- package/build/lib/doctor/utils.d.ts +8 -0
- package/build/lib/doctor/utils.d.ts.map +1 -0
- package/build/lib/doctor/utils.js +21 -0
- package/build/lib/doctor/utils.js.map +1 -0
- package/build/lib/driver.d.ts +2429 -0
- package/build/lib/driver.d.ts.map +1 -0
- package/build/lib/driver.js +1967 -0
- package/build/lib/driver.js.map +1 -0
- package/build/lib/execute-method-map.d.ts +552 -0
- package/build/lib/execute-method-map.d.ts.map +1 -0
- package/build/lib/execute-method-map.js +586 -0
- package/build/lib/execute-method-map.js.map +1 -0
- package/build/lib/ios-fs-helpers.d.ts +75 -0
- package/build/lib/ios-fs-helpers.d.ts.map +1 -0
- package/build/lib/ios-fs-helpers.js +370 -0
- package/build/lib/ios-fs-helpers.js.map +1 -0
- package/build/lib/ios-generic-simulators.d.ts +6 -0
- package/build/lib/ios-generic-simulators.d.ts.map +1 -0
- package/build/lib/ios-generic-simulators.js +14 -0
- package/build/lib/ios-generic-simulators.js.map +1 -0
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +6 -0
- package/build/lib/logger.js.map +1 -0
- package/build/lib/method-map.d.ts +229 -0
- package/build/lib/method-map.d.ts.map +1 -0
- package/build/lib/method-map.js +200 -0
- package/build/lib/method-map.js.map +1 -0
- package/build/lib/real-device-clients/base-device-client.d.ts +22 -0
- package/build/lib/real-device-clients/base-device-client.d.ts.map +1 -0
- package/build/lib/real-device-clients/base-device-client.js +14 -0
- package/build/lib/real-device-clients/base-device-client.js.map +1 -0
- package/build/lib/real-device-clients/py-ios-device-client.d.ts +21 -0
- package/build/lib/real-device-clients/py-ios-device-client.d.ts.map +1 -0
- package/build/lib/real-device-clients/py-ios-device-client.js +125 -0
- package/build/lib/real-device-clients/py-ios-device-client.js.map +1 -0
- package/build/lib/real-device-management.d.ts +53 -0
- package/build/lib/real-device-management.d.ts.map +1 -0
- package/build/lib/real-device-management.js +128 -0
- package/build/lib/real-device-management.js.map +1 -0
- package/build/lib/real-device.d.ts +112 -0
- package/build/lib/real-device.d.ts.map +1 -0
- package/build/lib/real-device.js +352 -0
- package/build/lib/real-device.js.map +1 -0
- package/build/lib/simulator-management.d.ts +96 -0
- package/build/lib/simulator-management.d.ts.map +1 -0
- package/build/lib/simulator-management.js +278 -0
- package/build/lib/simulator-management.js.map +1 -0
- package/build/lib/stubs.d.ts +3 -0
- package/build/lib/stubs.d.ts.map +1 -0
- package/build/lib/stubs.js +3 -0
- package/build/lib/stubs.js.map +1 -0
- package/build/lib/types.d.ts +31 -0
- package/build/lib/types.d.ts.map +1 -0
- package/build/lib/types.js +3 -0
- package/build/lib/types.js.map +1 -0
- package/build/lib/utils.d.ts +191 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +549 -0
- package/build/lib/utils.js.map +1 -0
- package/build/lib/xcrun.d.ts +3 -0
- package/build/lib/xcrun.d.ts.map +1 -0
- package/build/lib/xcrun.js +17 -0
- package/build/lib/xcrun.js.map +1 -0
- package/index.js +7 -0
- package/lib/app-infos-cache.js +187 -0
- package/lib/app-utils.js +710 -0
- package/lib/commands/active-app-info.js +12 -0
- package/lib/commands/advanced-battery-types.ts +454 -0
- package/lib/commands/alert.js +88 -0
- package/lib/commands/app-management.js +346 -0
- package/lib/commands/app-strings.js +30 -0
- package/lib/commands/appearance.js +71 -0
- package/lib/commands/audit.js +31 -0
- package/lib/commands/battery.js +45 -0
- package/lib/commands/bidi/constants.ts +6 -0
- package/lib/commands/bidi/models.ts +55 -0
- package/lib/commands/bidi/types.ts +31 -0
- package/lib/commands/biometric.js +53 -0
- package/lib/commands/certificate.js +497 -0
- package/lib/commands/clipboard.js +35 -0
- package/lib/commands/condition.js +155 -0
- package/lib/commands/content-size.js +68 -0
- package/lib/commands/context.js +705 -0
- package/lib/commands/deviceInfo.js +27 -0
- package/lib/commands/element.js +423 -0
- package/lib/commands/enum.ts +108 -0
- package/lib/commands/execute.js +153 -0
- package/lib/commands/file-movement.js +510 -0
- package/lib/commands/find.js +205 -0
- package/lib/commands/general.js +278 -0
- package/lib/commands/geolocation.js +56 -0
- package/lib/commands/gesture.js +596 -0
- package/lib/commands/hid-event.ts +1634 -0
- package/lib/commands/increase-contrast.js +50 -0
- package/lib/commands/iohid.js +64 -0
- package/lib/commands/keyboard.js +62 -0
- package/lib/commands/keychains.js +18 -0
- package/lib/commands/localization.js +30 -0
- package/lib/commands/location.js +131 -0
- package/lib/commands/lock.js +46 -0
- package/lib/commands/log.js +327 -0
- package/lib/commands/memory.js +51 -0
- package/lib/commands/navigation.js +125 -0
- package/lib/commands/notifications.js +66 -0
- package/lib/commands/pasteboard.js +42 -0
- package/lib/commands/pcap.js +168 -0
- package/lib/commands/performance.js +392 -0
- package/lib/commands/permissions.js +85 -0
- package/lib/commands/proxy-helper.js +122 -0
- package/lib/commands/record-audio.js +264 -0
- package/lib/commands/recordscreen.js +391 -0
- package/lib/commands/screenshots.js +137 -0
- package/lib/commands/simctl.js +71 -0
- package/lib/commands/source.js +131 -0
- package/lib/commands/timeouts.js +68 -0
- package/lib/commands/types.ts +648 -0
- package/lib/commands/web.js +1113 -0
- package/lib/commands/xctest-record-screen.js +204 -0
- package/lib/commands/xctest.js +285 -0
- package/lib/css-converter.js +311 -0
- package/lib/desired-caps.js +396 -0
- package/lib/device-connections-factory.js +269 -0
- package/lib/device-log/helpers.ts +40 -0
- package/lib/device-log/ios-crash-log.ts +166 -0
- package/lib/device-log/ios-device-log.ts +51 -0
- package/lib/device-log/ios-log.ts +70 -0
- package/lib/device-log/ios-performance-log.ts +50 -0
- package/lib/device-log/ios-simulator-log.ts +202 -0
- package/lib/device-log/line-consuming-log.ts +16 -0
- package/lib/device-log/safari-console-log.ts +117 -0
- package/lib/device-log/safari-network-log.ts +120 -0
- package/lib/doctor/checks.ts +3 -0
- package/lib/doctor/optional-checks.ts +173 -0
- package/lib/doctor/required-checks.ts +120 -0
- package/lib/doctor/utils.ts +18 -0
- package/lib/driver.js +2316 -0
- package/lib/execute-method-map.ts +585 -0
- package/lib/ios-fs-helpers.js +355 -0
- package/lib/ios-generic-simulators.js +11 -0
- package/lib/logger.js +5 -0
- package/lib/method-map.js +196 -0
- package/lib/real-device-clients/base-device-client.ts +34 -0
- package/lib/real-device-clients/py-ios-device-client.ts +149 -0
- package/lib/real-device-management.js +133 -0
- package/lib/real-device.js +347 -0
- package/lib/simulator-management.js +324 -0
- package/lib/stubs.ts +3 -0
- package/lib/types.ts +33 -0
- package/lib/utils.js +551 -0
- package/lib/xcrun.js +16 -0
- package/package.json +175 -0
- package/scripts/build-docs.js +56 -0
- package/scripts/build-wda.js +42 -0
- package/scripts/download-wda-sim.mjs +68 -0
- package/scripts/image-mounter.mjs +239 -0
- package/scripts/open-wda.mjs +15 -0
- package/scripts/tunnel-creation.mjs +359 -0
- package/scripts/utils.js +16 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {fs, tempDir, logger, util} from 'appium/support';
|
|
3
|
+
import {SubProcess} from 'teen_process';
|
|
4
|
+
import {encodeBase64OrUpload} from '../utils';
|
|
5
|
+
import {WDA_BASE_URL} from 'appium-webdriveragent';
|
|
6
|
+
import {waitForCondition} from 'asyncbox';
|
|
7
|
+
import url from 'url';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Set max timeout for 'reconnect_delay_max' ffmpeg argument usage.
|
|
11
|
+
* It could have [0-4294] range limitation, thus this value should be less than that right now
|
|
12
|
+
* to return a better error message.
|
|
13
|
+
*/
|
|
14
|
+
const MAX_RECORDING_TIME_SEC = 4200;
|
|
15
|
+
const DEFAULT_RECORDING_TIME_SEC = 60 * 3;
|
|
16
|
+
const DEFAULT_FPS = 10;
|
|
17
|
+
const DEFAULT_QUALITY = 'medium';
|
|
18
|
+
const DEFAULT_MJPEG_SERVER_PORT = 9100;
|
|
19
|
+
const DEFAULT_VCODEC = 'mjpeg';
|
|
20
|
+
const MP4_EXT = '.mp4';
|
|
21
|
+
const FFMPEG_BINARY = 'ffmpeg';
|
|
22
|
+
const ffmpegLogger = logger.getLogger(FFMPEG_BINARY);
|
|
23
|
+
const QUALITY_MAPPING = {
|
|
24
|
+
low: 10,
|
|
25
|
+
medium: 25,
|
|
26
|
+
high: 75,
|
|
27
|
+
photo: 100,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const HARDWARE_ACCELERATION_PARAMETERS = {
|
|
31
|
+
/* https://trac.ffmpeg.org/wiki/HWAccelIntro#VideoToolbox */
|
|
32
|
+
videoToolbox: {
|
|
33
|
+
hwaccel: 'videotoolbox',
|
|
34
|
+
hwaccelOutputFormat: 'videotoolbox_vld',
|
|
35
|
+
scaleFilterHWAccel: 'scale_vt',
|
|
36
|
+
videoTypeHWAccel: 'h264_videotoolbox',
|
|
37
|
+
},
|
|
38
|
+
/* https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDANVENCNVDEC */
|
|
39
|
+
cuda: {
|
|
40
|
+
hwaccel: 'cuda',
|
|
41
|
+
hwaccelOutputFormat: 'cuda',
|
|
42
|
+
scaleFilterHWAccel: 'scale_cuda',
|
|
43
|
+
videoTypeHWAccel: 'h264_nvenc',
|
|
44
|
+
},
|
|
45
|
+
/* https://trac.ffmpeg.org/wiki/Hardware/AMF */
|
|
46
|
+
amf_dx11: {
|
|
47
|
+
hwaccel: 'd3d11va',
|
|
48
|
+
hwaccelOutputFormat: 'd3d11',
|
|
49
|
+
scaleFilterHWAccel: 'scale',
|
|
50
|
+
videoTypeHWAccel: 'av1_amf',
|
|
51
|
+
},
|
|
52
|
+
/* https://trac.ffmpeg.org/wiki/Hardware/QuickSync */
|
|
53
|
+
qsv: {
|
|
54
|
+
hwaccel: 'qsv',
|
|
55
|
+
hwaccelOutputFormat: '',
|
|
56
|
+
scaleFilterHWAccel: 'scale_qsv',
|
|
57
|
+
videoTypeHWAccel: 'h264_qsv'
|
|
58
|
+
},
|
|
59
|
+
/* https://trac.ffmpeg.org/wiki/Hardware/VAAPI */
|
|
60
|
+
vaapi: {
|
|
61
|
+
hwaccel: 'vaapi',
|
|
62
|
+
hwaccelOutputFormat: 'vaapi',
|
|
63
|
+
scaleFilterHWAccel: 'scale_vaapi',
|
|
64
|
+
videoTypeHWAccel: 'h264_vaapi'
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const CAPTURE_START_MARKER = /^\s*frame=/;
|
|
69
|
+
|
|
70
|
+
export class ScreenRecorder {
|
|
71
|
+
constructor(udid, log, videoPath, opts = {}) {
|
|
72
|
+
this.videoPath = videoPath;
|
|
73
|
+
this.log = log;
|
|
74
|
+
this.opts = opts;
|
|
75
|
+
this.udid = udid;
|
|
76
|
+
this.mainProcess = null;
|
|
77
|
+
this.timeoutHandler = null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async start(timeoutMs) {
|
|
81
|
+
try {
|
|
82
|
+
await fs.which(FFMPEG_BINARY);
|
|
83
|
+
} catch {
|
|
84
|
+
throw new Error(
|
|
85
|
+
`'${FFMPEG_BINARY}' binary is not found in PATH. Install it using 'brew install ffmpeg'. ` +
|
|
86
|
+
`Check https://www.ffmpeg.org/download.html for more details.`,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const {
|
|
91
|
+
hardwareAcceleration,
|
|
92
|
+
remotePort,
|
|
93
|
+
remoteUrl,
|
|
94
|
+
videoFps,
|
|
95
|
+
videoType,
|
|
96
|
+
videoScale,
|
|
97
|
+
videoFilters,
|
|
98
|
+
pixelFormat,
|
|
99
|
+
} = this.opts;
|
|
100
|
+
|
|
101
|
+
const args = [
|
|
102
|
+
'-f',
|
|
103
|
+
'mjpeg',
|
|
104
|
+
// https://github.com/appium/appium/issues/16294
|
|
105
|
+
'-reconnect',
|
|
106
|
+
'1',
|
|
107
|
+
'-reconnect_at_eof',
|
|
108
|
+
'1',
|
|
109
|
+
'-reconnect_streamed',
|
|
110
|
+
'1',
|
|
111
|
+
'-reconnect_delay_max',
|
|
112
|
+
`${timeoutMs / 1000 + 1}`,
|
|
113
|
+
];
|
|
114
|
+
const {
|
|
115
|
+
hwaccel,
|
|
116
|
+
hwaccelOutputFormat,
|
|
117
|
+
scaleFilterHWAccel,
|
|
118
|
+
videoTypeHWAccel
|
|
119
|
+
} = HARDWARE_ACCELERATION_PARAMETERS[hardwareAcceleration] ?? {};
|
|
120
|
+
|
|
121
|
+
if (hwaccel) {
|
|
122
|
+
args.push('-hwaccel', hwaccel);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (hwaccelOutputFormat) {
|
|
126
|
+
args.push('-hwaccel_output_format', hwaccelOutputFormat);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
//Parameter `-r` is optional. See details: https://github.com/appium/appium/issues/12067
|
|
130
|
+
if (videoFps && videoType === 'libx264' || videoTypeHWAccel) {
|
|
131
|
+
args.push('-r', videoFps);
|
|
132
|
+
}
|
|
133
|
+
const {protocol, hostname} = url.parse(remoteUrl);
|
|
134
|
+
args.push('-i', `${protocol}//${hostname}:${remotePort}`);
|
|
135
|
+
|
|
136
|
+
if (videoFilters || videoScale) {
|
|
137
|
+
args.push('-vf', videoFilters || `${scaleFilterHWAccel || 'scale'}=${videoScale}`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Quicktime compatibility via pixelFormat: 'yuv420p'
|
|
141
|
+
if (pixelFormat) {
|
|
142
|
+
args.push('-pix_fmt', pixelFormat);
|
|
143
|
+
}
|
|
144
|
+
args.push('-vcodec', videoTypeHWAccel || videoType);
|
|
145
|
+
args.push('-y');
|
|
146
|
+
args.push(this.videoPath);
|
|
147
|
+
|
|
148
|
+
this.mainProcess = new SubProcess(FFMPEG_BINARY, args);
|
|
149
|
+
let isCaptureStarted = false;
|
|
150
|
+
this.mainProcess.on('line-stderr', (line) => {
|
|
151
|
+
if (CAPTURE_START_MARKER.test(line)) {
|
|
152
|
+
if (!isCaptureStarted) {
|
|
153
|
+
isCaptureStarted = true;
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
ffmpegLogger.info(line);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
await this.mainProcess.start(0);
|
|
160
|
+
const startupTimeout = 5000;
|
|
161
|
+
try {
|
|
162
|
+
await waitForCondition(() => isCaptureStarted, {
|
|
163
|
+
waitMs: startupTimeout,
|
|
164
|
+
intervalMs: 300,
|
|
165
|
+
});
|
|
166
|
+
} catch {
|
|
167
|
+
this.log.warn(
|
|
168
|
+
`Screen capture process did not start within ${startupTimeout}ms. Continuing anyway`,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
if (!this.mainProcess.isRunning) {
|
|
172
|
+
throw new Error(
|
|
173
|
+
`The screen capture process '${FFMPEG_BINARY}' died unexpectedly. ` +
|
|
174
|
+
`Check server logs for more details`,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
this.log.info(
|
|
178
|
+
`Starting screen capture on the device '${
|
|
179
|
+
this.udid
|
|
180
|
+
}' with command: '${FFMPEG_BINARY} ${args.join(' ')}'. ` + `Will timeout in ${timeoutMs}ms`,
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
this.timeoutHandler = setTimeout(async () => {
|
|
184
|
+
if (!(await this.interrupt())) {
|
|
185
|
+
this.log.warn(
|
|
186
|
+
`Cannot finish the active screen recording on the device '${this.udid}' after ${timeoutMs}ms timeout`,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
}, timeoutMs);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async interrupt(force = false) {
|
|
193
|
+
let result = true;
|
|
194
|
+
|
|
195
|
+
if (this.timeoutHandler) {
|
|
196
|
+
clearTimeout(this.timeoutHandler);
|
|
197
|
+
this.timeoutHandler = null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (this.mainProcess?.isRunning) {
|
|
201
|
+
const interruptPromise = this.mainProcess.stop(force ? 'SIGTERM' : 'SIGINT');
|
|
202
|
+
this.mainProcess = null;
|
|
203
|
+
try {
|
|
204
|
+
await interruptPromise;
|
|
205
|
+
} catch (e) {
|
|
206
|
+
this.log.warn(
|
|
207
|
+
`Cannot ${force ? 'terminate' : 'interrupt'} ${FFMPEG_BINARY}. ` +
|
|
208
|
+
`Original error: ${e.message}`,
|
|
209
|
+
);
|
|
210
|
+
result = false;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async finish() {
|
|
218
|
+
await this.interrupt();
|
|
219
|
+
return this.videoPath;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
async cleanup() {
|
|
223
|
+
if (await fs.exists(this.videoPath)) {
|
|
224
|
+
await fs.rimraf(this.videoPath);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Direct Appium to start recording the device screen
|
|
231
|
+
*
|
|
232
|
+
* Record the display of devices running iOS Simulator since Xcode 9 or real devices since iOS 11
|
|
233
|
+
* (ffmpeg utility is required: 'brew install ffmpeg').
|
|
234
|
+
* It records screen activity to a MPEG-4 file. Audio is not recorded with the video file.
|
|
235
|
+
* If screen recording has been already started then the command will stop it forcefully and start a new one.
|
|
236
|
+
* The previously recorded video file will be deleted.
|
|
237
|
+
*
|
|
238
|
+
* @param {import('./types').StartRecordingScreenOptions} [options] - The available options.
|
|
239
|
+
* @returns {Promise<string>} Base64-encoded content of the recorded media file if
|
|
240
|
+
* any screen recording is currently running or an empty string.
|
|
241
|
+
* @throws {Error} If screen recording has failed to start.
|
|
242
|
+
* @this {XCUITestDriver}
|
|
243
|
+
*/
|
|
244
|
+
export async function startRecordingScreen(options = {}) {
|
|
245
|
+
const {
|
|
246
|
+
videoType = DEFAULT_VCODEC,
|
|
247
|
+
timeLimit = DEFAULT_RECORDING_TIME_SEC,
|
|
248
|
+
videoQuality = DEFAULT_QUALITY,
|
|
249
|
+
videoFps = DEFAULT_FPS,
|
|
250
|
+
videoFilters,
|
|
251
|
+
videoScale,
|
|
252
|
+
forceRestart,
|
|
253
|
+
pixelFormat,
|
|
254
|
+
hardwareAcceleration
|
|
255
|
+
} = options;
|
|
256
|
+
|
|
257
|
+
let result = '';
|
|
258
|
+
if (!forceRestart) {
|
|
259
|
+
this.log.info(
|
|
260
|
+
`Checking if there is/was a previous screen recording. ` +
|
|
261
|
+
`Set 'forceRestart' option to 'true' if you'd like to skip this step.`
|
|
262
|
+
);
|
|
263
|
+
result = (await this.stopRecordingScreen(options)) ?? result;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const videoPath = await tempDir.path({
|
|
267
|
+
prefix: `appium_${Math.random().toString(16).substring(2, 8)}`,
|
|
268
|
+
suffix: MP4_EXT
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
const wdaBaseUrl = this.opts.wdaBaseUrl || WDA_BASE_URL;
|
|
272
|
+
const screenRecorder = new ScreenRecorder(this.device.udid, this.log, videoPath, {
|
|
273
|
+
remotePort: this.opts.mjpegServerPort || DEFAULT_MJPEG_SERVER_PORT,
|
|
274
|
+
remoteUrl: wdaBaseUrl,
|
|
275
|
+
videoType,
|
|
276
|
+
videoFilters,
|
|
277
|
+
videoScale,
|
|
278
|
+
videoFps,
|
|
279
|
+
pixelFormat,
|
|
280
|
+
hardwareAcceleration
|
|
281
|
+
});
|
|
282
|
+
if (!(await screenRecorder.interrupt(true))) {
|
|
283
|
+
throw this.log.errorWithException('Unable to stop screen recording process');
|
|
284
|
+
}
|
|
285
|
+
if (this._recentScreenRecorder) {
|
|
286
|
+
await this._recentScreenRecorder.cleanup();
|
|
287
|
+
this._recentScreenRecorder = null;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const timeoutSeconds = parseFloat(String(timeLimit));
|
|
291
|
+
if (isNaN(timeoutSeconds) || timeoutSeconds > MAX_RECORDING_TIME_SEC || timeoutSeconds <= 0) {
|
|
292
|
+
throw this.log.errorWithException(
|
|
293
|
+
`The timeLimit value must be in range [1, ${MAX_RECORDING_TIME_SEC}] seconds. ` +
|
|
294
|
+
`The value of '${timeLimit}' has been passed instead.`,
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
let {mjpegServerScreenshotQuality, mjpegServerFramerate} =
|
|
299
|
+
/** @type {import('appium-webdriveragent').WDASettings} */ (
|
|
300
|
+
await this.proxyCommand('/appium/settings', 'GET')
|
|
301
|
+
);
|
|
302
|
+
if (videoQuality) {
|
|
303
|
+
const quality = _.isInteger(videoQuality)
|
|
304
|
+
? videoQuality
|
|
305
|
+
: QUALITY_MAPPING[_.toLower(String(videoQuality))];
|
|
306
|
+
if (!quality) {
|
|
307
|
+
throw new Error(
|
|
308
|
+
`videoQuality value should be one of ${JSON.stringify(
|
|
309
|
+
_.keys(QUALITY_MAPPING)
|
|
310
|
+
)} or a number in range 1..100. ` + `'${videoQuality}' is given instead`
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
mjpegServerScreenshotQuality = mjpegServerScreenshotQuality !== quality ? quality : undefined;
|
|
314
|
+
} else {
|
|
315
|
+
mjpegServerScreenshotQuality = undefined;
|
|
316
|
+
}
|
|
317
|
+
if (videoFps) {
|
|
318
|
+
const fps = parseInt(String(videoFps), 10);
|
|
319
|
+
if (isNaN(fps)) {
|
|
320
|
+
throw new Error(
|
|
321
|
+
`videoFps value should be a valid number in range 1..60. ` +
|
|
322
|
+
`'${videoFps}' is given instead`
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
mjpegServerFramerate = mjpegServerFramerate !== fps ? fps : undefined;
|
|
326
|
+
} else {
|
|
327
|
+
mjpegServerFramerate = undefined;
|
|
328
|
+
}
|
|
329
|
+
if (util.hasValue(mjpegServerScreenshotQuality) || util.hasValue(mjpegServerFramerate)) {
|
|
330
|
+
await this.proxyCommand('/appium/settings', 'POST', {
|
|
331
|
+
settings: {
|
|
332
|
+
mjpegServerScreenshotQuality,
|
|
333
|
+
mjpegServerFramerate
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
try {
|
|
339
|
+
await screenRecorder.start(timeoutSeconds * 1000);
|
|
340
|
+
} catch (e) {
|
|
341
|
+
await screenRecorder.interrupt(true);
|
|
342
|
+
await screenRecorder.cleanup();
|
|
343
|
+
throw e;
|
|
344
|
+
}
|
|
345
|
+
this._recentScreenRecorder = screenRecorder;
|
|
346
|
+
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Direct Appium to stop screen recording and return the video
|
|
352
|
+
*
|
|
353
|
+
* If no screen recording process is running then the endpoint will try to get
|
|
354
|
+
* the recently recorded file. If no previously recorded file is found and no
|
|
355
|
+
* active screen recording processes are running then the method returns an
|
|
356
|
+
* empty string.
|
|
357
|
+
*
|
|
358
|
+
* @param {import('./types').StopRecordingScreenOptions} options - The available
|
|
359
|
+
* options.
|
|
360
|
+
* @returns {Promise<string?>} Base64-encoded content of the recorded media
|
|
361
|
+
* file if `remotePath` parameter is empty or null or an empty string.
|
|
362
|
+
* @throws {Error} If there was an error while getting the name of a media
|
|
363
|
+
* file or the file content cannot be uploaded to the remote
|
|
364
|
+
* location.
|
|
365
|
+
* @this {XCUITestDriver}
|
|
366
|
+
*/
|
|
367
|
+
export async function stopRecordingScreen(options = {}) {
|
|
368
|
+
if (!this._recentScreenRecorder) {
|
|
369
|
+
this.log.info('Screen recording is not running. There is nothing to stop.');
|
|
370
|
+
return '';
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
try {
|
|
374
|
+
const videoPath = await this._recentScreenRecorder.finish();
|
|
375
|
+
if (!(await fs.exists(videoPath))) {
|
|
376
|
+
throw this.log.errorWithException(
|
|
377
|
+
`The screen recorder utility has failed ` +
|
|
378
|
+
`to store the actual screen recording at '${videoPath}'`
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
return await encodeBase64OrUpload(videoPath, options.remotePath, options);
|
|
382
|
+
} finally {
|
|
383
|
+
await this._recentScreenRecorder.interrupt(true);
|
|
384
|
+
await this._recentScreenRecorder.cleanup();
|
|
385
|
+
this._recentScreenRecorder = null;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
391
|
+
*/
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {retryInterval} from 'asyncbox';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import {errors} from 'appium/driver';
|
|
4
|
+
import {util, imageUtil} from 'appium/support';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @this {XCUITestDriver}
|
|
8
|
+
* @returns {Promise<string>}
|
|
9
|
+
*/
|
|
10
|
+
export async function getScreenshot() {
|
|
11
|
+
if (this.isWebContext()) {
|
|
12
|
+
const webScreenshotMode = (await this.settings.getSettings()).webScreenshotMode;
|
|
13
|
+
switch (_.toLower(webScreenshotMode)) {
|
|
14
|
+
case 'page':
|
|
15
|
+
case 'viewport':
|
|
16
|
+
return await (/** @type {import('appium-remote-debugger').RemoteDebugger} */ (this.remote)).captureScreenshot({
|
|
17
|
+
coordinateSystem: /** @type {'Viewport'|'Page'} */ (_.capitalize(webScreenshotMode)),
|
|
18
|
+
});
|
|
19
|
+
case 'native':
|
|
20
|
+
case undefined:
|
|
21
|
+
case null:
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
this.log.warn(
|
|
25
|
+
`The webScreenshotMode setting value '${webScreenshotMode}' is not known. ` +
|
|
26
|
+
`Supported values are: page, viewport and native. Falling back to the native mode.`
|
|
27
|
+
);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const getScreenshotFromWDA = async () => {
|
|
33
|
+
this.log.debug(`Taking screenshot with WDA`);
|
|
34
|
+
const data = await this.proxyCommand('/screenshot', 'GET');
|
|
35
|
+
if (!_.isString(data)) {
|
|
36
|
+
throw new Error(`Unable to take screenshot. WDA returned '${JSON.stringify(data)}'`);
|
|
37
|
+
}
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// if we've specified an mjpeg server, use that
|
|
42
|
+
if (this.mjpegStream) {
|
|
43
|
+
this.log.info(`mjpeg video stream provided, returning latest frame as screenshot`);
|
|
44
|
+
const data = await this.mjpegStream.lastChunkPNGBase64();
|
|
45
|
+
if (data) {
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
48
|
+
this.log.warn(
|
|
49
|
+
'Tried to get screenshot from active MJPEG stream, but there ' +
|
|
50
|
+
'was no data yet. Falling back to regular screenshot methods.',
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
return await getScreenshotFromWDA();
|
|
56
|
+
} catch (err) {
|
|
57
|
+
this.log.warn(`Error getting screenshot: ${err.message}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// simulator attempt
|
|
61
|
+
if (this.isSimulator()) {
|
|
62
|
+
this.log.info(`Falling back to 'simctl io screenshot' API`);
|
|
63
|
+
const payload = await /** @type {import('../driver').Simulator} */ (this.device).simctl.getScreenshot();
|
|
64
|
+
if (!payload) {
|
|
65
|
+
throw new errors.UnableToCaptureScreen();
|
|
66
|
+
}
|
|
67
|
+
return payload;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Retry for real devices only. Fail fast on Simulator if simctl does not work as expected
|
|
71
|
+
return /** @type {string} */ (await retryInterval(2, 1000, getScreenshotFromWDA));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @this {XCUITestDriver}
|
|
76
|
+
*/
|
|
77
|
+
export async function getElementScreenshot(el) {
|
|
78
|
+
el = util.unwrapElement(el);
|
|
79
|
+
if (this.isWebContext()) {
|
|
80
|
+
const atomsElement = this.getAtomsElement(el);
|
|
81
|
+
const {width, height} = await this.executeAtom('get_size', [atomsElement]);
|
|
82
|
+
if (!width || !height) {
|
|
83
|
+
throw new errors.UnableToCaptureScreen('Cannot take a screenshot of a zero-size element');
|
|
84
|
+
}
|
|
85
|
+
const {x, y} = await this.executeAtom('get_top_left_coordinates', [atomsElement]);
|
|
86
|
+
return await (/** @type {import('appium-remote-debugger').RemoteDebugger} */ (this.remote))
|
|
87
|
+
.captureScreenshot({rect: {x, y, width, height}});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const data = await this.proxyCommand(`/element/${el}/screenshot`, 'GET');
|
|
91
|
+
if (!_.isString(data)) {
|
|
92
|
+
throw new errors.UnableToCaptureScreen(
|
|
93
|
+
`Unable to take an element screenshot. WDA returned: ${JSON.stringify(data)}`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return data;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @this {XCUITestDriver}
|
|
101
|
+
* @returns {Promise<string>}
|
|
102
|
+
*/
|
|
103
|
+
export async function getViewportScreenshot() {
|
|
104
|
+
if (this.isWebContext()) {
|
|
105
|
+
return await (/** @type {import('appium-remote-debugger').RemoteDebugger} */ (this.remote))
|
|
106
|
+
.captureScreenshot();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const screenshot = await this.getScreenshot();
|
|
110
|
+
// if we don't have a status bar, there's nothing to crop, so we can avoid
|
|
111
|
+
// extra calls and return straight away
|
|
112
|
+
if ((await this.getStatusBarHeight()) === 0) {
|
|
113
|
+
return screenshot;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const sharp = imageUtil.requireSharp();
|
|
117
|
+
const {width, height} = await sharp(Buffer.from(screenshot, 'base64')).metadata();
|
|
118
|
+
if (!width || !height) {
|
|
119
|
+
throw new errors.UnableToCaptureScreen('The device screenshot is empty');
|
|
120
|
+
}
|
|
121
|
+
this.log.debug(`Screenshot dimensions: ${width}x${height}`);
|
|
122
|
+
const region = await this.getViewportRect();
|
|
123
|
+
if (region.width + region.left > width) {
|
|
124
|
+
this.log.info('Viewport region exceeds screenshot width, adjusting region to fit');
|
|
125
|
+
region.width = width - region.left;
|
|
126
|
+
}
|
|
127
|
+
if (region.height + region.top > height) {
|
|
128
|
+
this.log.info('Viewport region exceeds screenshot height, adjusting region to fit');
|
|
129
|
+
region.height = height - region.top;
|
|
130
|
+
}
|
|
131
|
+
this.log.debug(`Calculated viewport rect: ${JSON.stringify(region)}`);
|
|
132
|
+
return await imageUtil.cropBase64Image(screenshot, region);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
137
|
+
*/
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { errors } from 'appium/driver';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* List of subcommands for `simctl` we provide as mobile simctl command.
|
|
5
|
+
* They accept 'device' target.
|
|
6
|
+
*/
|
|
7
|
+
const SUBCOMMANDS_HAS_DEVICE = [
|
|
8
|
+
'boot',
|
|
9
|
+
'get_app_container',
|
|
10
|
+
'getenv',
|
|
11
|
+
'icloud_sync',
|
|
12
|
+
'install',
|
|
13
|
+
'install_app_data',
|
|
14
|
+
'io',
|
|
15
|
+
'keychain',
|
|
16
|
+
'launch',
|
|
17
|
+
'location',
|
|
18
|
+
'logverbose',
|
|
19
|
+
'openurl',
|
|
20
|
+
'pbcopy',
|
|
21
|
+
'pbpaste',
|
|
22
|
+
'privacy',
|
|
23
|
+
'push',
|
|
24
|
+
'shutdown',
|
|
25
|
+
'spawn',
|
|
26
|
+
'status_bar',
|
|
27
|
+
'terminate',
|
|
28
|
+
'ui',
|
|
29
|
+
'uninstall'
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Run the given command with arguments as `xcrun simctl` subcommand.
|
|
34
|
+
* This method works behind the 'simctl' security flag.
|
|
35
|
+
* @this {XCUITestDriver}
|
|
36
|
+
* @param {string} command Subcommand to run with `xcrun simctl`
|
|
37
|
+
* @param {string[]} [args=[]] arguments for the subcommand. The arguments should be after <device> in the help.
|
|
38
|
+
* @param {number|undefined} timeout - The maximum number of milliseconds
|
|
39
|
+
* @returns {Promise<SimctlExecResponse>}
|
|
40
|
+
* @throws {Error} If the simctl subcommand command returns non-zero return code, or the given subcommand was invalid.
|
|
41
|
+
*/
|
|
42
|
+
export async function mobileSimctl(command, args = [], timeout = undefined) {
|
|
43
|
+
if (!this.isSimulator()) {
|
|
44
|
+
throw new errors.UnsupportedOperationError(`Only simulator is supported.`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!this.opts.udid) {
|
|
48
|
+
throw new errors.InvalidArgumentError(`Unknown device or simulator UDID: '${this.opts.udid}'`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!SUBCOMMANDS_HAS_DEVICE.includes(command)) {
|
|
52
|
+
throw new errors.InvalidArgumentError(`The given command '${command}' is not supported. ` +
|
|
53
|
+
`Available subcommands are ${SUBCOMMANDS_HAS_DEVICE.join(',')}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return await /** @type {import('./../driver').Simulator} */ (this.device).simctl.exec(
|
|
57
|
+
command,
|
|
58
|
+
{args: [this.opts.udid, ...args], timeout}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @typedef {Object} SimctlExecResponse
|
|
64
|
+
* @property {Buffer<ArrayBufferLike>} stdout The output of standard out.
|
|
65
|
+
* @property {Buffer<ArrayBufferLike>} stderr The output of standard error.
|
|
66
|
+
* @property {number} code Return code.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
71
|
+
*/
|