@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,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ScreenRecorder = void 0;
|
|
7
|
+
exports.startRecordingScreen = startRecordingScreen;
|
|
8
|
+
exports.stopRecordingScreen = stopRecordingScreen;
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
+
const support_1 = require("appium/support");
|
|
11
|
+
const teen_process_1 = require("teen_process");
|
|
12
|
+
const utils_1 = require("../utils");
|
|
13
|
+
const appium_webdriveragent_1 = require("appium-webdriveragent");
|
|
14
|
+
const asyncbox_1 = require("asyncbox");
|
|
15
|
+
const url_1 = __importDefault(require("url"));
|
|
16
|
+
/**
|
|
17
|
+
* Set max timeout for 'reconnect_delay_max' ffmpeg argument usage.
|
|
18
|
+
* It could have [0-4294] range limitation, thus this value should be less than that right now
|
|
19
|
+
* to return a better error message.
|
|
20
|
+
*/
|
|
21
|
+
const MAX_RECORDING_TIME_SEC = 4200;
|
|
22
|
+
const DEFAULT_RECORDING_TIME_SEC = 60 * 3;
|
|
23
|
+
const DEFAULT_FPS = 10;
|
|
24
|
+
const DEFAULT_QUALITY = 'medium';
|
|
25
|
+
const DEFAULT_MJPEG_SERVER_PORT = 9100;
|
|
26
|
+
const DEFAULT_VCODEC = 'mjpeg';
|
|
27
|
+
const MP4_EXT = '.mp4';
|
|
28
|
+
const FFMPEG_BINARY = 'ffmpeg';
|
|
29
|
+
const ffmpegLogger = support_1.logger.getLogger(FFMPEG_BINARY);
|
|
30
|
+
const QUALITY_MAPPING = {
|
|
31
|
+
low: 10,
|
|
32
|
+
medium: 25,
|
|
33
|
+
high: 75,
|
|
34
|
+
photo: 100,
|
|
35
|
+
};
|
|
36
|
+
const HARDWARE_ACCELERATION_PARAMETERS = {
|
|
37
|
+
/* https://trac.ffmpeg.org/wiki/HWAccelIntro#VideoToolbox */
|
|
38
|
+
videoToolbox: {
|
|
39
|
+
hwaccel: 'videotoolbox',
|
|
40
|
+
hwaccelOutputFormat: 'videotoolbox_vld',
|
|
41
|
+
scaleFilterHWAccel: 'scale_vt',
|
|
42
|
+
videoTypeHWAccel: 'h264_videotoolbox',
|
|
43
|
+
},
|
|
44
|
+
/* https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDANVENCNVDEC */
|
|
45
|
+
cuda: {
|
|
46
|
+
hwaccel: 'cuda',
|
|
47
|
+
hwaccelOutputFormat: 'cuda',
|
|
48
|
+
scaleFilterHWAccel: 'scale_cuda',
|
|
49
|
+
videoTypeHWAccel: 'h264_nvenc',
|
|
50
|
+
},
|
|
51
|
+
/* https://trac.ffmpeg.org/wiki/Hardware/AMF */
|
|
52
|
+
amf_dx11: {
|
|
53
|
+
hwaccel: 'd3d11va',
|
|
54
|
+
hwaccelOutputFormat: 'd3d11',
|
|
55
|
+
scaleFilterHWAccel: 'scale',
|
|
56
|
+
videoTypeHWAccel: 'av1_amf',
|
|
57
|
+
},
|
|
58
|
+
/* https://trac.ffmpeg.org/wiki/Hardware/QuickSync */
|
|
59
|
+
qsv: {
|
|
60
|
+
hwaccel: 'qsv',
|
|
61
|
+
hwaccelOutputFormat: '',
|
|
62
|
+
scaleFilterHWAccel: 'scale_qsv',
|
|
63
|
+
videoTypeHWAccel: 'h264_qsv'
|
|
64
|
+
},
|
|
65
|
+
/* https://trac.ffmpeg.org/wiki/Hardware/VAAPI */
|
|
66
|
+
vaapi: {
|
|
67
|
+
hwaccel: 'vaapi',
|
|
68
|
+
hwaccelOutputFormat: 'vaapi',
|
|
69
|
+
scaleFilterHWAccel: 'scale_vaapi',
|
|
70
|
+
videoTypeHWAccel: 'h264_vaapi'
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const CAPTURE_START_MARKER = /^\s*frame=/;
|
|
74
|
+
class ScreenRecorder {
|
|
75
|
+
constructor(udid, log, videoPath, opts = {}) {
|
|
76
|
+
this.videoPath = videoPath;
|
|
77
|
+
this.log = log;
|
|
78
|
+
this.opts = opts;
|
|
79
|
+
this.udid = udid;
|
|
80
|
+
this.mainProcess = null;
|
|
81
|
+
this.timeoutHandler = null;
|
|
82
|
+
}
|
|
83
|
+
async start(timeoutMs) {
|
|
84
|
+
try {
|
|
85
|
+
await support_1.fs.which(FFMPEG_BINARY);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
throw new Error(`'${FFMPEG_BINARY}' binary is not found in PATH. Install it using 'brew install ffmpeg'. ` +
|
|
89
|
+
`Check https://www.ffmpeg.org/download.html for more details.`);
|
|
90
|
+
}
|
|
91
|
+
const { hardwareAcceleration, remotePort, remoteUrl, videoFps, videoType, videoScale, videoFilters, pixelFormat, } = this.opts;
|
|
92
|
+
const args = [
|
|
93
|
+
'-f',
|
|
94
|
+
'mjpeg',
|
|
95
|
+
// https://github.com/appium/appium/issues/16294
|
|
96
|
+
'-reconnect',
|
|
97
|
+
'1',
|
|
98
|
+
'-reconnect_at_eof',
|
|
99
|
+
'1',
|
|
100
|
+
'-reconnect_streamed',
|
|
101
|
+
'1',
|
|
102
|
+
'-reconnect_delay_max',
|
|
103
|
+
`${timeoutMs / 1000 + 1}`,
|
|
104
|
+
];
|
|
105
|
+
const { hwaccel, hwaccelOutputFormat, scaleFilterHWAccel, videoTypeHWAccel } = HARDWARE_ACCELERATION_PARAMETERS[hardwareAcceleration] ?? {};
|
|
106
|
+
if (hwaccel) {
|
|
107
|
+
args.push('-hwaccel', hwaccel);
|
|
108
|
+
}
|
|
109
|
+
if (hwaccelOutputFormat) {
|
|
110
|
+
args.push('-hwaccel_output_format', hwaccelOutputFormat);
|
|
111
|
+
}
|
|
112
|
+
//Parameter `-r` is optional. See details: https://github.com/appium/appium/issues/12067
|
|
113
|
+
if (videoFps && videoType === 'libx264' || videoTypeHWAccel) {
|
|
114
|
+
args.push('-r', videoFps);
|
|
115
|
+
}
|
|
116
|
+
const { protocol, hostname } = url_1.default.parse(remoteUrl);
|
|
117
|
+
args.push('-i', `${protocol}//${hostname}:${remotePort}`);
|
|
118
|
+
if (videoFilters || videoScale) {
|
|
119
|
+
args.push('-vf', videoFilters || `${scaleFilterHWAccel || 'scale'}=${videoScale}`);
|
|
120
|
+
}
|
|
121
|
+
// Quicktime compatibility via pixelFormat: 'yuv420p'
|
|
122
|
+
if (pixelFormat) {
|
|
123
|
+
args.push('-pix_fmt', pixelFormat);
|
|
124
|
+
}
|
|
125
|
+
args.push('-vcodec', videoTypeHWAccel || videoType);
|
|
126
|
+
args.push('-y');
|
|
127
|
+
args.push(this.videoPath);
|
|
128
|
+
this.mainProcess = new teen_process_1.SubProcess(FFMPEG_BINARY, args);
|
|
129
|
+
let isCaptureStarted = false;
|
|
130
|
+
this.mainProcess.on('line-stderr', (line) => {
|
|
131
|
+
if (CAPTURE_START_MARKER.test(line)) {
|
|
132
|
+
if (!isCaptureStarted) {
|
|
133
|
+
isCaptureStarted = true;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
ffmpegLogger.info(line);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
await this.mainProcess.start(0);
|
|
141
|
+
const startupTimeout = 5000;
|
|
142
|
+
try {
|
|
143
|
+
await (0, asyncbox_1.waitForCondition)(() => isCaptureStarted, {
|
|
144
|
+
waitMs: startupTimeout,
|
|
145
|
+
intervalMs: 300,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
this.log.warn(`Screen capture process did not start within ${startupTimeout}ms. Continuing anyway`);
|
|
150
|
+
}
|
|
151
|
+
if (!this.mainProcess.isRunning) {
|
|
152
|
+
throw new Error(`The screen capture process '${FFMPEG_BINARY}' died unexpectedly. ` +
|
|
153
|
+
`Check server logs for more details`);
|
|
154
|
+
}
|
|
155
|
+
this.log.info(`Starting screen capture on the device '${this.udid}' with command: '${FFMPEG_BINARY} ${args.join(' ')}'. ` + `Will timeout in ${timeoutMs}ms`);
|
|
156
|
+
this.timeoutHandler = setTimeout(async () => {
|
|
157
|
+
if (!(await this.interrupt())) {
|
|
158
|
+
this.log.warn(`Cannot finish the active screen recording on the device '${this.udid}' after ${timeoutMs}ms timeout`);
|
|
159
|
+
}
|
|
160
|
+
}, timeoutMs);
|
|
161
|
+
}
|
|
162
|
+
async interrupt(force = false) {
|
|
163
|
+
let result = true;
|
|
164
|
+
if (this.timeoutHandler) {
|
|
165
|
+
clearTimeout(this.timeoutHandler);
|
|
166
|
+
this.timeoutHandler = null;
|
|
167
|
+
}
|
|
168
|
+
if (this.mainProcess?.isRunning) {
|
|
169
|
+
const interruptPromise = this.mainProcess.stop(force ? 'SIGTERM' : 'SIGINT');
|
|
170
|
+
this.mainProcess = null;
|
|
171
|
+
try {
|
|
172
|
+
await interruptPromise;
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
this.log.warn(`Cannot ${force ? 'terminate' : 'interrupt'} ${FFMPEG_BINARY}. ` +
|
|
176
|
+
`Original error: ${e.message}`);
|
|
177
|
+
result = false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return result;
|
|
181
|
+
}
|
|
182
|
+
async finish() {
|
|
183
|
+
await this.interrupt();
|
|
184
|
+
return this.videoPath;
|
|
185
|
+
}
|
|
186
|
+
async cleanup() {
|
|
187
|
+
if (await support_1.fs.exists(this.videoPath)) {
|
|
188
|
+
await support_1.fs.rimraf(this.videoPath);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.ScreenRecorder = ScreenRecorder;
|
|
193
|
+
/**
|
|
194
|
+
* Direct Appium to start recording the device screen
|
|
195
|
+
*
|
|
196
|
+
* Record the display of devices running iOS Simulator since Xcode 9 or real devices since iOS 11
|
|
197
|
+
* (ffmpeg utility is required: 'brew install ffmpeg').
|
|
198
|
+
* It records screen activity to a MPEG-4 file. Audio is not recorded with the video file.
|
|
199
|
+
* If screen recording has been already started then the command will stop it forcefully and start a new one.
|
|
200
|
+
* The previously recorded video file will be deleted.
|
|
201
|
+
*
|
|
202
|
+
* @param {import('./types').StartRecordingScreenOptions} [options] - The available options.
|
|
203
|
+
* @returns {Promise<string>} Base64-encoded content of the recorded media file if
|
|
204
|
+
* any screen recording is currently running or an empty string.
|
|
205
|
+
* @throws {Error} If screen recording has failed to start.
|
|
206
|
+
* @this {XCUITestDriver}
|
|
207
|
+
*/
|
|
208
|
+
async function startRecordingScreen(options = {}) {
|
|
209
|
+
const { videoType = DEFAULT_VCODEC, timeLimit = DEFAULT_RECORDING_TIME_SEC, videoQuality = DEFAULT_QUALITY, videoFps = DEFAULT_FPS, videoFilters, videoScale, forceRestart, pixelFormat, hardwareAcceleration } = options;
|
|
210
|
+
let result = '';
|
|
211
|
+
if (!forceRestart) {
|
|
212
|
+
this.log.info(`Checking if there is/was a previous screen recording. ` +
|
|
213
|
+
`Set 'forceRestart' option to 'true' if you'd like to skip this step.`);
|
|
214
|
+
result = (await this.stopRecordingScreen(options)) ?? result;
|
|
215
|
+
}
|
|
216
|
+
const videoPath = await support_1.tempDir.path({
|
|
217
|
+
prefix: `appium_${Math.random().toString(16).substring(2, 8)}`,
|
|
218
|
+
suffix: MP4_EXT
|
|
219
|
+
});
|
|
220
|
+
const wdaBaseUrl = this.opts.wdaBaseUrl || appium_webdriveragent_1.WDA_BASE_URL;
|
|
221
|
+
const screenRecorder = new ScreenRecorder(this.device.udid, this.log, videoPath, {
|
|
222
|
+
remotePort: this.opts.mjpegServerPort || DEFAULT_MJPEG_SERVER_PORT,
|
|
223
|
+
remoteUrl: wdaBaseUrl,
|
|
224
|
+
videoType,
|
|
225
|
+
videoFilters,
|
|
226
|
+
videoScale,
|
|
227
|
+
videoFps,
|
|
228
|
+
pixelFormat,
|
|
229
|
+
hardwareAcceleration
|
|
230
|
+
});
|
|
231
|
+
if (!(await screenRecorder.interrupt(true))) {
|
|
232
|
+
throw this.log.errorWithException('Unable to stop screen recording process');
|
|
233
|
+
}
|
|
234
|
+
if (this._recentScreenRecorder) {
|
|
235
|
+
await this._recentScreenRecorder.cleanup();
|
|
236
|
+
this._recentScreenRecorder = null;
|
|
237
|
+
}
|
|
238
|
+
const timeoutSeconds = parseFloat(String(timeLimit));
|
|
239
|
+
if (isNaN(timeoutSeconds) || timeoutSeconds > MAX_RECORDING_TIME_SEC || timeoutSeconds <= 0) {
|
|
240
|
+
throw this.log.errorWithException(`The timeLimit value must be in range [1, ${MAX_RECORDING_TIME_SEC}] seconds. ` +
|
|
241
|
+
`The value of '${timeLimit}' has been passed instead.`);
|
|
242
|
+
}
|
|
243
|
+
let { mjpegServerScreenshotQuality, mjpegServerFramerate } =
|
|
244
|
+
/** @type {import('appium-webdriveragent').WDASettings} */ (await this.proxyCommand('/appium/settings', 'GET'));
|
|
245
|
+
if (videoQuality) {
|
|
246
|
+
const quality = lodash_1.default.isInteger(videoQuality)
|
|
247
|
+
? videoQuality
|
|
248
|
+
: QUALITY_MAPPING[lodash_1.default.toLower(String(videoQuality))];
|
|
249
|
+
if (!quality) {
|
|
250
|
+
throw new Error(`videoQuality value should be one of ${JSON.stringify(lodash_1.default.keys(QUALITY_MAPPING))} or a number in range 1..100. ` + `'${videoQuality}' is given instead`);
|
|
251
|
+
}
|
|
252
|
+
mjpegServerScreenshotQuality = mjpegServerScreenshotQuality !== quality ? quality : undefined;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
mjpegServerScreenshotQuality = undefined;
|
|
256
|
+
}
|
|
257
|
+
if (videoFps) {
|
|
258
|
+
const fps = parseInt(String(videoFps), 10);
|
|
259
|
+
if (isNaN(fps)) {
|
|
260
|
+
throw new Error(`videoFps value should be a valid number in range 1..60. ` +
|
|
261
|
+
`'${videoFps}' is given instead`);
|
|
262
|
+
}
|
|
263
|
+
mjpegServerFramerate = mjpegServerFramerate !== fps ? fps : undefined;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
mjpegServerFramerate = undefined;
|
|
267
|
+
}
|
|
268
|
+
if (support_1.util.hasValue(mjpegServerScreenshotQuality) || support_1.util.hasValue(mjpegServerFramerate)) {
|
|
269
|
+
await this.proxyCommand('/appium/settings', 'POST', {
|
|
270
|
+
settings: {
|
|
271
|
+
mjpegServerScreenshotQuality,
|
|
272
|
+
mjpegServerFramerate
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
try {
|
|
277
|
+
await screenRecorder.start(timeoutSeconds * 1000);
|
|
278
|
+
}
|
|
279
|
+
catch (e) {
|
|
280
|
+
await screenRecorder.interrupt(true);
|
|
281
|
+
await screenRecorder.cleanup();
|
|
282
|
+
throw e;
|
|
283
|
+
}
|
|
284
|
+
this._recentScreenRecorder = screenRecorder;
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Direct Appium to stop screen recording and return the video
|
|
289
|
+
*
|
|
290
|
+
* If no screen recording process is running then the endpoint will try to get
|
|
291
|
+
* the recently recorded file. If no previously recorded file is found and no
|
|
292
|
+
* active screen recording processes are running then the method returns an
|
|
293
|
+
* empty string.
|
|
294
|
+
*
|
|
295
|
+
* @param {import('./types').StopRecordingScreenOptions} options - The available
|
|
296
|
+
* options.
|
|
297
|
+
* @returns {Promise<string?>} Base64-encoded content of the recorded media
|
|
298
|
+
* file if `remotePath` parameter is empty or null or an empty string.
|
|
299
|
+
* @throws {Error} If there was an error while getting the name of a media
|
|
300
|
+
* file or the file content cannot be uploaded to the remote
|
|
301
|
+
* location.
|
|
302
|
+
* @this {XCUITestDriver}
|
|
303
|
+
*/
|
|
304
|
+
async function stopRecordingScreen(options = {}) {
|
|
305
|
+
if (!this._recentScreenRecorder) {
|
|
306
|
+
this.log.info('Screen recording is not running. There is nothing to stop.');
|
|
307
|
+
return '';
|
|
308
|
+
}
|
|
309
|
+
try {
|
|
310
|
+
const videoPath = await this._recentScreenRecorder.finish();
|
|
311
|
+
if (!(await support_1.fs.exists(videoPath))) {
|
|
312
|
+
throw this.log.errorWithException(`The screen recorder utility has failed ` +
|
|
313
|
+
`to store the actual screen recording at '${videoPath}'`);
|
|
314
|
+
}
|
|
315
|
+
return await (0, utils_1.encodeBase64OrUpload)(videoPath, options.remotePath, options);
|
|
316
|
+
}
|
|
317
|
+
finally {
|
|
318
|
+
await this._recentScreenRecorder.interrupt(true);
|
|
319
|
+
await this._recentScreenRecorder.cleanup();
|
|
320
|
+
this._recentScreenRecorder = null;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
325
|
+
*/
|
|
326
|
+
//# sourceMappingURL=recordscreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recordscreen.js","sourceRoot":"","sources":["../../../lib/commands/recordscreen.js"],"names":[],"mappings":";;;;;;AAmPA,oDAwGC;AAmBD,kDAoBC;AAlYD,oDAAuB;AACvB,4CAAyD;AACzD,+CAAwC;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SAAS,CAAC,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAC/B,yCAAyC;gBACzC,4CAA4C,SAAS,GAAG,CACzD,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,IAAA,4BAAoB,EAAC,SAAS,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACpC,CAAC;AACH,CAAC;AAED;;GAEG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @this {XCUITestDriver}
|
|
3
|
+
* @returns {Promise<string>}
|
|
4
|
+
*/
|
|
5
|
+
export function getScreenshot(this: import("../driver").XCUITestDriver): Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* @this {XCUITestDriver}
|
|
8
|
+
*/
|
|
9
|
+
export function getElementScreenshot(this: import("../driver").XCUITestDriver, el: any): Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* @this {XCUITestDriver}
|
|
12
|
+
* @returns {Promise<string>}
|
|
13
|
+
*/
|
|
14
|
+
export function getViewportScreenshot(this: import("../driver").XCUITestDriver): Promise<string>;
|
|
15
|
+
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
16
|
+
//# sourceMappingURL=screenshots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenshots.d.ts","sourceRoot":"","sources":["../../../lib/commands/screenshots.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH,yEAFa,OAAO,CAAC,MAAM,CAAC,CAgE3B;AAED;;GAEG;AACH,yGAoBC;AAED;;;GAGG;AACH,iFAFa,OAAO,CAAC,MAAM,CAAC,CAgC3B;6BAGY,OAAO,WAAW,EAAE,cAAc"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getScreenshot = getScreenshot;
|
|
7
|
+
exports.getElementScreenshot = getElementScreenshot;
|
|
8
|
+
exports.getViewportScreenshot = getViewportScreenshot;
|
|
9
|
+
const asyncbox_1 = require("asyncbox");
|
|
10
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
+
const driver_1 = require("appium/driver");
|
|
12
|
+
const support_1 = require("appium/support");
|
|
13
|
+
/**
|
|
14
|
+
* @this {XCUITestDriver}
|
|
15
|
+
* @returns {Promise<string>}
|
|
16
|
+
*/
|
|
17
|
+
async function getScreenshot() {
|
|
18
|
+
if (this.isWebContext()) {
|
|
19
|
+
const webScreenshotMode = (await this.settings.getSettings()).webScreenshotMode;
|
|
20
|
+
switch (lodash_1.default.toLower(webScreenshotMode)) {
|
|
21
|
+
case 'page':
|
|
22
|
+
case 'viewport':
|
|
23
|
+
return await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote)).captureScreenshot({
|
|
24
|
+
coordinateSystem: /** @type {'Viewport'|'Page'} */ (lodash_1.default.capitalize(webScreenshotMode)),
|
|
25
|
+
});
|
|
26
|
+
case 'native':
|
|
27
|
+
case undefined:
|
|
28
|
+
case null:
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
this.log.warn(`The webScreenshotMode setting value '${webScreenshotMode}' is not known. ` +
|
|
32
|
+
`Supported values are: page, viewport and native. Falling back to the native mode.`);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const getScreenshotFromWDA = async () => {
|
|
37
|
+
this.log.debug(`Taking screenshot with WDA`);
|
|
38
|
+
const data = await this.proxyCommand('/screenshot', 'GET');
|
|
39
|
+
if (!lodash_1.default.isString(data)) {
|
|
40
|
+
throw new Error(`Unable to take screenshot. WDA returned '${JSON.stringify(data)}'`);
|
|
41
|
+
}
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
// if we've specified an mjpeg server, use that
|
|
45
|
+
if (this.mjpegStream) {
|
|
46
|
+
this.log.info(`mjpeg video stream provided, returning latest frame as screenshot`);
|
|
47
|
+
const data = await this.mjpegStream.lastChunkPNGBase64();
|
|
48
|
+
if (data) {
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
this.log.warn('Tried to get screenshot from active MJPEG stream, but there ' +
|
|
52
|
+
'was no data yet. Falling back to regular screenshot methods.');
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
return await getScreenshotFromWDA();
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
this.log.warn(`Error getting screenshot: ${err.message}`);
|
|
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 driver_1.errors.UnableToCaptureScreen();
|
|
66
|
+
}
|
|
67
|
+
return payload;
|
|
68
|
+
}
|
|
69
|
+
// Retry for real devices only. Fail fast on Simulator if simctl does not work as expected
|
|
70
|
+
return /** @type {string} */ (await (0, asyncbox_1.retryInterval)(2, 1000, getScreenshotFromWDA));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @this {XCUITestDriver}
|
|
74
|
+
*/
|
|
75
|
+
async function getElementScreenshot(el) {
|
|
76
|
+
el = support_1.util.unwrapElement(el);
|
|
77
|
+
if (this.isWebContext()) {
|
|
78
|
+
const atomsElement = this.getAtomsElement(el);
|
|
79
|
+
const { width, height } = await this.executeAtom('get_size', [atomsElement]);
|
|
80
|
+
if (!width || !height) {
|
|
81
|
+
throw new driver_1.errors.UnableToCaptureScreen('Cannot take a screenshot of a zero-size element');
|
|
82
|
+
}
|
|
83
|
+
const { x, y } = await this.executeAtom('get_top_left_coordinates', [atomsElement]);
|
|
84
|
+
return await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote))
|
|
85
|
+
.captureScreenshot({ rect: { x, y, width, height } });
|
|
86
|
+
}
|
|
87
|
+
const data = await this.proxyCommand(`/element/${el}/screenshot`, 'GET');
|
|
88
|
+
if (!lodash_1.default.isString(data)) {
|
|
89
|
+
throw new driver_1.errors.UnableToCaptureScreen(`Unable to take an element screenshot. WDA returned: ${JSON.stringify(data)}`);
|
|
90
|
+
}
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @this {XCUITestDriver}
|
|
95
|
+
* @returns {Promise<string>}
|
|
96
|
+
*/
|
|
97
|
+
async function getViewportScreenshot() {
|
|
98
|
+
if (this.isWebContext()) {
|
|
99
|
+
return await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote))
|
|
100
|
+
.captureScreenshot();
|
|
101
|
+
}
|
|
102
|
+
const screenshot = await this.getScreenshot();
|
|
103
|
+
// if we don't have a status bar, there's nothing to crop, so we can avoid
|
|
104
|
+
// extra calls and return straight away
|
|
105
|
+
if ((await this.getStatusBarHeight()) === 0) {
|
|
106
|
+
return screenshot;
|
|
107
|
+
}
|
|
108
|
+
const sharp = support_1.imageUtil.requireSharp();
|
|
109
|
+
const { width, height } = await sharp(Buffer.from(screenshot, 'base64')).metadata();
|
|
110
|
+
if (!width || !height) {
|
|
111
|
+
throw new driver_1.errors.UnableToCaptureScreen('The device screenshot is empty');
|
|
112
|
+
}
|
|
113
|
+
this.log.debug(`Screenshot dimensions: ${width}x${height}`);
|
|
114
|
+
const region = await this.getViewportRect();
|
|
115
|
+
if (region.width + region.left > width) {
|
|
116
|
+
this.log.info('Viewport region exceeds screenshot width, adjusting region to fit');
|
|
117
|
+
region.width = width - region.left;
|
|
118
|
+
}
|
|
119
|
+
if (region.height + region.top > height) {
|
|
120
|
+
this.log.info('Viewport region exceeds screenshot height, adjusting region to fit');
|
|
121
|
+
region.height = height - region.top;
|
|
122
|
+
}
|
|
123
|
+
this.log.debug(`Calculated viewport rect: ${JSON.stringify(region)}`);
|
|
124
|
+
return await support_1.imageUtil.cropBase64Image(screenshot, region);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
128
|
+
*/
|
|
129
|
+
//# sourceMappingURL=screenshots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenshots.js","sourceRoot":"","sources":["../../../lib/commands/screenshots.js"],"names":[],"mappings":";;;;;AASA,sCA8DC;AAKD,oDAoBC;AAMD,sDA8BC;AApID,uCAAuC;AACvC,oDAAuB;AACvB,0CAAqC;AACrC,4CAA+C;AAE/C;;;GAGG;AACI,KAAK,UAAU,aAAa;IACjC,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,MAAM,iBAAiB,GAAG,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,iBAAiB,CAAC;QAChF,QAAQ,gBAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACrC,KAAK,MAAM,CAAC;YACZ,KAAK,UAAU;gBACb,OAAO,MAAM,EAAC,8DAA+D,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC;oBAC5G,gBAAgB,EAAE,gCAAgC,CAAC,CAAC,gBAAC,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;iBACrF,CAAC,CAAC;YACL,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,IAAI;gBACP,MAAM;YACR;gBACE,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,wC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GAAG,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;IACrC,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,GAAG,MAAM,EAAE,CAAC;QACxC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;QACpF,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC;IACtC,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,6BAA6B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtE,OAAO,MAAM,mBAAS,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run the given command with arguments as `xcrun simctl` subcommand.
|
|
3
|
+
* This method works behind the 'simctl' security flag.
|
|
4
|
+
* @this {XCUITestDriver}
|
|
5
|
+
* @param {string} command Subcommand to run with `xcrun simctl`
|
|
6
|
+
* @param {string[]} [args=[]] arguments for the subcommand. The arguments should be after <device> in the help.
|
|
7
|
+
* @param {number|undefined} timeout - The maximum number of milliseconds
|
|
8
|
+
* @returns {Promise<SimctlExecResponse>}
|
|
9
|
+
* @throws {Error} If the simctl subcommand command returns non-zero return code, or the given subcommand was invalid.
|
|
10
|
+
*/
|
|
11
|
+
export function mobileSimctl(this: import("./../driver").XCUITestDriver, command: string, args?: string[], timeout?: number | undefined): Promise<SimctlExecResponse>;
|
|
12
|
+
export type SimctlExecResponse = {
|
|
13
|
+
/**
|
|
14
|
+
* The output of standard out.
|
|
15
|
+
*/
|
|
16
|
+
stdout: Buffer<ArrayBufferLike>;
|
|
17
|
+
/**
|
|
18
|
+
* The output of standard error.
|
|
19
|
+
*/
|
|
20
|
+
stderr: Buffer<ArrayBufferLike>;
|
|
21
|
+
/**
|
|
22
|
+
* Return code.
|
|
23
|
+
*/
|
|
24
|
+
code: number;
|
|
25
|
+
};
|
|
26
|
+
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
27
|
+
//# sourceMappingURL=simctl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simctl.d.ts","sourceRoot":"","sources":["../../../lib/commands/simctl.js"],"names":[],"mappings":"AA+BA;;;;;;;;;GASG;AACH,kFANW,MAAM,SACN,MAAM,EAAE,YACR,MAAM,GAAC,SAAS,GACd,OAAO,CAAC,kBAAkB,CAAC,CAqBvC;;;;;YAIa,MAAM,CAAC,eAAe,CAAC;;;;YACvB,MAAM,CAAC,eAAe,CAAC;;;;UACvB,MAAM;;6BAIP,OAAO,WAAW,EAAE,cAAc"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mobileSimctl = mobileSimctl;
|
|
4
|
+
const driver_1 = require("appium/driver");
|
|
5
|
+
/**
|
|
6
|
+
* List of subcommands for `simctl` we provide as mobile simctl command.
|
|
7
|
+
* They accept 'device' target.
|
|
8
|
+
*/
|
|
9
|
+
const SUBCOMMANDS_HAS_DEVICE = [
|
|
10
|
+
'boot',
|
|
11
|
+
'get_app_container',
|
|
12
|
+
'getenv',
|
|
13
|
+
'icloud_sync',
|
|
14
|
+
'install',
|
|
15
|
+
'install_app_data',
|
|
16
|
+
'io',
|
|
17
|
+
'keychain',
|
|
18
|
+
'launch',
|
|
19
|
+
'location',
|
|
20
|
+
'logverbose',
|
|
21
|
+
'openurl',
|
|
22
|
+
'pbcopy',
|
|
23
|
+
'pbpaste',
|
|
24
|
+
'privacy',
|
|
25
|
+
'push',
|
|
26
|
+
'shutdown',
|
|
27
|
+
'spawn',
|
|
28
|
+
'status_bar',
|
|
29
|
+
'terminate',
|
|
30
|
+
'ui',
|
|
31
|
+
'uninstall'
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Run the given command with arguments as `xcrun simctl` subcommand.
|
|
35
|
+
* This method works behind the 'simctl' security flag.
|
|
36
|
+
* @this {XCUITestDriver}
|
|
37
|
+
* @param {string} command Subcommand to run with `xcrun simctl`
|
|
38
|
+
* @param {string[]} [args=[]] arguments for the subcommand. The arguments should be after <device> in the help.
|
|
39
|
+
* @param {number|undefined} timeout - The maximum number of milliseconds
|
|
40
|
+
* @returns {Promise<SimctlExecResponse>}
|
|
41
|
+
* @throws {Error} If the simctl subcommand command returns non-zero return code, or the given subcommand was invalid.
|
|
42
|
+
*/
|
|
43
|
+
async function mobileSimctl(command, args = [], timeout = undefined) {
|
|
44
|
+
if (!this.isSimulator()) {
|
|
45
|
+
throw new driver_1.errors.UnsupportedOperationError(`Only simulator is supported.`);
|
|
46
|
+
}
|
|
47
|
+
if (!this.opts.udid) {
|
|
48
|
+
throw new driver_1.errors.InvalidArgumentError(`Unknown device or simulator UDID: '${this.opts.udid}'`);
|
|
49
|
+
}
|
|
50
|
+
if (!SUBCOMMANDS_HAS_DEVICE.includes(command)) {
|
|
51
|
+
throw new driver_1.errors.InvalidArgumentError(`The given command '${command}' is not supported. ` +
|
|
52
|
+
`Available subcommands are ${SUBCOMMANDS_HAS_DEVICE.join(',')}`);
|
|
53
|
+
}
|
|
54
|
+
return await /** @type {import('./../driver').Simulator} */ (this.device).simctl.exec(command, { args: [this.opts.udid, ...args], timeout });
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @typedef {Object} SimctlExecResponse
|
|
58
|
+
* @property {Buffer<ArrayBufferLike>} stdout The output of standard out.
|
|
59
|
+
* @property {Buffer<ArrayBufferLike>} stderr The output of standard error.
|
|
60
|
+
* @property {number} code Return code.
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
64
|
+
*/
|
|
65
|
+
//# sourceMappingURL=simctl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim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AC;AACJ,CAAC;AAED;;;;;GAKG;AAEH;;GAEG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @this {XCUITestDriver}
|
|
3
|
+
*/
|
|
4
|
+
export function getPageSource(this: import("../driver").XCUITestDriver): Promise<any>;
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve the source tree of the current page in XML or JSON format.
|
|
7
|
+
*
|
|
8
|
+
* @param {import('./types').SourceFormat} format - Page tree source representation format.
|
|
9
|
+
* @param {string} [excludedAttributes] A comma-separated string of attribute names to exclude from the output. Only works if `format` is `xml`.
|
|
10
|
+
* @privateRemarks Why isn't `excludedAttributes` an array?
|
|
11
|
+
* @returns {Promise<string>} The source tree of the current page in the given format.
|
|
12
|
+
* @this {XCUITestDriver}
|
|
13
|
+
*/
|
|
14
|
+
export function mobileGetSource(this: import("../driver").XCUITestDriver, format?: import("./types").SourceFormat, excludedAttributes?: string): Promise<string>;
|
|
15
|
+
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
16
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../lib/commands/source.js"],"names":[],"mappings":"AAKA;;GAEG;AACH,sFAiBC;AAED;;;;;;;;GAQG;AACH,mFANW,OAAO,SAAS,EAAE,YAAY,uBAC9B,MAAM,GAEJ,OAAO,CAAC,MAAM,CAAC,CAe3B;6BAiFY,OAAO,WAAW,EAAE,cAAc"}
|