@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
package/lib/utils.js
ADDED
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
import * as xcode from '@limrun/appium-xcode';
|
|
2
|
+
import {errors} from 'appium/driver';
|
|
3
|
+
import {fs, net, util} from 'appium/support';
|
|
4
|
+
import B from 'bluebird';
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
import os from 'node:os';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import url from 'node:url';
|
|
9
|
+
import * as semver from 'semver';
|
|
10
|
+
import {exec} from 'teen_process';
|
|
11
|
+
import iosGenericSimulators from './ios-generic-simulators';
|
|
12
|
+
import log from './logger';
|
|
13
|
+
import {PLATFORM_NAME_TVOS, PLATFORM_NAME_IOS} from './desired-caps';
|
|
14
|
+
|
|
15
|
+
export const UDID_AUTO = 'auto';
|
|
16
|
+
const MODULE_NAME = 'appium-xcuitest-driver';
|
|
17
|
+
const DEFAULT_TIMEOUT_KEY = 'default';
|
|
18
|
+
const XCTEST_LOG_FILES_PATTERNS = [
|
|
19
|
+
/^Session-WebDriverAgentRunner.*\.log$/i,
|
|
20
|
+
/^StandardOutputAndStandardError\.txt$/i,
|
|
21
|
+
];
|
|
22
|
+
const XCTEST_LOGS_CACHE_FOLDER_PREFIX = 'com.apple.dt.XCTest';
|
|
23
|
+
export const NATIVE_WIN = 'NATIVE_APP';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @privateRemarks Is the minimum version really Xcode 7.3?
|
|
27
|
+
* @returns {Promise<XcodeVersion>}
|
|
28
|
+
*/
|
|
29
|
+
async function getAndCheckXcodeVersion() {
|
|
30
|
+
/** @type {XcodeVersion} */
|
|
31
|
+
let version;
|
|
32
|
+
try {
|
|
33
|
+
version = /** @type {XcodeVersion} */ (await xcode.getVersion(true));
|
|
34
|
+
} catch (err) {
|
|
35
|
+
log.error(err);
|
|
36
|
+
throw new Error(`Could not determine Xcode version: ${err.message}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// we do not support Xcodes < 7.3,
|
|
40
|
+
if (version.versionFloat < 7.3) {
|
|
41
|
+
const msg = `Xcode ${version.versionString} is not supported. Please upgrade to version 7.3 or higher`;
|
|
42
|
+
log.error(msg);
|
|
43
|
+
throw new Error(msg);
|
|
44
|
+
}
|
|
45
|
+
return version;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @returns {Promise<string|null>}
|
|
50
|
+
*/
|
|
51
|
+
async function getAndCheckIosSdkVersion() {
|
|
52
|
+
try {
|
|
53
|
+
return '26';
|
|
54
|
+
return await xcode.getMaxIOSSDK();
|
|
55
|
+
} catch (err) {
|
|
56
|
+
throw log.errorWithException(`Could not determine iOS SDK version: ${err.message}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get the generic simulator for a given IOS version and device type (iPhone, iPad)
|
|
62
|
+
*
|
|
63
|
+
* @param {string|number} platformVersion IOS version. e.g.) 13.0
|
|
64
|
+
* @param {string} deviceName Type of IOS device. Can be iPhone, iPad (possibly more in the future)
|
|
65
|
+
*
|
|
66
|
+
* @returns {string?} Generic iPhone or iPad simulator (if applicable)
|
|
67
|
+
*/
|
|
68
|
+
function getGenericSimulatorForIosVersion(platformVersion, deviceName) {
|
|
69
|
+
const genericSimulators = iosGenericSimulators[deviceName];
|
|
70
|
+
if (!genericSimulators) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Find the highest iOS version in the list that is below the provided version
|
|
75
|
+
let result = null;
|
|
76
|
+
const compareVersions = ([simOne], [simTwo]) =>
|
|
77
|
+
util.compareVersions(simOne, '<', simTwo) ? -1 : 1;
|
|
78
|
+
for (const [platformVersionFromList, iosSimulator] of genericSimulators.sort(compareVersions)) {
|
|
79
|
+
if (util.compareVersions(platformVersionFromList, '>', String(platformVersion))) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
result = iosSimulator;
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param {string} platformVersion
|
|
90
|
+
* @param {string} deviceName
|
|
91
|
+
* @returns {string}
|
|
92
|
+
*/
|
|
93
|
+
function translateDeviceName(platformVersion, deviceName) {
|
|
94
|
+
if (!deviceName) {
|
|
95
|
+
return deviceName;
|
|
96
|
+
}
|
|
97
|
+
const deviceNameTranslated = getGenericSimulatorForIosVersion(
|
|
98
|
+
platformVersion,
|
|
99
|
+
`${deviceName}`.toLowerCase().trim(),
|
|
100
|
+
);
|
|
101
|
+
if (!deviceNameTranslated) {
|
|
102
|
+
return deviceName;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
log.debug(`Changing deviceName from '${deviceName}' to '${deviceNameTranslated}'`);
|
|
106
|
+
return deviceNameTranslated;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param {string[]} locations
|
|
111
|
+
* @returns {Promise<void>}
|
|
112
|
+
*/
|
|
113
|
+
async function clearLogs(locations) {
|
|
114
|
+
log.debug('Clearing log files');
|
|
115
|
+
const cleanupPromises = [];
|
|
116
|
+
for (const location of locations) {
|
|
117
|
+
if (!(await fs.exists(location))) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
cleanupPromises.push(
|
|
122
|
+
(async () => {
|
|
123
|
+
let size;
|
|
124
|
+
try {
|
|
125
|
+
const {stdout} = await exec('du', ['-sh', location]);
|
|
126
|
+
size = stdout.trim().split(/\s+/)[0];
|
|
127
|
+
} catch {}
|
|
128
|
+
try {
|
|
129
|
+
log.debug(`Deleting '${location}'. ${size ? `Freeing ${size}.` : ''}`);
|
|
130
|
+
await fs.rimraf(location);
|
|
131
|
+
} catch (err) {
|
|
132
|
+
log.warn(`Unable to delete '${location}': ${err.message}`);
|
|
133
|
+
}
|
|
134
|
+
})(),
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
if (!_.isEmpty(cleanupPromises)) {
|
|
138
|
+
await B.all(cleanupPromises);
|
|
139
|
+
}
|
|
140
|
+
log.debug('Finished clearing log files');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// This map contains derived data logs folders as keys
|
|
144
|
+
// and values are the count of times the particular
|
|
145
|
+
// folder has been scheduled for removal
|
|
146
|
+
const derivedDataCleanupMarkers = new Map();
|
|
147
|
+
|
|
148
|
+
async function markSystemFilesForCleanup(wda) {
|
|
149
|
+
if (!wda || !(await wda.retrieveDerivedDataPath())) {
|
|
150
|
+
log.warn(
|
|
151
|
+
'No WebDriverAgent derived data available, so unable to mark system files for cleanup',
|
|
152
|
+
);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const logsRoot = path.resolve(await wda.retrieveDerivedDataPath(), 'Logs');
|
|
157
|
+
let markersCount = 0;
|
|
158
|
+
if (derivedDataCleanupMarkers.has(logsRoot)) {
|
|
159
|
+
markersCount = derivedDataCleanupMarkers.get(logsRoot);
|
|
160
|
+
}
|
|
161
|
+
derivedDataCleanupMarkers.set(logsRoot, ++markersCount);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function clearSystemFiles(wda) {
|
|
165
|
+
// only want to clear the system files for the particular WDA xcode run
|
|
166
|
+
if (!wda || !(await wda.retrieveDerivedDataPath())) {
|
|
167
|
+
log.warn('No WebDriverAgent derived data available, so unable to clear system files');
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const logsRoot = path.resolve(await wda.retrieveDerivedDataPath(), 'Logs');
|
|
172
|
+
if (derivedDataCleanupMarkers.has(logsRoot)) {
|
|
173
|
+
let markersCount = derivedDataCleanupMarkers.get(logsRoot);
|
|
174
|
+
derivedDataCleanupMarkers.set(logsRoot, --markersCount);
|
|
175
|
+
if (markersCount > 0) {
|
|
176
|
+
log.info(
|
|
177
|
+
`Not cleaning '${logsRoot}' folder, because the other session does not expect it to be cleaned`,
|
|
178
|
+
);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
derivedDataCleanupMarkers.set(logsRoot, 0);
|
|
183
|
+
|
|
184
|
+
// Cleaning up big temporary files created by XCTest: https://github.com/appium/appium/issues/9410
|
|
185
|
+
const globPattern = `${os.tmpdir()}/${XCTEST_LOGS_CACHE_FOLDER_PREFIX}*/`;
|
|
186
|
+
const dstFolders = await fs.glob(globPattern);
|
|
187
|
+
if (_.isEmpty(dstFolders)) {
|
|
188
|
+
log.debug(`Did not find the temporary XCTest logs root at '${globPattern}'`);
|
|
189
|
+
} else {
|
|
190
|
+
// perform the cleanup asynchronously
|
|
191
|
+
/** @type {Promise[]} */
|
|
192
|
+
const promises = [];
|
|
193
|
+
for (const dstFolder of dstFolders) {
|
|
194
|
+
const promise = (async () => {
|
|
195
|
+
try {
|
|
196
|
+
await fs.walkDir(dstFolder, true, (itemPath, isDir) => {
|
|
197
|
+
if (isDir) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const fileName = path.basename(itemPath);
|
|
201
|
+
if (XCTEST_LOG_FILES_PATTERNS.some((p) => p.test(fileName))) {
|
|
202
|
+
fs.rimraf(itemPath);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
} catch (e) {
|
|
206
|
+
log.debug(e.stack);
|
|
207
|
+
log.info(e.message);
|
|
208
|
+
}
|
|
209
|
+
})();
|
|
210
|
+
promises.push(promise);
|
|
211
|
+
}
|
|
212
|
+
log.debug(`Started XCTest logs cleanup in '${dstFolders}'`);
|
|
213
|
+
if (promises.length) {
|
|
214
|
+
await B.all(promises);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (await fs.exists(logsRoot)) {
|
|
219
|
+
log.info(`Cleaning test logs in '${logsRoot}' folder`);
|
|
220
|
+
await clearLogs([logsRoot]);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
log.info(`There is no ${logsRoot} folder, so not cleaning files`);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async function checkAppPresent(app) {
|
|
227
|
+
log.debug(`Checking whether app '${app}' is actually present on file system`);
|
|
228
|
+
if (!(await fs.exists(app))) {
|
|
229
|
+
throw log.errorWithException(`Could not find app at '${app}'`);
|
|
230
|
+
}
|
|
231
|
+
log.debug('App is present');
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Reads the content to the current module's package.json
|
|
236
|
+
*
|
|
237
|
+
* @returns {Promise<Record<string, any>>} The full path to module root
|
|
238
|
+
* @throws {Error} If the current module's package.json cannot be determined
|
|
239
|
+
*/
|
|
240
|
+
const getModuleManifest = _.memoize(async function getModuleManifest() {
|
|
241
|
+
let currentDir = path.dirname(path.resolve(__filename));
|
|
242
|
+
let isAtFsRoot = false;
|
|
243
|
+
while (!isAtFsRoot) {
|
|
244
|
+
const manifestPath = path.join(currentDir, 'package.json');
|
|
245
|
+
try {
|
|
246
|
+
if (await fs.exists(manifestPath)) {
|
|
247
|
+
const manifest = JSON.parse(await fs.readFile(manifestPath, 'utf8'));
|
|
248
|
+
if (manifest.name === MODULE_NAME) {
|
|
249
|
+
return manifest;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
} catch {}
|
|
253
|
+
currentDir = path.dirname(currentDir);
|
|
254
|
+
isAtFsRoot = currentDir.length <= path.dirname(currentDir).length;
|
|
255
|
+
}
|
|
256
|
+
throw new Error(`Cannot find the package manifest of the ${MODULE_NAME} Node.js module`);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @typedef {Object} DriverInfo
|
|
261
|
+
* @property {string} version Driver version string
|
|
262
|
+
* @property {string} built Driver build timestamp
|
|
263
|
+
*/
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* @returns {DriverInfo}
|
|
267
|
+
*/
|
|
268
|
+
const getDriverInfo = _.memoize(async function getDriverInfo() {
|
|
269
|
+
const [stat, manifest] = await B.all([
|
|
270
|
+
fs.stat(path.resolve(__dirname, '..')),
|
|
271
|
+
getModuleManifest(),
|
|
272
|
+
]);
|
|
273
|
+
return {
|
|
274
|
+
built: stat.mtime.toString(),
|
|
275
|
+
version: manifest.version,
|
|
276
|
+
};
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
function normalizeCommandTimeouts(value) {
|
|
280
|
+
// The value is normalized already
|
|
281
|
+
if (typeof value !== 'string') {
|
|
282
|
+
return value;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
let result = {};
|
|
286
|
+
// Use as default timeout for all commands if a single integer value is provided
|
|
287
|
+
if (!isNaN(Number(value))) {
|
|
288
|
+
result[DEFAULT_TIMEOUT_KEY] = _.toInteger(value);
|
|
289
|
+
return result;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// JSON object has been provided. Let's parse it
|
|
293
|
+
try {
|
|
294
|
+
result = JSON.parse(value);
|
|
295
|
+
if (!_.isPlainObject(result)) {
|
|
296
|
+
throw new Error();
|
|
297
|
+
}
|
|
298
|
+
} catch {
|
|
299
|
+
throw log.errorWithException(
|
|
300
|
+
`"commandTimeouts" capability should be a valid JSON object. "${value}" was given instead`,
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
for (let [cmd, timeout] of _.toPairs(result)) {
|
|
304
|
+
if (!_.isInteger(timeout) || timeout <= 0) {
|
|
305
|
+
throw log.errorWithException(
|
|
306
|
+
`The timeout for "${cmd}" should be a valid natural number of milliseconds. "${timeout}" was given instead`,
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
async function printUser() {
|
|
314
|
+
try {
|
|
315
|
+
let {stdout} = await exec('whoami');
|
|
316
|
+
log.debug(`Current user: '${stdout.trim()}'`);
|
|
317
|
+
} catch (err) {
|
|
318
|
+
log.debug(`Unable to get username running server: ${err.message}`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Get the IDs of processes listening on the particular system port.
|
|
324
|
+
* It is also possible to apply additional filtering based on the
|
|
325
|
+
* process command line.
|
|
326
|
+
*
|
|
327
|
+
* @param {string|number} port - The port number.
|
|
328
|
+
* @param {?Function} filteringFunc - Optional lambda function, which
|
|
329
|
+
* receives command line string of the particular process
|
|
330
|
+
* listening on given port, and is expected to return
|
|
331
|
+
* either true or false to include/exclude the corresponding PID
|
|
332
|
+
* from the resulting array.
|
|
333
|
+
* @returns {Promise<string[]>} - the list of matched process ids.
|
|
334
|
+
*/
|
|
335
|
+
async function getPIDsListeningOnPort(port, filteringFunc = null) {
|
|
336
|
+
const result = [];
|
|
337
|
+
try {
|
|
338
|
+
// This only works since Mac OS X El Capitan
|
|
339
|
+
const {stdout} = await exec('lsof', ['-ti', `tcp:${port}`]);
|
|
340
|
+
result.push(...stdout.trim().split(/\n+/));
|
|
341
|
+
} catch {
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (!_.isFunction(filteringFunc)) {
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
return await B.filter(result, async (x) => {
|
|
349
|
+
const {stdout} = await exec('ps', ['-p', x, '-o', 'command']);
|
|
350
|
+
return await filteringFunc(stdout);
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @typedef {Object} UploadOptions
|
|
356
|
+
*
|
|
357
|
+
* @property {string} [user] - The name of the user for the remote authentication. Only works if `remotePath` is provided.
|
|
358
|
+
* @property {string} [pass] - The password for the remote authentication. Only works if `remotePath` is provided.
|
|
359
|
+
* @property {import('axios').Method} [method] - The http multipart upload method name. The 'PUT' one is used by default.
|
|
360
|
+
* Only works if `remotePath` is provided.
|
|
361
|
+
* @property {import('@appium/types').HTTPHeaders} [headers] - Additional headers mapping for multipart http(s) uploads
|
|
362
|
+
* @property {string} [fileFieldName] [file] - The name of the form field, where the file content BLOB should be stored for
|
|
363
|
+
* http(s) uploads
|
|
364
|
+
* @property {Record<string, any> | [string, any][]} [formFields] - Additional form fields for multipart http(s) uploads
|
|
365
|
+
*/
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Encodes the given local file to base64 and returns the resulting string
|
|
369
|
+
* or uploads it to a remote server using http/https or ftp protocols
|
|
370
|
+
* if `remotePath` is set
|
|
371
|
+
*
|
|
372
|
+
* @param {string} localPath - The path to an existing local file
|
|
373
|
+
* @param {string|null} [remotePath] - The path to the remote location, where
|
|
374
|
+
* this file should be uploaded
|
|
375
|
+
* @param {UploadOptions} uploadOptions - Set of upload options
|
|
376
|
+
* @returns {Promise<string>} Either an empty string if the upload was successful or
|
|
377
|
+
* base64-encoded file representation if `remotePath` is falsy
|
|
378
|
+
*/
|
|
379
|
+
async function encodeBase64OrUpload(localPath, remotePath = null, uploadOptions = {}) {
|
|
380
|
+
if (!(await fs.exists(localPath))) {
|
|
381
|
+
throw log.errorWithException(`The file at '${localPath}' does not exist or is not accessible`);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (_.isEmpty(remotePath)) {
|
|
385
|
+
const {size} = await fs.stat(localPath);
|
|
386
|
+
log.debug(`The size of the file is ${util.toReadableSizeString(size)}`);
|
|
387
|
+
return (await util.toInMemoryBase64(localPath)).toString();
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const {user, pass, method, headers, fileFieldName, formFields} = uploadOptions;
|
|
391
|
+
const options = {
|
|
392
|
+
method: method || 'PUT',
|
|
393
|
+
headers,
|
|
394
|
+
fileFieldName,
|
|
395
|
+
formFields,
|
|
396
|
+
};
|
|
397
|
+
if (user && pass) {
|
|
398
|
+
options.auth = {user, pass};
|
|
399
|
+
}
|
|
400
|
+
await net.uploadFile(localPath, /** @type {string} */ (remotePath), options);
|
|
401
|
+
return '';
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Stops and removes all web socket handlers that are listening
|
|
406
|
+
* in scope of the current session.
|
|
407
|
+
*
|
|
408
|
+
* @this {XCUITestDriver}
|
|
409
|
+
* @returns {Promise<void>}
|
|
410
|
+
*/
|
|
411
|
+
export async function removeAllSessionWebSocketHandlers() {
|
|
412
|
+
if (!this.sessionId || !_.isFunction(this.server?.getWebSocketHandlers)) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const activeHandlers = await this.server.getWebSocketHandlers(this.sessionId);
|
|
417
|
+
for (const pathname of _.keys(activeHandlers)) {
|
|
418
|
+
await this.server.removeWebSocketHandler(pathname);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Returns true if the urlString is localhost
|
|
424
|
+
* @param {string} urlString
|
|
425
|
+
* @returns {boolean} Return true if the urlString is localhost
|
|
426
|
+
*/
|
|
427
|
+
function isLocalHost(urlString) {
|
|
428
|
+
try {
|
|
429
|
+
const hostname = /** @type {string} */ (url.parse(urlString).hostname);
|
|
430
|
+
return ['localhost', '127.0.0.1', '::1', '::ffff:127.0.0.1'].includes(hostname);
|
|
431
|
+
} catch {
|
|
432
|
+
log.warn(`'${urlString}' cannot be parsed as a valid URL`);
|
|
433
|
+
}
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Normalizes platformVersion to a valid iOS version string
|
|
439
|
+
*
|
|
440
|
+
* @param {string} originalVersion - Loose version number, that can be parsed by semver
|
|
441
|
+
* @return {string} iOS version number in <major>.<minor> format
|
|
442
|
+
* @throws {Error} if the version number cannot be parsed
|
|
443
|
+
*/
|
|
444
|
+
function normalizePlatformVersion(originalVersion) {
|
|
445
|
+
const normalizedVersion = semver.coerce(originalVersion);
|
|
446
|
+
if (!normalizedVersion) {
|
|
447
|
+
throw new Error(`The platform version '${originalVersion}' should be a valid version number`);
|
|
448
|
+
}
|
|
449
|
+
return `${normalizedVersion.major}.${normalizedVersion.minor}`;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Assert the presence of particular keys in the given object
|
|
454
|
+
*
|
|
455
|
+
* @param {string|Array<string>} argNames one or more key names
|
|
456
|
+
* @param {Object} opts the object to check
|
|
457
|
+
* @returns {Object} the same given object
|
|
458
|
+
*/
|
|
459
|
+
function requireArgs(argNames, opts = {}) {
|
|
460
|
+
for (const argName of _.isArray(argNames) ? argNames : [argNames]) {
|
|
461
|
+
if (!_.has(opts, argName)) {
|
|
462
|
+
throw new errors.InvalidArgumentError(`'${argName}' argument must be provided`);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return opts;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Asserts that the given driver is running on a Simulator and return
|
|
470
|
+
* the simlator instance.
|
|
471
|
+
*
|
|
472
|
+
* @param {string} action - Description of action
|
|
473
|
+
* @param {import('./driver').XCUITestDriver} driver
|
|
474
|
+
* @returns {Simulator}
|
|
475
|
+
*/
|
|
476
|
+
export function assertSimulator(action, driver) {
|
|
477
|
+
if (!driver.isSimulator()) {
|
|
478
|
+
throw new Error(`${_.upperFirst(action)} can only be performed on Simulator`);
|
|
479
|
+
}
|
|
480
|
+
return /** @type{Simulator} */ (driver.device);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Check if platform name is the TV OS one.
|
|
485
|
+
*
|
|
486
|
+
* @param {string|null|undefined} platformName
|
|
487
|
+
* @returns {boolean}
|
|
488
|
+
*/
|
|
489
|
+
export function isTvOs(platformName) {
|
|
490
|
+
return _.toLower(platformName ?? '') === _.toLower(PLATFORM_NAME_TVOS);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Return normalized platform name.
|
|
495
|
+
*
|
|
496
|
+
* @param {string|null|undefined} platformName
|
|
497
|
+
* @returns {string}
|
|
498
|
+
*/
|
|
499
|
+
export function normalizePlatformName(platformName) {
|
|
500
|
+
return isTvOs(platformName) ? PLATFORM_NAME_TVOS : PLATFORM_NAME_IOS;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* @param {import('./driver').XCUITestDriverOpts} opts
|
|
505
|
+
* @returns {boolean}
|
|
506
|
+
*/
|
|
507
|
+
export function shouldSetInitialSafariUrl(opts) {
|
|
508
|
+
return !(opts.safariInitialUrl === '' || (opts.noReset && _.isNil(opts.safariInitialUrl)))
|
|
509
|
+
&& !opts.initialDeeplinkUrl;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @param {import('./driver').XCUITestDriverOpts} opts
|
|
514
|
+
* @returns {boolean}
|
|
515
|
+
*/
|
|
516
|
+
export function isIos17OrNewer(opts) {
|
|
517
|
+
return !!opts.platformVersion && util.compareVersions(opts.platformVersion, '>=', '17.0');
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* @param {import('./driver').XCUITestDriverOpts} opts
|
|
522
|
+
* @returns {boolean}
|
|
523
|
+
*/
|
|
524
|
+
export function isIos18OrNewer(opts) {
|
|
525
|
+
return !!opts.platformVersion && util.compareVersions(opts.platformVersion, '>=', '18.0');
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
export {
|
|
529
|
+
getAndCheckXcodeVersion,
|
|
530
|
+
getAndCheckIosSdkVersion,
|
|
531
|
+
checkAppPresent,
|
|
532
|
+
getDriverInfo,
|
|
533
|
+
clearSystemFiles,
|
|
534
|
+
translateDeviceName,
|
|
535
|
+
normalizeCommandTimeouts,
|
|
536
|
+
DEFAULT_TIMEOUT_KEY,
|
|
537
|
+
markSystemFilesForCleanup,
|
|
538
|
+
printUser,
|
|
539
|
+
getPIDsListeningOnPort,
|
|
540
|
+
encodeBase64OrUpload,
|
|
541
|
+
isLocalHost,
|
|
542
|
+
normalizePlatformVersion,
|
|
543
|
+
clearLogs,
|
|
544
|
+
requireArgs,
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* @typedef {import('@limrun/appium-xcode').XcodeVersion} XcodeVersion
|
|
549
|
+
* @typedef {import('@limrun/appium-ios-simulator').Simulator} Simulator
|
|
550
|
+
* @typedef {import('./driver').XCUITestDriver} XCUITestDriver
|
|
551
|
+
*/
|
package/lib/xcrun.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {fs} from 'appium/support';
|
|
2
|
+
|
|
3
|
+
const XCRUN = 'xcrun';
|
|
4
|
+
|
|
5
|
+
async function requireXcrun() {
|
|
6
|
+
try {
|
|
7
|
+
return await fs.which(XCRUN);
|
|
8
|
+
} catch {
|
|
9
|
+
throw new Error(
|
|
10
|
+
`${XCRUN} has not been found in PATH. ` +
|
|
11
|
+
`Please make sure XCode development tools are installed`,
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {requireXcrun, XCRUN};
|