@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,657 @@
|
|
|
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.SUPPORTED_EXTENSIONS = exports.IPA_EXT = exports.APP_EXT = exports.SAFARI_BUNDLE_ID = void 0;
|
|
7
|
+
exports.verifyApplicationPlatform = verifyApplicationPlatform;
|
|
8
|
+
exports.parseLocalizableStrings = parseLocalizableStrings;
|
|
9
|
+
exports.unzipFile = unzipFile;
|
|
10
|
+
exports.unzipStream = unzipStream;
|
|
11
|
+
exports.buildSafariPreferences = buildSafariPreferences;
|
|
12
|
+
exports.onDownloadApp = onDownloadApp;
|
|
13
|
+
exports.onPostConfigureApp = onPostConfigureApp;
|
|
14
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const support_1 = require("appium/support");
|
|
17
|
+
const logger_js_1 = __importDefault(require("./logger.js"));
|
|
18
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
19
|
+
const teen_process_1 = require("teen_process");
|
|
20
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
21
|
+
const node_child_process_1 = require("node:child_process");
|
|
22
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
23
|
+
const utils_js_1 = require("./utils.js");
|
|
24
|
+
const STRINGSDICT_RESOURCE = '.stringsdict';
|
|
25
|
+
const STRINGS_RESOURCE = '.strings';
|
|
26
|
+
exports.SAFARI_BUNDLE_ID = 'com.apple.mobilesafari';
|
|
27
|
+
exports.APP_EXT = '.app';
|
|
28
|
+
exports.IPA_EXT = '.ipa';
|
|
29
|
+
const ZIP_EXT = '.zip';
|
|
30
|
+
const SAFARI_OPTS_ALIASES_MAP = /** @type {const} */ ({
|
|
31
|
+
safariAllowPopups: [
|
|
32
|
+
['WebKitJavaScriptCanOpenWindowsAutomatically', 'JavaScriptCanOpenWindowsAutomatically'],
|
|
33
|
+
(x) => Number(Boolean(x)),
|
|
34
|
+
],
|
|
35
|
+
safariIgnoreFraudWarning: [['WarnAboutFraudulentWebsites'], (x) => Number(!x)],
|
|
36
|
+
safariOpenLinksInBackground: [['OpenLinksInBackground'], (x) => Number(Boolean(x))],
|
|
37
|
+
});
|
|
38
|
+
const MAX_ARCHIVE_SCAN_DEPTH = 1;
|
|
39
|
+
exports.SUPPORTED_EXTENSIONS = [exports.IPA_EXT, exports.APP_EXT];
|
|
40
|
+
const MACOS_RESOURCE_FOLDER = '__MACOSX';
|
|
41
|
+
const SANITIZE_REPLACEMENT = '-';
|
|
42
|
+
const INTEL_ARCH = 'x86_64';
|
|
43
|
+
/**
|
|
44
|
+
* Verify whether the given application is compatible to the
|
|
45
|
+
* platform where it is going to be installed and tested.
|
|
46
|
+
*
|
|
47
|
+
* @this {XCUITestDriver}
|
|
48
|
+
* @returns {Promise<void>}
|
|
49
|
+
* @throws {Error} If bundle architecture does not match the expected device architecture.
|
|
50
|
+
*/
|
|
51
|
+
async function verifyApplicationPlatform() {
|
|
52
|
+
this.log.debug('Verifying application platform');
|
|
53
|
+
const supportedPlatforms = await this.appInfosCache.extractAppPlatforms(this.opts.app);
|
|
54
|
+
const isTvOS = (0, utils_js_1.isTvOs)(this.opts.platformName);
|
|
55
|
+
const prefix = isTvOS ? 'AppleTV' : 'iPhone';
|
|
56
|
+
const suffix = this.isSimulator() ? 'Simulator' : 'OS';
|
|
57
|
+
const dstPlatform = `${prefix}${suffix}`;
|
|
58
|
+
if (!supportedPlatforms.includes(dstPlatform)) {
|
|
59
|
+
throw new Error(`${this.isSimulator() ? 'Simulator' : 'Real device'} architecture is not supported by the ${this.opts.bundleId} application. ` +
|
|
60
|
+
`Make sure the correct deployment target has been selected for its compilation in Xcode.`);
|
|
61
|
+
}
|
|
62
|
+
if (this.isRealDevice()) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const executablePath = path_1.default.resolve(this.opts.app, await this.appInfosCache.extractExecutableName(this.opts.app));
|
|
66
|
+
const [resFile, resUname] = await bluebird_1.default.all([
|
|
67
|
+
(0, teen_process_1.exec)('lipo', ['-info', executablePath]),
|
|
68
|
+
(0, teen_process_1.exec)('uname', ['-m']),
|
|
69
|
+
]);
|
|
70
|
+
const bundleExecutableInfo = lodash_1.default.trim(resFile.stdout);
|
|
71
|
+
this.log.debug(bundleExecutableInfo);
|
|
72
|
+
const processArch = lodash_1.default.trim(resUname.stdout);
|
|
73
|
+
this.log.debug(`Current process architecture: ${processArch}`);
|
|
74
|
+
const isAppleSiliconCpu = isAppleSilicon();
|
|
75
|
+
this.log.debug(`Is Apple Silicon CPU: ${isAppleSiliconCpu}`);
|
|
76
|
+
if (isAppleSiliconCpu && processArch === INTEL_ARCH) {
|
|
77
|
+
this.log.warn(`It looks like the Appium server process is running under Rosetta emulation. ` +
|
|
78
|
+
`This might lead to various performance/compatibility issues while running tests on Simulator. ` +
|
|
79
|
+
`Consider using binaries compiled natively for the ARM64 architecture to run Appium server ` +
|
|
80
|
+
`with this driver.`);
|
|
81
|
+
}
|
|
82
|
+
if (lodash_1.default.includes(bundleExecutableInfo, processArch)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const hasRosetta = isAppleSiliconCpu && await isRosettaInstalled();
|
|
86
|
+
const isIntelApp = lodash_1.default.includes(bundleExecutableInfo, INTEL_ARCH);
|
|
87
|
+
// We cannot run Simulator builds compiled for arm64 on Intel machines
|
|
88
|
+
// Rosetta allows only to run Intel ones on arm64
|
|
89
|
+
if ((isIntelApp && (!isAppleSiliconCpu || hasRosetta)) || (!isIntelApp && isAppleSiliconCpu)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const advice = isIntelApp && isAppleSiliconCpu && !hasRosetta
|
|
93
|
+
? `Please install Rosetta and try again.`
|
|
94
|
+
: `Please rebuild your application to support the ${processArch} platform.`;
|
|
95
|
+
throw new Error(`The ${this.opts.bundleId} application does not support the ${processArch} Simulator ` +
|
|
96
|
+
`architecture:\n${bundleExecutableInfo}\n\n${advice}`);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @param {string} resourcePath
|
|
101
|
+
* @returns {Promise<import('@appium/types').StringRecord>}
|
|
102
|
+
*/
|
|
103
|
+
async function readResource(resourcePath) {
|
|
104
|
+
const data = await support_1.plist.parsePlistFile(resourcePath);
|
|
105
|
+
const result = {};
|
|
106
|
+
for (const [key, value] of lodash_1.default.toPairs(data)) {
|
|
107
|
+
result[key] = lodash_1.default.isString(value) ? value : JSON.stringify(value);
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @typedef {Object} LocalizableStringsOptions
|
|
113
|
+
* @property {string} [app]
|
|
114
|
+
* @property {string} [language='en']
|
|
115
|
+
* @property {string} [localizableStringsDir]
|
|
116
|
+
* @property {string} [stringFile]
|
|
117
|
+
* @property {boolean} [strictMode]
|
|
118
|
+
*/
|
|
119
|
+
/**
|
|
120
|
+
* Extracts string resources from an app
|
|
121
|
+
*
|
|
122
|
+
* @this {XCUITestDriver}
|
|
123
|
+
* @param {LocalizableStringsOptions} opts
|
|
124
|
+
* @returns {Promise<import('@appium/types').StringRecord>}
|
|
125
|
+
*/
|
|
126
|
+
async function parseLocalizableStrings(opts = {}) {
|
|
127
|
+
const { app, language = 'en', localizableStringsDir, stringFile, strictMode } = opts;
|
|
128
|
+
if (!app) {
|
|
129
|
+
const message = `Strings extraction is not supported if 'app' capability is not set`;
|
|
130
|
+
if (strictMode) {
|
|
131
|
+
throw new Error(message);
|
|
132
|
+
}
|
|
133
|
+
this.log.info(message);
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
136
|
+
let bundleRoot = app;
|
|
137
|
+
const isArchive = (await support_1.fs.stat(app)).isFile();
|
|
138
|
+
let tmpRoot;
|
|
139
|
+
try {
|
|
140
|
+
if (isArchive) {
|
|
141
|
+
tmpRoot = await support_1.tempDir.openDir();
|
|
142
|
+
this.log.info(`Extracting '${app}' into a temporary location to parse its resources`);
|
|
143
|
+
await support_1.zip.extractAllTo(app, tmpRoot);
|
|
144
|
+
const relativeBundleRoot = /** @type {string} */ (lodash_1.default.first(await findApps(tmpRoot, [exports.APP_EXT])));
|
|
145
|
+
this.log.info(`Selecting '${relativeBundleRoot}'`);
|
|
146
|
+
bundleRoot = path_1.default.join(tmpRoot, relativeBundleRoot);
|
|
147
|
+
}
|
|
148
|
+
/** @type {string|undefined} */
|
|
149
|
+
let lprojRoot;
|
|
150
|
+
for (const subfolder of [`${language}.lproj`, localizableStringsDir, ''].filter(lodash_1.default.isString)) {
|
|
151
|
+
lprojRoot = path_1.default.resolve(bundleRoot, /** @type {string} */ (subfolder));
|
|
152
|
+
if (await support_1.fs.exists(lprojRoot)) {
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
const message = `No '${lprojRoot}' resources folder has been found`;
|
|
156
|
+
if (strictMode) {
|
|
157
|
+
throw new Error(message);
|
|
158
|
+
}
|
|
159
|
+
this.log.debug(message);
|
|
160
|
+
}
|
|
161
|
+
if (!lprojRoot) {
|
|
162
|
+
return {};
|
|
163
|
+
}
|
|
164
|
+
this.log.info(`Retrieving resource strings from '${lprojRoot}'`);
|
|
165
|
+
const resourcePaths = [];
|
|
166
|
+
if (stringFile) {
|
|
167
|
+
const dstPath = path_1.default.resolve(/** @type {string} */ (lprojRoot), stringFile);
|
|
168
|
+
if (await support_1.fs.exists(dstPath)) {
|
|
169
|
+
resourcePaths.push(dstPath);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
const message = `No '${dstPath}' resource file has been found for '${app}'`;
|
|
173
|
+
if (strictMode) {
|
|
174
|
+
throw new Error(message);
|
|
175
|
+
}
|
|
176
|
+
this.log.info(message);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (lodash_1.default.isEmpty(resourcePaths) && (await support_1.fs.exists(lprojRoot))) {
|
|
180
|
+
const resourceFiles = (await support_1.fs.readdir(lprojRoot))
|
|
181
|
+
.filter((name) => lodash_1.default.some([STRINGS_RESOURCE, STRINGSDICT_RESOURCE], (x) => name.endsWith(x)))
|
|
182
|
+
.map((name) => path_1.default.resolve(lprojRoot, name));
|
|
183
|
+
resourcePaths.push(...resourceFiles);
|
|
184
|
+
}
|
|
185
|
+
this.log.info(`Got ${support_1.util.pluralize('resource file', resourcePaths.length, true)} in '${lprojRoot}'`);
|
|
186
|
+
if (lodash_1.default.isEmpty(resourcePaths)) {
|
|
187
|
+
return {};
|
|
188
|
+
}
|
|
189
|
+
const resultStrings = {};
|
|
190
|
+
const toAbsolutePath = (/** @type {string} */ p) => path_1.default.isAbsolute(p) ? p : path_1.default.resolve(process.cwd(), p);
|
|
191
|
+
for (const resourcePath of resourcePaths) {
|
|
192
|
+
if (!support_1.util.isSubPath(toAbsolutePath(resourcePath), toAbsolutePath(bundleRoot))) {
|
|
193
|
+
// security precaution
|
|
194
|
+
throw new Error(`'${resourcePath}' is expected to be located under '${bundleRoot}'`);
|
|
195
|
+
}
|
|
196
|
+
try {
|
|
197
|
+
const data = await readResource(resourcePath);
|
|
198
|
+
this.log.debug(`Parsed ${support_1.util.pluralize('string', lodash_1.default.keys(data).length, true)} from '${resourcePath}'`);
|
|
199
|
+
lodash_1.default.merge(resultStrings, data);
|
|
200
|
+
}
|
|
201
|
+
catch (e) {
|
|
202
|
+
this.log.warn(`Cannot parse '${resourcePath}' resource. Original error: ${e.message}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
this.log.info(`Retrieved ${support_1.util.pluralize('string', lodash_1.default.keys(resultStrings).length, true)} from '${lprojRoot}'`);
|
|
206
|
+
return resultStrings;
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
if (tmpRoot) {
|
|
210
|
+
await support_1.fs.rimraf(tmpRoot);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Check whether the given path on the file system points to the .app bundle root
|
|
216
|
+
*
|
|
217
|
+
* @param {string} appPath Possible .app bundle root
|
|
218
|
+
* @returns {Promise<boolean>} Whether the given path points to an .app bundle
|
|
219
|
+
*/
|
|
220
|
+
async function isAppBundle(appPath) {
|
|
221
|
+
return (lodash_1.default.endsWith(lodash_1.default.toLower(appPath), exports.APP_EXT) &&
|
|
222
|
+
(await support_1.fs.stat(appPath)).isDirectory() &&
|
|
223
|
+
(await support_1.fs.exists(path_1.default.join(appPath, 'Info.plist'))));
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Check whether the given path on the file system points to the .ipa file
|
|
227
|
+
*
|
|
228
|
+
* @param {string} appPath Possible .ipa file
|
|
229
|
+
* @returns {Promise<boolean>} Whether the given path points to an .ipa bundle
|
|
230
|
+
*/
|
|
231
|
+
async function isIpaBundle(appPath) {
|
|
232
|
+
return lodash_1.default.endsWith(lodash_1.default.toLower(appPath), exports.IPA_EXT) && (await support_1.fs.stat(appPath)).isFile();
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @typedef {Object} UnzipInfo
|
|
236
|
+
* @property {string} rootDir
|
|
237
|
+
* @property {number} archiveSize
|
|
238
|
+
*/
|
|
239
|
+
/**
|
|
240
|
+
* Unzips a ZIP archive on the local file system.
|
|
241
|
+
*
|
|
242
|
+
* @param {string} archivePath Full path to a .zip archive
|
|
243
|
+
* @returns {Promise<UnzipInfo>} temporary folder root where the archive has been extracted
|
|
244
|
+
*/
|
|
245
|
+
async function unzipFile(archivePath) {
|
|
246
|
+
const useSystemUnzipEnv = process.env.APPIUM_PREFER_SYSTEM_UNZIP;
|
|
247
|
+
const useSystemUnzip = lodash_1.default.isEmpty(useSystemUnzipEnv) || !['0', 'false'].includes(lodash_1.default.toLower(useSystemUnzipEnv));
|
|
248
|
+
const tmpRoot = await support_1.tempDir.openDir();
|
|
249
|
+
try {
|
|
250
|
+
await support_1.zip.extractAllTo(archivePath, tmpRoot, {
|
|
251
|
+
useSystemUnzip,
|
|
252
|
+
// https://github.com/appium/appium/issues/14100
|
|
253
|
+
fileNamesEncoding: 'utf8',
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
catch (e) {
|
|
257
|
+
await support_1.fs.rimraf(tmpRoot);
|
|
258
|
+
throw e;
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
rootDir: tmpRoot,
|
|
262
|
+
archiveSize: (await support_1.fs.stat(archivePath)).size,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Unzips a ZIP archive from a stream.
|
|
267
|
+
* Uses bdstar tool for this purpose.
|
|
268
|
+
* This allows to optimize the time needed to prepare the app under test
|
|
269
|
+
* to MAX(download, unzip) instead of SUM(download, unzip)
|
|
270
|
+
*
|
|
271
|
+
* @param {import('node:stream').Readable} zipStream
|
|
272
|
+
* @returns {Promise<UnzipInfo>}
|
|
273
|
+
*/
|
|
274
|
+
async function unzipStream(zipStream) {
|
|
275
|
+
const tmpRoot = await support_1.tempDir.openDir();
|
|
276
|
+
const bsdtarProcess = (0, node_child_process_1.spawn)(await support_1.fs.which('bsdtar'), [
|
|
277
|
+
'-x',
|
|
278
|
+
'--exclude', MACOS_RESOURCE_FOLDER,
|
|
279
|
+
'--exclude', `${MACOS_RESOURCE_FOLDER}/*`,
|
|
280
|
+
'-',
|
|
281
|
+
], {
|
|
282
|
+
cwd: tmpRoot,
|
|
283
|
+
});
|
|
284
|
+
let archiveSize = 0;
|
|
285
|
+
bsdtarProcess.stderr.on('data', (chunk) => {
|
|
286
|
+
const stderr = chunk.toString();
|
|
287
|
+
if (lodash_1.default.trim(stderr)) {
|
|
288
|
+
logger_js_1.default.warn(stderr);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
zipStream.on('data', (chunk) => {
|
|
292
|
+
archiveSize += lodash_1.default.size(chunk);
|
|
293
|
+
});
|
|
294
|
+
zipStream.pipe(bsdtarProcess.stdin);
|
|
295
|
+
try {
|
|
296
|
+
await new bluebird_1.default((resolve, reject) => {
|
|
297
|
+
zipStream.once('error', reject);
|
|
298
|
+
bsdtarProcess.once('exit', (code, signal) => {
|
|
299
|
+
zipStream.unpipe(bsdtarProcess.stdin);
|
|
300
|
+
logger_js_1.default.debug(`bsdtar process exited with code ${code}, signal ${signal}`);
|
|
301
|
+
if (code === 0) {
|
|
302
|
+
resolve();
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
reject(new Error('Is it a valid ZIP archive?'));
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
bsdtarProcess.once('error', (e) => {
|
|
309
|
+
zipStream.unpipe(bsdtarProcess.stdin);
|
|
310
|
+
reject(e);
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
catch (err) {
|
|
315
|
+
bsdtarProcess.kill(9);
|
|
316
|
+
await support_1.fs.rimraf(tmpRoot);
|
|
317
|
+
throw new Error(`The response data cannot be unzipped: ${err.message}`);
|
|
318
|
+
}
|
|
319
|
+
finally {
|
|
320
|
+
bsdtarProcess.removeAllListeners();
|
|
321
|
+
zipStream.removeAllListeners();
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
rootDir: tmpRoot,
|
|
325
|
+
archiveSize,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Used to parse the file name value from response headers
|
|
330
|
+
*
|
|
331
|
+
* @param {import('@appium/types').HTTPHeaders} headers
|
|
332
|
+
* @returns {string?}
|
|
333
|
+
*/
|
|
334
|
+
function parseFileName(headers) {
|
|
335
|
+
const contentDisposition = headers['content-disposition'];
|
|
336
|
+
if (!lodash_1.default.isString(contentDisposition)) {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
if (/^attachment/i.test(/** @type {string} */ (contentDisposition))) {
|
|
340
|
+
const match = /filename="([^"]+)/i.exec(/** @type {string} */ (contentDisposition));
|
|
341
|
+
if (match) {
|
|
342
|
+
return support_1.fs.sanitizeName(match[1], { replacement: SANITIZE_REPLACEMENT });
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Downloads and verifies remote applications for real devices
|
|
349
|
+
*
|
|
350
|
+
* @this {XCUITestDriver}
|
|
351
|
+
* @param {import('node:stream').Readable} stream
|
|
352
|
+
* @param {import('@appium/types').HTTPHeaders} headers
|
|
353
|
+
* @returns {Promise<string>}
|
|
354
|
+
*/
|
|
355
|
+
async function downloadIpa(stream, headers) {
|
|
356
|
+
const timer = new support_1.timing.Timer().start();
|
|
357
|
+
const logPerformance = (/** @type {string} */ dstPath, /** @type {number} */ fileSize, /** @type {string} */ action) => {
|
|
358
|
+
const secondsElapsed = timer.getDuration().asSeconds;
|
|
359
|
+
this.log.info(`The remote file (${support_1.util.toReadableSizeString(fileSize)}) ` +
|
|
360
|
+
`has been ${action} to '${dstPath}' in ${secondsElapsed.toFixed(3)}s`);
|
|
361
|
+
if (secondsElapsed >= 1) {
|
|
362
|
+
const bytesPerSec = Math.floor(fileSize / secondsElapsed);
|
|
363
|
+
this.log.debug(`Approximate speed: ${support_1.util.toReadableSizeString(bytesPerSec)}/s`);
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
// Check if the file to be downloaded is a .zip rather than .ipa
|
|
367
|
+
const fileName = parseFileName(headers) ?? `appium-app-${new Date().getTime()}${exports.IPA_EXT}`;
|
|
368
|
+
if (fileName.toLowerCase().endsWith(ZIP_EXT)) {
|
|
369
|
+
const { rootDir, archiveSize } = await unzipStream(stream);
|
|
370
|
+
logPerformance(rootDir, archiveSize, 'downloaded and unzipped');
|
|
371
|
+
try {
|
|
372
|
+
const matchedPaths = await findApps(rootDir, [exports.IPA_EXT]);
|
|
373
|
+
if (!lodash_1.default.isEmpty(matchedPaths)) {
|
|
374
|
+
this.log.debug(`Found ${support_1.util.pluralize(`${exports.IPA_EXT} application`, matchedPaths.length, true)} in ` +
|
|
375
|
+
`'${path_1.default.basename(rootDir)}': ${matchedPaths}`);
|
|
376
|
+
}
|
|
377
|
+
for (const matchedPath of matchedPaths) {
|
|
378
|
+
try {
|
|
379
|
+
await this.appInfosCache.put(matchedPath);
|
|
380
|
+
}
|
|
381
|
+
catch (e) {
|
|
382
|
+
this.log.info(e.message);
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
this.log.debug(`Selecting the application at '${matchedPath}'`);
|
|
386
|
+
const isolatedPath = path_1.default.join(await support_1.tempDir.openDir(), path_1.default.basename(matchedPath));
|
|
387
|
+
await support_1.fs.mv(matchedPath, isolatedPath);
|
|
388
|
+
return isolatedPath;
|
|
389
|
+
}
|
|
390
|
+
throw new Error(`The remote archive does not contain any valid ${exports.IPA_EXT} applications`);
|
|
391
|
+
}
|
|
392
|
+
finally {
|
|
393
|
+
await support_1.fs.rimraf(rootDir);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
const ipaPath = await support_1.tempDir.path({
|
|
397
|
+
prefix: fileName,
|
|
398
|
+
suffix: fileName.toLowerCase().endsWith(exports.IPA_EXT) ? '' : exports.IPA_EXT,
|
|
399
|
+
});
|
|
400
|
+
try {
|
|
401
|
+
const writer = support_1.fs.createWriteStream(ipaPath);
|
|
402
|
+
stream.pipe(writer);
|
|
403
|
+
await new bluebird_1.default((resolve, reject) => {
|
|
404
|
+
stream.once('error', reject);
|
|
405
|
+
writer.once('finish', resolve);
|
|
406
|
+
writer.once('error', (e) => {
|
|
407
|
+
stream.unpipe(writer);
|
|
408
|
+
reject(e);
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
catch (err) {
|
|
413
|
+
throw new Error(`Cannot fetch the remote file: ${err.message}`);
|
|
414
|
+
}
|
|
415
|
+
const { size } = await support_1.fs.stat(ipaPath);
|
|
416
|
+
logPerformance(ipaPath, size, 'downloaded');
|
|
417
|
+
try {
|
|
418
|
+
await this.appInfosCache.put(ipaPath);
|
|
419
|
+
}
|
|
420
|
+
catch (e) {
|
|
421
|
+
await support_1.fs.rimraf(ipaPath);
|
|
422
|
+
throw e;
|
|
423
|
+
}
|
|
424
|
+
return ipaPath;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Looks for items with given extensions in the given folder
|
|
428
|
+
*
|
|
429
|
+
* @param {string} appPath Full path to an app bundle
|
|
430
|
+
* @param {Array<string>} appExtensions List of matching item extensions
|
|
431
|
+
* @returns {Promise<string[]>} List of relative paths to matched items
|
|
432
|
+
*/
|
|
433
|
+
async function findApps(appPath, appExtensions) {
|
|
434
|
+
const globPattern = `**/*.+(${appExtensions.map((ext) => ext.replace(/^\./, '')).join('|')})`;
|
|
435
|
+
const sortedBundleItems = (await support_1.fs.glob(globPattern, {
|
|
436
|
+
cwd: appPath,
|
|
437
|
+
})).sort((a, b) => a.split(path_1.default.sep).length - b.split(path_1.default.sep).length);
|
|
438
|
+
return sortedBundleItems;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Moves the application bundle to a newly created temporary folder
|
|
442
|
+
*
|
|
443
|
+
* @param {string} appPath Full path to the .app or .ipa bundle
|
|
444
|
+
* @returns {Promise<string>} The new path to the app bundle.
|
|
445
|
+
* The name of the app bundle remains the same
|
|
446
|
+
*/
|
|
447
|
+
async function isolateApp(appPath) {
|
|
448
|
+
const appFileName = path_1.default.basename(appPath);
|
|
449
|
+
if ((await support_1.fs.stat(appPath)).isFile()) {
|
|
450
|
+
const isolatedPath = await support_1.tempDir.path({
|
|
451
|
+
prefix: appFileName,
|
|
452
|
+
suffix: '',
|
|
453
|
+
});
|
|
454
|
+
await support_1.fs.mv(appPath, isolatedPath, { mkdirp: true });
|
|
455
|
+
return isolatedPath;
|
|
456
|
+
}
|
|
457
|
+
const tmpRoot = await support_1.tempDir.openDir();
|
|
458
|
+
const isolatedRoot = path_1.default.join(tmpRoot, appFileName);
|
|
459
|
+
await support_1.fs.mv(appPath, isolatedRoot, { mkdirp: true });
|
|
460
|
+
return isolatedRoot;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Builds Safari preferences object based on the given session capabilities
|
|
464
|
+
*
|
|
465
|
+
* @param {import('./driver').XCUITestDriverOpts} opts
|
|
466
|
+
* @return {Promise<import('@appium/types').StringRecord>}
|
|
467
|
+
*/
|
|
468
|
+
function buildSafariPreferences(opts) {
|
|
469
|
+
const safariSettings = lodash_1.default.cloneDeep(opts?.safariGlobalPreferences ?? {});
|
|
470
|
+
for (const [name, [aliases, valueConverter]] of lodash_1.default.toPairs(SAFARI_OPTS_ALIASES_MAP)) {
|
|
471
|
+
if (!lodash_1.default.has(opts, name)) {
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
for (const alias of aliases) {
|
|
475
|
+
safariSettings[alias] = valueConverter(opts[name]);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return safariSettings;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Unzip the given archive and find a matching .app bundle in it
|
|
482
|
+
*
|
|
483
|
+
* @this {XCUITestDriver}
|
|
484
|
+
* @param {string|import('node:stream').Readable} appPathOrZipStream The path to the archive.
|
|
485
|
+
* @param {number} depth [0] the current nesting depth. App bundles whose nesting level
|
|
486
|
+
* is greater than 1 are not supported.
|
|
487
|
+
* @returns {Promise<string>} Full path to the first matching .app bundle..
|
|
488
|
+
* @throws If no matching .app bundles were found in the provided archive.
|
|
489
|
+
*/
|
|
490
|
+
async function unzipApp(appPathOrZipStream, depth = 0) {
|
|
491
|
+
const errMsg = `The archive did not have any matching ${exports.APP_EXT} or ${exports.IPA_EXT} ` +
|
|
492
|
+
`bundles. Please make sure the provided package is valid and contains at least one matching ` +
|
|
493
|
+
`application bundle which is not nested.`;
|
|
494
|
+
if (depth > MAX_ARCHIVE_SCAN_DEPTH) {
|
|
495
|
+
throw new Error(errMsg);
|
|
496
|
+
}
|
|
497
|
+
const timer = new support_1.timing.Timer().start();
|
|
498
|
+
/** @type {string} */
|
|
499
|
+
let rootDir;
|
|
500
|
+
/** @type {number} */
|
|
501
|
+
let archiveSize;
|
|
502
|
+
try {
|
|
503
|
+
if (lodash_1.default.isString(appPathOrZipStream)) {
|
|
504
|
+
({ rootDir, archiveSize } = await unzipFile(/** @type {string} */ (appPathOrZipStream)));
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
if (depth > 0) {
|
|
508
|
+
node_assert_1.default.fail('Streaming unzip cannot be invoked for nested archive items');
|
|
509
|
+
}
|
|
510
|
+
({ rootDir, archiveSize } = await unzipStream(
|
|
511
|
+
/** @type {import('node:stream').Readable} */ (appPathOrZipStream)));
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
catch (e) {
|
|
515
|
+
this.log.debug(e.stack);
|
|
516
|
+
throw new Error(`Cannot prepare the application for testing. Original error: ${e.message}`);
|
|
517
|
+
}
|
|
518
|
+
const secondsElapsed = timer.getDuration().asSeconds;
|
|
519
|
+
this.log.info(`The file (${support_1.util.toReadableSizeString(archiveSize)}) ` +
|
|
520
|
+
`has been ${lodash_1.default.isString(appPathOrZipStream) ? 'extracted' : 'downloaded and extracted'} ` +
|
|
521
|
+
`to '${rootDir}' in ${secondsElapsed.toFixed(3)}s`);
|
|
522
|
+
// it does not make much sense to approximate the speed for short downloads
|
|
523
|
+
if (secondsElapsed >= 1) {
|
|
524
|
+
const bytesPerSec = Math.floor(archiveSize / secondsElapsed);
|
|
525
|
+
this.log.debug(`Approximate decompression speed: ${support_1.util.toReadableSizeString(bytesPerSec)}/s`);
|
|
526
|
+
}
|
|
527
|
+
const isCompatibleWithCurrentPlatform = async (/** @type {string} */ appPath) => {
|
|
528
|
+
let platforms;
|
|
529
|
+
try {
|
|
530
|
+
platforms = await this.appInfosCache.extractAppPlatforms(appPath);
|
|
531
|
+
}
|
|
532
|
+
catch (e) {
|
|
533
|
+
this.log.info(e.message);
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
if (this.isSimulator() && !platforms.some((p) => lodash_1.default.includes(p, 'Simulator'))) {
|
|
537
|
+
this.log.info(`'${appPath}' does not have Simulator devices in the list of supported platforms ` +
|
|
538
|
+
`(${platforms.join(',')}). Skipping it`);
|
|
539
|
+
return false;
|
|
540
|
+
}
|
|
541
|
+
if (this.isRealDevice() && !platforms.some((p) => lodash_1.default.includes(p, 'OS'))) {
|
|
542
|
+
this.log.info(`'${appPath}' does not have real devices in the list of supported platforms ` +
|
|
543
|
+
`(${platforms.join(',')}). Skipping it`);
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
546
|
+
return true;
|
|
547
|
+
};
|
|
548
|
+
const matchedPaths = await findApps(rootDir, exports.SUPPORTED_EXTENSIONS);
|
|
549
|
+
if (lodash_1.default.isEmpty(matchedPaths)) {
|
|
550
|
+
this.log.debug(`'${path_1.default.basename(rootDir)}' has no bundles`);
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
this.log.debug(`Found ${support_1.util.pluralize('bundle', matchedPaths.length, true)} in ` +
|
|
554
|
+
`'${path_1.default.basename(rootDir)}': ${matchedPaths}`);
|
|
555
|
+
}
|
|
556
|
+
try {
|
|
557
|
+
for (const matchedPath of matchedPaths) {
|
|
558
|
+
const fullPath = path_1.default.join(rootDir, matchedPath);
|
|
559
|
+
if ((await isAppBundle(fullPath) || (this.isRealDevice() && await isIpaBundle(fullPath)))
|
|
560
|
+
&& await isCompatibleWithCurrentPlatform(fullPath)) {
|
|
561
|
+
this.log.debug(`Selecting the application at '${matchedPath}'`);
|
|
562
|
+
return await isolateApp(fullPath);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
finally {
|
|
567
|
+
await support_1.fs.rimraf(rootDir);
|
|
568
|
+
}
|
|
569
|
+
throw new Error(errMsg);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* The callback invoked by configureApp helper
|
|
573
|
+
* when it is necessary to download the remote application.
|
|
574
|
+
* We assume the remote file could be anythingm, but only
|
|
575
|
+
* .zip and .ipa formats are supported.
|
|
576
|
+
* A .zip archive can contain one or more
|
|
577
|
+
*
|
|
578
|
+
* @this {XCUITestDriver}
|
|
579
|
+
* @param {import('@appium/types').DownloadAppOptions} opts
|
|
580
|
+
* @returns {Promise<string>}
|
|
581
|
+
*/
|
|
582
|
+
async function onDownloadApp({ stream, headers }) {
|
|
583
|
+
return this.isRealDevice()
|
|
584
|
+
? await downloadIpa.bind(this)(stream, headers)
|
|
585
|
+
: await unzipApp.bind(this)(stream);
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* @this {XCUITestDriver}
|
|
589
|
+
* @param {import('@appium/types').PostProcessOptions} opts
|
|
590
|
+
* @returns {Promise<import('@appium/types').PostProcessResult|false>}
|
|
591
|
+
*/
|
|
592
|
+
async function onPostConfigureApp({ cachedAppInfo, isUrl, appPath }) {
|
|
593
|
+
// Pick the previously cached entry if its integrity has been preserved
|
|
594
|
+
/** @type {import('@appium/types').CachedAppInfo|undefined} */
|
|
595
|
+
const appInfo = lodash_1.default.isPlainObject(cachedAppInfo) ? cachedAppInfo : undefined;
|
|
596
|
+
const cachedPath = appInfo ? /** @type {string} */ (appInfo.fullPath) : undefined;
|
|
597
|
+
const shouldUseCachedApp = async () => {
|
|
598
|
+
if (!appInfo || !cachedPath || !await support_1.fs.exists(cachedPath)) {
|
|
599
|
+
return false;
|
|
600
|
+
}
|
|
601
|
+
const isCachedPathAFile = (await support_1.fs.stat(cachedPath)).isFile();
|
|
602
|
+
if (isCachedPathAFile) {
|
|
603
|
+
return await support_1.fs.hash(cachedPath) === /** @type {any} */ (appInfo.integrity)?.file;
|
|
604
|
+
}
|
|
605
|
+
// If the cached path is a folder then it is expected to be previously extracted from
|
|
606
|
+
// an archive located under appPath whose hash is stored as `cachedAppInfo.packageHash`
|
|
607
|
+
if (!isCachedPathAFile
|
|
608
|
+
&& cachedAppInfo?.packageHash
|
|
609
|
+
&& await support_1.fs.exists(/** @type {string} */ (appPath))
|
|
610
|
+
&& (await support_1.fs.stat(/** @type {string} */ (appPath))).isFile()
|
|
611
|
+
&& cachedAppInfo.packageHash === await support_1.fs.hash(/** @type {string} */ (appPath))) {
|
|
612
|
+
/** @type {number|undefined} */
|
|
613
|
+
const nestedItemsCountInCache = /** @type {any} */ (appInfo.integrity)?.folder;
|
|
614
|
+
if (nestedItemsCountInCache !== undefined) {
|
|
615
|
+
return (await support_1.fs.glob('**/*', { cwd: cachedPath })).length >= nestedItemsCountInCache;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return false;
|
|
619
|
+
};
|
|
620
|
+
if (await shouldUseCachedApp()) {
|
|
621
|
+
this.log.info(`Using '${cachedPath}' which was cached from '${appPath}'`);
|
|
622
|
+
return { appPath: /** @type {string} */ (cachedPath) };
|
|
623
|
+
}
|
|
624
|
+
const isLocalIpa = await isIpaBundle(/** @type {string} */ (appPath));
|
|
625
|
+
const isLocalApp = !isLocalIpa && await isAppBundle(/** @type {string} */ (appPath));
|
|
626
|
+
const isPackageReadyForInstall = isLocalApp || (this.isRealDevice() && isLocalIpa);
|
|
627
|
+
if (isPackageReadyForInstall) {
|
|
628
|
+
await this.appInfosCache.put(/** @type {string} */ (appPath));
|
|
629
|
+
}
|
|
630
|
+
// Only local .app bundles (real device/Simulator)
|
|
631
|
+
// and .ipa packages for real devices should not be cached
|
|
632
|
+
if (!isUrl && isPackageReadyForInstall) {
|
|
633
|
+
return false;
|
|
634
|
+
}
|
|
635
|
+
// Cache the app while unpacking the bundle if necessary
|
|
636
|
+
return {
|
|
637
|
+
appPath: isPackageReadyForInstall
|
|
638
|
+
? appPath
|
|
639
|
+
: await unzipApp.bind(this)(/** @type {string} */ (appPath))
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* @returns {Promise<boolean>}
|
|
644
|
+
*/
|
|
645
|
+
async function isRosettaInstalled() {
|
|
646
|
+
return await support_1.fs.exists('/Library/Apple/usr/share/rosetta/rosetta');
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* @returns {boolean}
|
|
650
|
+
*/
|
|
651
|
+
function isAppleSilicon() {
|
|
652
|
+
return node_os_1.default.cpus()[0].model.includes('Apple');
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* @typedef {import('./driver').XCUITestDriver} XCUITestDriver
|
|
656
|
+
*/
|
|
657
|
+
//# sourceMappingURL=app-utils.js.map
|