@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,497 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {fs, plist, tempDir, util} from 'appium/support';
|
|
3
|
+
import {retryInterval, retry, waitForCondition} from 'asyncbox';
|
|
4
|
+
import B from 'bluebird';
|
|
5
|
+
import os from 'os';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import http from 'http';
|
|
8
|
+
import {exec} from 'teen_process';
|
|
9
|
+
import {findAPortNotInUse, checkPortStatus} from 'portscanner';
|
|
10
|
+
import {Pyidevice} from '../real-device-clients/py-ios-device-client';
|
|
11
|
+
import {errors} from 'appium/driver';
|
|
12
|
+
|
|
13
|
+
const CONFIG_EXTENSION = 'mobileconfig';
|
|
14
|
+
const HOST_PORT_RANGE = [38200, 38299];
|
|
15
|
+
const TMPSERVER_STARTUP_TIMEOUT = 5000;
|
|
16
|
+
const Settings = /** @type {const} */ ({
|
|
17
|
+
General: {
|
|
18
|
+
type: 'accessibility id',
|
|
19
|
+
value: 'General',
|
|
20
|
+
},
|
|
21
|
+
Profile: {
|
|
22
|
+
type: '-ios predicate string',
|
|
23
|
+
value: `name BEGINSWITH 'Profile'`,
|
|
24
|
+
},
|
|
25
|
+
About: {
|
|
26
|
+
type: 'accessibility id',
|
|
27
|
+
value: 'About',
|
|
28
|
+
},
|
|
29
|
+
Certificate_Trust_Settings: {
|
|
30
|
+
type: 'accessibility id',
|
|
31
|
+
value: 'Certificate Trust Settings',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const Button = /** @type {const} */ ({
|
|
35
|
+
Install: {
|
|
36
|
+
type: 'accessibility id',
|
|
37
|
+
value: 'Install',
|
|
38
|
+
},
|
|
39
|
+
Allow: {
|
|
40
|
+
type: 'accessibility id',
|
|
41
|
+
value: 'Allow',
|
|
42
|
+
},
|
|
43
|
+
Done: {
|
|
44
|
+
type: 'accessibility id',
|
|
45
|
+
value: 'Done',
|
|
46
|
+
},
|
|
47
|
+
Return_to_Settings: {
|
|
48
|
+
type: 'accessibility id',
|
|
49
|
+
value: 'Return to Settings',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const Alert = /** @type {const} */ ({
|
|
53
|
+
Install: {
|
|
54
|
+
type: '-ios class chain',
|
|
55
|
+
value:
|
|
56
|
+
"**/XCUIElementTypeAny[`type == 'XCUIElementTypeAlert' OR type == 'XCUIElementTypeSheet'`]/**/XCUIElementTypeButton[`label == 'Install'`]",
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const LIBRE_SSL_PATTERN = /\/CN=([^\/]+)/; // eslint-disable-line no-useless-escape
|
|
61
|
+
const OPEN_SSL_PATTERN = /,\sCN\s=\s([^,]+)/;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Parses the common name of the certificate from the given string.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} stringCertificate
|
|
67
|
+
* @returns {string} The common name of the certificate
|
|
68
|
+
*/
|
|
69
|
+
export function parseCommonName(stringCertificate) {
|
|
70
|
+
const result = [LIBRE_SSL_PATTERN, OPEN_SSL_PATTERN].reduce((acc, r) => {
|
|
71
|
+
if (acc) {
|
|
72
|
+
return acc;
|
|
73
|
+
}
|
|
74
|
+
const match = r.exec(stringCertificate);
|
|
75
|
+
return match?.[1];
|
|
76
|
+
}, null);
|
|
77
|
+
if (!result) {
|
|
78
|
+
throw new Error(`There is no common name value in '${stringCertificate}' output`);
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Installs a custom certificate onto the device.
|
|
85
|
+
*
|
|
86
|
+
* Since Xcode SDK 11.4, Apple has added a dedicated `simctl` subcommand to quickly handle
|
|
87
|
+
* certificates on Simulator over CLI.
|
|
88
|
+
*
|
|
89
|
+
* On real devices (or simulators before Xcode SDK 11.4), Apple provides no "official" way to do this via the command line. In such a case (and also as a fallback if CLI setup fails), this method tries to wrap the certificate into `.mobileconfig` format, then deploys the wrapped file to the internal HTTP server so that it can be opened via mobile Safari. This command then goes through the profile installation procedure by clicking the necessary buttons using WebDriverAgent.
|
|
90
|
+
* @param {string} content - Base64-encoded content of the public certificate in [PEM](https://knowledge.digicert.com/quovadis/ssl-certificates/ssl-general-topics/what-is-pem-format.html) format
|
|
91
|
+
* @param {string} [commonName] - Common name of the certificate. If this is not set, the command will try to parse it from the provided `content`.
|
|
92
|
+
* @param {boolean} isRoot - Defines where the certificate should be installed; either the Trusted Root Store (`true`) or the Keychain (`false`). On environments other than Xcode 11.4+ Simulator, this option is ignored.
|
|
93
|
+
* @returns {Promise<string|void>} The content of the generated `.mobileconfig` file as
|
|
94
|
+
* a base64-encoded string. This config might be useful for debugging purposes. If the certificate has been successfully set via CLI, then nothing is returned.
|
|
95
|
+
* @this {XCUITestDriver}
|
|
96
|
+
*/
|
|
97
|
+
export async function mobileInstallCertificate(content, commonName, isRoot = true) {
|
|
98
|
+
if (_.isEmpty(content)) {
|
|
99
|
+
throw new Error('Certificate content should not be empty');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (this.isSimulator()) {
|
|
103
|
+
try {
|
|
104
|
+
const methodName = isRoot ? 'addRootCertificate' : 'addCertificate';
|
|
105
|
+
await /** @type {import('../driver').Simulator} */ (this.device).simctl[methodName](Buffer.from(content, 'base64').toString(), {
|
|
106
|
+
raw: true,
|
|
107
|
+
});
|
|
108
|
+
return;
|
|
109
|
+
} catch (e) {
|
|
110
|
+
this.log.debug(e);
|
|
111
|
+
this.log.info(
|
|
112
|
+
`The certificate cannot be installed via CLI. ` + `Falling back to UI-based deployment`,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
const client = new Pyidevice({
|
|
117
|
+
udid: this.opts.udid,
|
|
118
|
+
log: this.log,
|
|
119
|
+
});
|
|
120
|
+
if (await client.assertExists(false)) {
|
|
121
|
+
await client.installProfile({payload: Buffer.from(content, 'base64')});
|
|
122
|
+
return;
|
|
123
|
+
} else {
|
|
124
|
+
this.log.info(
|
|
125
|
+
'pyidevice is not installed on your system. ' +
|
|
126
|
+
'Falling back to the (slow) UI-based installation',
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const tmpRoot = await tempDir.openDir();
|
|
132
|
+
const tmpPort = await findAPortNotInUse(HOST_PORT_RANGE[0], HOST_PORT_RANGE[1]);
|
|
133
|
+
const configName = `appium.${CONFIG_EXTENSION}`;
|
|
134
|
+
const configPath = path.resolve(tmpRoot, configName);
|
|
135
|
+
const tmpServer = http.createServer(async function (_, res) {
|
|
136
|
+
const configFile = await fs.readFile(configPath);
|
|
137
|
+
res.end(configFile);
|
|
138
|
+
});
|
|
139
|
+
try {
|
|
140
|
+
const certBuffer = Buffer.from(content, 'base64');
|
|
141
|
+
const cn = commonName || (await extractCommonName(certBuffer));
|
|
142
|
+
const mobileConfig = toMobileConfig(certBuffer, cn);
|
|
143
|
+
try {
|
|
144
|
+
await plist.updatePlistFile(configPath, mobileConfig, false, false);
|
|
145
|
+
} catch (err) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
`Cannot store the generated config as '${configPath}'. ` +
|
|
148
|
+
`Original error: ${err.message}`,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
const host = os.hostname();
|
|
154
|
+
const certUrl = `http://${host}:${tmpPort}/${configName}`;
|
|
155
|
+
await tmpServer.listen(tmpPort);
|
|
156
|
+
try {
|
|
157
|
+
await waitForCondition(
|
|
158
|
+
async () => {
|
|
159
|
+
try {
|
|
160
|
+
return (await checkPortStatus(tmpPort, host)) === 'open';
|
|
161
|
+
} catch {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
waitMs: TMPSERVER_STARTUP_TIMEOUT,
|
|
167
|
+
intervalMs: 300,
|
|
168
|
+
},
|
|
169
|
+
);
|
|
170
|
+
this.log.debug(`The temporary web server is running at http://${host}:${tmpPort}`);
|
|
171
|
+
} catch {
|
|
172
|
+
throw new Error(
|
|
173
|
+
`The temporary web server cannot be started at http://${host}:${tmpPort}.`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
if (this.isRealDevice()) {
|
|
177
|
+
try {
|
|
178
|
+
await this.proxyCommand('/url', 'POST', {url: certUrl});
|
|
179
|
+
} catch (err) {
|
|
180
|
+
if (this.isWebContext()) {
|
|
181
|
+
// The command above does not always work on real devices
|
|
182
|
+
await this.setUrl(certUrl);
|
|
183
|
+
} else {
|
|
184
|
+
throw err;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
await /** @type {import('../driver').Simulator} */ (this.device).openUrl(certUrl);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let isCertAlreadyInstalled = false;
|
|
192
|
+
if (util.compareVersions(/** @type {string} */ (this.opts.platformVersion), '>=', '12.2')) {
|
|
193
|
+
if (await installPost122Certificate(this, cn)) {
|
|
194
|
+
await clickElement(this, Settings.Profile);
|
|
195
|
+
await trustCertificateInPreferences(this, cn);
|
|
196
|
+
} else {
|
|
197
|
+
isCertAlreadyInstalled = true;
|
|
198
|
+
}
|
|
199
|
+
} else {
|
|
200
|
+
if (await installPre122Certificate(this)) {
|
|
201
|
+
await clickElement(this, Button.Return_to_Settings);
|
|
202
|
+
await trustCertificateInPreferences(this, cn);
|
|
203
|
+
} else {
|
|
204
|
+
isCertAlreadyInstalled = true;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (isCertAlreadyInstalled) {
|
|
208
|
+
this.log.info(
|
|
209
|
+
`It looks like the '${cn}' certificate has been already added to the CA root`,
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
} finally {
|
|
213
|
+
if (this.opts.bundleId) {
|
|
214
|
+
try {
|
|
215
|
+
await this.activateApp(this.opts.bundleId);
|
|
216
|
+
} catch (e) {
|
|
217
|
+
this.log.warn(
|
|
218
|
+
`Cannot restore the application '${this.opts.bundleId}'. Original error: ${e.message}`,
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return (await util.toInMemoryBase64(configPath)).toString();
|
|
225
|
+
} finally {
|
|
226
|
+
await tmpServer.close();
|
|
227
|
+
await fs.rimraf(tmpRoot);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Removes installed certificates.
|
|
233
|
+
*
|
|
234
|
+
* This only works _if and only if_ `py-ios-device` is installed on the same machine Appium is running on.
|
|
235
|
+
*
|
|
236
|
+
* @see https://github.com/YueChen-C/py-ios-device
|
|
237
|
+
* @since 4.19.2
|
|
238
|
+
* @param {string} name - Name of the profile
|
|
239
|
+
* @returns {Promise<string>} Returns status acknowledgment status if
|
|
240
|
+
* tht certificate is successfully removed or 'None' (basically just
|
|
241
|
+
* forwards the original pyidevice output)
|
|
242
|
+
* @throws {Error} If attempting to remove certificates for a simulated device or if `py-ios-device` is not installed
|
|
243
|
+
* @group Real Device Only
|
|
244
|
+
*/
|
|
245
|
+
export async function mobileRemoveCertificate(name) {
|
|
246
|
+
if (!this.isRealDevice()) {
|
|
247
|
+
throw new errors.NotImplementedError('This extension is only supported on real devices');
|
|
248
|
+
}
|
|
249
|
+
const client = new Pyidevice({
|
|
250
|
+
udid: this.opts.udid,
|
|
251
|
+
log: this.log,
|
|
252
|
+
});
|
|
253
|
+
await client.assertExists(true);
|
|
254
|
+
return await client.removeProfile(name);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Returns map of certificates installed on the real device.
|
|
259
|
+
*
|
|
260
|
+
* This only works _if and only if_ `py-ios-device` is installed on the same machine Appium is running on.
|
|
261
|
+
* @since 4.10.0
|
|
262
|
+
* @see https://github.com/YueChen-C/py-ios-device
|
|
263
|
+
* @returns {Promise<import('./types').CertificateList>} An object describing the certificates installed on the real device.
|
|
264
|
+
* @throws {Error} If attempting to list certificates for a simulated device or if `py-ios-device` is not installed
|
|
265
|
+
* @this {XCUITestDriver}
|
|
266
|
+
*/
|
|
267
|
+
export async function mobileListCertificates() {
|
|
268
|
+
if (!this.isRealDevice()) {
|
|
269
|
+
throw new errors.NotImplementedError('This extension is only supported on real devices');
|
|
270
|
+
}
|
|
271
|
+
const client = new Pyidevice({
|
|
272
|
+
udid: this.opts.udid,
|
|
273
|
+
log: this.log,
|
|
274
|
+
});
|
|
275
|
+
await client.assertExists(true);
|
|
276
|
+
return await client.listProfiles();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Extracts the common name of the certificate from the given buffer.
|
|
282
|
+
*
|
|
283
|
+
* @param {Buffer} certBuffer
|
|
284
|
+
* @returns {Promise<string>} The common name of the certificate
|
|
285
|
+
*/
|
|
286
|
+
async function extractCommonName(certBuffer) {
|
|
287
|
+
const tempCert = await tempDir.open({
|
|
288
|
+
prefix: 'cert',
|
|
289
|
+
suffix: '.cer',
|
|
290
|
+
});
|
|
291
|
+
try {
|
|
292
|
+
await fs.writeFile(tempCert.path, certBuffer);
|
|
293
|
+
const {stdout} = await exec('openssl', ['x509', '-noout', '-subject', '-in', tempCert.path]);
|
|
294
|
+
return parseCommonName(stdout);
|
|
295
|
+
} catch (err) {
|
|
296
|
+
throw new Error(
|
|
297
|
+
`Cannot parse common name value from the certificate. Is it valid and base64-encoded? ` +
|
|
298
|
+
`Original error: ${err.message}`,
|
|
299
|
+
);
|
|
300
|
+
} finally {
|
|
301
|
+
await fs.rimraf(tempCert.path);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Generates Apple's over-the-air configuration profile
|
|
307
|
+
* for certificate deployment based on the given PEM certificate content.
|
|
308
|
+
* Read https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/iPhoneOTAConfiguration/Introduction/Introduction.html
|
|
309
|
+
* for more details on such profiles.
|
|
310
|
+
*
|
|
311
|
+
* @param {Buffer} certBuffer - The actual content of PEM certificate encoded into NodeJS buffer
|
|
312
|
+
* @param {string} commonName - Certificate's common name
|
|
313
|
+
* @returns {Object} The encoded structure of the given certificate, which is ready to be passed
|
|
314
|
+
* as an argument to plist builder
|
|
315
|
+
* @throws {Error} If the given certificate cannot be parsed
|
|
316
|
+
*/
|
|
317
|
+
function toMobileConfig(certBuffer, commonName) {
|
|
318
|
+
const getUUID = () => util.uuidV4().toUpperCase();
|
|
319
|
+
const contentUuid = getUUID();
|
|
320
|
+
return {
|
|
321
|
+
PayloadContent: [
|
|
322
|
+
{
|
|
323
|
+
PayloadCertificateFileName: `${commonName}.cer`,
|
|
324
|
+
PayloadContent: certBuffer,
|
|
325
|
+
PayloadDescription: 'Adds a CA root certificate',
|
|
326
|
+
PayloadDisplayName: commonName,
|
|
327
|
+
PayloadIdentifier: `com.apple.security.root.${contentUuid}`,
|
|
328
|
+
PayloadType: 'com.apple.security.root',
|
|
329
|
+
PayloadUUID: contentUuid,
|
|
330
|
+
PayloadVersion: 1,
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
PayloadDisplayName: commonName,
|
|
334
|
+
PayloadIdentifier: `${os.hostname().split('.')[0]}.${getUUID()}`,
|
|
335
|
+
PayloadRemovalDisallowed: false,
|
|
336
|
+
PayloadType: 'Configuration',
|
|
337
|
+
PayloadUUID: getUUID(),
|
|
338
|
+
PayloadVersion: 1,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
async function clickElement(driver, locator, options = {}) {
|
|
343
|
+
let element = null;
|
|
344
|
+
const {timeout = 5000, skipIfInvisible = false} = options;
|
|
345
|
+
const lookupDelay = 500;
|
|
346
|
+
try {
|
|
347
|
+
element = await retryInterval(
|
|
348
|
+
timeout < lookupDelay ? 1 : timeout / lookupDelay,
|
|
349
|
+
lookupDelay,
|
|
350
|
+
() => driver.findNativeElementOrElements(locator.type, locator.value, false),
|
|
351
|
+
);
|
|
352
|
+
} catch {
|
|
353
|
+
if (skipIfInvisible) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
throw new Error(`Cannot find ${JSON.stringify(locator)} within ${timeout}ms timeout`);
|
|
357
|
+
}
|
|
358
|
+
await driver.nativeClick(element);
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
async function installPre122Certificate(driver) {
|
|
363
|
+
// Accept Safari alert
|
|
364
|
+
await clickElement(driver, Button.Allow, {
|
|
365
|
+
// certificate load might take some time on slow machines
|
|
366
|
+
timeout: 15000,
|
|
367
|
+
});
|
|
368
|
+
// Wait until Preferences are opened
|
|
369
|
+
await B.delay(2000);
|
|
370
|
+
|
|
371
|
+
// Go through Preferences wizard
|
|
372
|
+
if (
|
|
373
|
+
!(await clickElement(driver, Button.Install, {
|
|
374
|
+
skipIfInvisible: true,
|
|
375
|
+
}))
|
|
376
|
+
) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
// We need to click Install button on two different tabs
|
|
380
|
+
// The second one confirms the previous
|
|
381
|
+
await B.delay(1500);
|
|
382
|
+
await clickElement(driver, Button.Install);
|
|
383
|
+
// Accept alert
|
|
384
|
+
await clickElement(driver, Alert.Install);
|
|
385
|
+
// Finish adding certificate
|
|
386
|
+
await clickElement(driver, Button.Done);
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
async function trustCertificateInPreferences(driver, name) {
|
|
391
|
+
await clickElement(driver, Settings.General);
|
|
392
|
+
await clickElement(driver, Settings.About);
|
|
393
|
+
const switchLocator = {
|
|
394
|
+
type: '-ios class chain',
|
|
395
|
+
value: `**/XCUIElementTypeCell[\`label == '${name}'\`]/**/XCUIElementTypeSwitch`,
|
|
396
|
+
};
|
|
397
|
+
await retry(5, async () => {
|
|
398
|
+
await driver.mobileSwipe({
|
|
399
|
+
element: await driver.findNativeElementOrElements(
|
|
400
|
+
'class name',
|
|
401
|
+
'XCUIElementTypeTable',
|
|
402
|
+
false,
|
|
403
|
+
),
|
|
404
|
+
direction: 'up',
|
|
405
|
+
});
|
|
406
|
+
await clickElement(driver, Settings.Certificate_Trust_Settings, {
|
|
407
|
+
timeout: 500,
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
await driver.findNativeElementOrElements(switchLocator.type, switchLocator.value, false);
|
|
411
|
+
});
|
|
412
|
+
// Only click the switch if it is set to Off
|
|
413
|
+
if (
|
|
414
|
+
await clickElement(
|
|
415
|
+
driver,
|
|
416
|
+
{
|
|
417
|
+
type: switchLocator.type,
|
|
418
|
+
value: `${switchLocator.value}[\`value == '0'\`]`,
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
timeout: 1000,
|
|
422
|
+
skipIfInvisible: true,
|
|
423
|
+
},
|
|
424
|
+
)
|
|
425
|
+
) {
|
|
426
|
+
await driver.postAcceptAlert();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
async function installPost122Certificate(driver, name) {
|
|
431
|
+
// Accept Safari alert
|
|
432
|
+
await clickElement(driver, Button.Allow, {
|
|
433
|
+
// certificate load might take some time on slow machines
|
|
434
|
+
timeout: 15000,
|
|
435
|
+
});
|
|
436
|
+
// Wait for the second alert
|
|
437
|
+
await B.delay(2000);
|
|
438
|
+
|
|
439
|
+
await driver.postAcceptAlert();
|
|
440
|
+
await driver.activateApp('com.apple.Preferences');
|
|
441
|
+
await clickElement(driver, Settings.General);
|
|
442
|
+
await clickElement(driver, Settings.Profile);
|
|
443
|
+
// Select the target cert
|
|
444
|
+
let isCertFound = false;
|
|
445
|
+
for (let swipeNum = 0; swipeNum < 5; ++swipeNum) {
|
|
446
|
+
if (
|
|
447
|
+
await clickElement(
|
|
448
|
+
driver,
|
|
449
|
+
{
|
|
450
|
+
type: '-ios class chain',
|
|
451
|
+
value: `**/XCUIElementTypeCell[\`label == '${name}'\`]`,
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
timeout: 500,
|
|
455
|
+
skipIfInvisible: true,
|
|
456
|
+
},
|
|
457
|
+
)
|
|
458
|
+
) {
|
|
459
|
+
isCertFound = true;
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
await driver.mobileSwipe({
|
|
464
|
+
element: await driver.findNativeElementOrElements(
|
|
465
|
+
'class name',
|
|
466
|
+
'XCUIElementTypeTable',
|
|
467
|
+
false,
|
|
468
|
+
),
|
|
469
|
+
direction: 'up',
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
if (!isCertFound) {
|
|
473
|
+
throw new Error(`'${name}' cannot be found in the certificates list`);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// Install option is only visible if the cert is not installed yet
|
|
477
|
+
if (
|
|
478
|
+
!(await clickElement(driver, Button.Install, {
|
|
479
|
+
skipIfInvisible: true,
|
|
480
|
+
}))
|
|
481
|
+
) {
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
await B.delay(1500);
|
|
485
|
+
// Confirm untrusted cert install
|
|
486
|
+
await clickElement(driver, Button.Install);
|
|
487
|
+
// Accept alert
|
|
488
|
+
await clickElement(driver, Alert.Install);
|
|
489
|
+
// Finish adding certificate
|
|
490
|
+
await clickElement(driver, Button.Done);
|
|
491
|
+
|
|
492
|
+
return true;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
497
|
+
*/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets the primary clipboard's content on the device under test.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} content - The content to be set as base64 encoded string.
|
|
5
|
+
* @param {string} [contentType=plaintext] - The type of the content to set.
|
|
6
|
+
* Only `plaintext`, 'image and 'url' are supported.
|
|
7
|
+
* @this {XCUITestDriver}
|
|
8
|
+
*/
|
|
9
|
+
export async function setClipboard(content, contentType) {
|
|
10
|
+
await this.proxyCommand('/wda/setPasteboard', 'POST', {
|
|
11
|
+
content,
|
|
12
|
+
contentType,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Gets the content of the primary clipboard on the device under test.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} [contentType=plaintext] - The type of the content to get.
|
|
20
|
+
* Only `plaintext`, 'image and 'url' are supported.
|
|
21
|
+
* @returns {Promise<string>} The actual clipboard content encoded into base64 string.
|
|
22
|
+
* An empty string is returned if the clipboard contains no data.
|
|
23
|
+
* @this {XCUITestDriver}
|
|
24
|
+
*/
|
|
25
|
+
export async function getClipboard(contentType) {
|
|
26
|
+
return /** @type {string} */ (
|
|
27
|
+
await this.proxyCommand('/wda/getPasteboard', 'POST', {
|
|
28
|
+
contentType,
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
35
|
+
*/
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import {INSTRUMENT_CHANNEL, services} from 'appium-ios-device';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get all available ConditionInducer configuration information, which can be used with
|
|
6
|
+
* {@linkcode XCUITestDriver.enableConditionInducer}
|
|
7
|
+
* @returns {Promise<Condition[]>}
|
|
8
|
+
* @since 4.9.0
|
|
9
|
+
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
10
|
+
* @this {XCUITestDriver}
|
|
11
|
+
*/
|
|
12
|
+
export async function listConditionInducers() {
|
|
13
|
+
requireConditionInducerCompatibleDevice.bind(this);
|
|
14
|
+
const conditionInducerService = await services.startInstrumentService(this.device.udid);
|
|
15
|
+
try {
|
|
16
|
+
const ret = await conditionInducerService.callChannel(
|
|
17
|
+
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
18
|
+
'availableConditionInducers',
|
|
19
|
+
);
|
|
20
|
+
return ret.selector;
|
|
21
|
+
} finally {
|
|
22
|
+
conditionInducerService.close();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Enable a "condition inducer". You can create a condition on a connected device to test your app under adverse conditions,
|
|
28
|
+
* such as poor network connectivity or thermal constraints. When you start a device condition,
|
|
29
|
+
* the operating system on the device behaves as if its environment has changed. The device
|
|
30
|
+
* condition remains active until you stop the device condition or disconnect the device. For
|
|
31
|
+
* example, you can start a device condition, run your app, monitor your app's energy usage, and
|
|
32
|
+
* then stop the condition.
|
|
33
|
+
*
|
|
34
|
+
* (Note: the socket needs to remain connected during operation)
|
|
35
|
+
* (Note: Device conditions are available only for real devices running iOS 13.0 and later.)
|
|
36
|
+
*
|
|
37
|
+
* @param {string} conditionID - Determine which condition IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
38
|
+
* @param {string} profileID - Determine which profile IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
39
|
+
* @returns {Promise<boolean>} `true` if enabling the condition succeeded
|
|
40
|
+
* @throws {Error} If you try to start another Condition and the previous Condition has not stopped
|
|
41
|
+
* @since 4.9.0
|
|
42
|
+
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
43
|
+
* @this {XCUITestDriver}
|
|
44
|
+
*/
|
|
45
|
+
export async function enableConditionInducer(conditionID, profileID) {
|
|
46
|
+
requireConditionInducerCompatibleDevice.bind(this);
|
|
47
|
+
if (this._conditionInducerService && !this._conditionInducerService._socketClient.destroyed) {
|
|
48
|
+
throw this.log.errorWithException(
|
|
49
|
+
`Condition inducer has been started. A condition is already active.`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
this._conditionInducerService = await services.startInstrumentService(this.device.udid);
|
|
53
|
+
const ret = await this._conditionInducerService.callChannel(
|
|
54
|
+
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
55
|
+
'enableConditionWithIdentifier:profileIdentifier:',
|
|
56
|
+
conditionID,
|
|
57
|
+
profileID,
|
|
58
|
+
);
|
|
59
|
+
if (!_.isBoolean(ret.selector)) {
|
|
60
|
+
this._conditionInducerService.close();
|
|
61
|
+
this._conditionInducerService = null;
|
|
62
|
+
throw this.log.errorWithException(`Enable condition inducer error: '${JSON.stringify(ret.selector)}'`);
|
|
63
|
+
}
|
|
64
|
+
return ret.selector;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Disable a condition inducer enabled with {@linkcode XCUITestDriver.enableConditionInducer} Usually
|
|
69
|
+
* a persistent connection is maintained after the condition inducer is enabled, and this method
|
|
70
|
+
* is only valid for the currently enabled connection. If the connection is disconnected, the
|
|
71
|
+
* condition inducer will be automatically disabled
|
|
72
|
+
*
|
|
73
|
+
* (Note: this is also automatically called upon session cleanup)
|
|
74
|
+
* @returns {Promise<boolean>} `true` if disable the condition succeeded
|
|
75
|
+
* @since 4.9.0
|
|
76
|
+
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
77
|
+
* @this {XCUITestDriver}
|
|
78
|
+
*/
|
|
79
|
+
export async function disableConditionInducer() {
|
|
80
|
+
if (!this._conditionInducerService) {
|
|
81
|
+
this.log.warn('Condition inducer server is not started');
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const ret = await this._conditionInducerService.callChannel(
|
|
86
|
+
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
87
|
+
'disableActiveCondition',
|
|
88
|
+
);
|
|
89
|
+
if (!_.isBoolean(ret.selector)) {
|
|
90
|
+
this.log.warn(`Disable condition inducer error: '${JSON.stringify(ret.selector)}'`);
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return ret.selector;
|
|
94
|
+
} finally {
|
|
95
|
+
if (this._conditionInducerService) {
|
|
96
|
+
this._conditionInducerService.close();
|
|
97
|
+
this._conditionInducerService = null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @this {XCUITestDriver}
|
|
104
|
+
* @returns {void}
|
|
105
|
+
*/
|
|
106
|
+
function requireConditionInducerCompatibleDevice() {
|
|
107
|
+
if (this.isSimulator()) {
|
|
108
|
+
throw this.log.errorWithException('Condition inducer only works on real devices');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @typedef {Object} Profile
|
|
114
|
+
* @property {string} name
|
|
115
|
+
* @property {string} identifier the property is profileID used in {@linkcode XCUITestDriver.enableConditionInducer}
|
|
116
|
+
* @property {string} description Configuration details
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* We can use the returned data to determine whether the Condition is enabled and the currently enabled configuration information
|
|
121
|
+
* @typedef {Object} Condition
|
|
122
|
+
* @property {Profile[]} profiles
|
|
123
|
+
* @property {string} identifier the property is conditionID used in {@linkcode XCUITestDriver.enableConditionInducer}
|
|
124
|
+
* @property {boolean} profilesSorted
|
|
125
|
+
* @property {boolean} isDestructive
|
|
126
|
+
* @property {boolean} isInternal
|
|
127
|
+
* @property {boolean} isActive `true` if this condition identifier is enabled
|
|
128
|
+
* @property {string} activeProfile enabled profiles identifier
|
|
129
|
+
* @example {
|
|
130
|
+
* "profiles": [
|
|
131
|
+
* {
|
|
132
|
+
* "name": "100% packet loss",
|
|
133
|
+
* "identifier": "SlowNetwork100PctLoss", // MobileEnableConditionInducer profileID
|
|
134
|
+
* "description": "Name: 100% Loss Scenario\n
|
|
135
|
+
* Downlink Bandwidth: 0 Mbps\n
|
|
136
|
+
* Downlink Latency:0 ms\n
|
|
137
|
+
* Downlink Packet Loss Ratio: 100%\n
|
|
138
|
+
* Uplink Bandwidth: 0 Mbps\n
|
|
139
|
+
* Uplink Latency: 0 ms\n
|
|
140
|
+
* Uplink Packet Loss Ratio: 100%"
|
|
141
|
+
* }
|
|
142
|
+
* ],
|
|
143
|
+
* "profilesSorted": true,
|
|
144
|
+
* "identifier": "SlowNetworkCondition", // MobileEnableConditionInducer conditionID
|
|
145
|
+
* "isDestructive": false,
|
|
146
|
+
* "isInternal": false,
|
|
147
|
+
* "activeProfile": "",
|
|
148
|
+
* "name": "Network Link",
|
|
149
|
+
* "isActive": false
|
|
150
|
+
* }
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
155
|
+
*/
|