@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,205 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import CssConverter from '../css-converter';
|
|
3
|
+
import {errors} from 'appium/driver';
|
|
4
|
+
import {util} from 'appium/support';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @this {XCUITestDriver}
|
|
8
|
+
*/
|
|
9
|
+
export async function findElOrEls(strategy, selector, mult, context) {
|
|
10
|
+
if (this.isWebview()) {
|
|
11
|
+
return await this.findWebElementOrElements(strategy, selector, mult, context);
|
|
12
|
+
} else {
|
|
13
|
+
return await this.findNativeElementOrElements(strategy, selector, mult, context);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @this {XCUITestDriver}
|
|
19
|
+
* @privateRemarks I'm not sure what these objects are; they aren't `Element`.
|
|
20
|
+
* @returns {Promise<any|any[]|undefined>}
|
|
21
|
+
*/
|
|
22
|
+
export async function findNativeElementOrElements(strategy, selector, mult, context) {
|
|
23
|
+
const initSelector = selector;
|
|
24
|
+
let rewroteSelector = false;
|
|
25
|
+
if (strategy === '-ios predicate string') {
|
|
26
|
+
// WebDriverAgent uses 'predicate string'
|
|
27
|
+
strategy = 'predicate string';
|
|
28
|
+
} else if (strategy === '-ios class chain') {
|
|
29
|
+
// WebDriverAgent uses 'class chain'
|
|
30
|
+
strategy = WDA_CLASS_CHAIN_STRATEGY;
|
|
31
|
+
} else if (strategy === 'css selector') {
|
|
32
|
+
strategy = WDA_CLASS_CHAIN_STRATEGY;
|
|
33
|
+
selector = CssConverter.toIosClassChainSelector(selector);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (strategy === 'class name') {
|
|
37
|
+
// XCUITest classes have `XCUIElementType` prepended
|
|
38
|
+
// first check if there is the old `UIA` prefix
|
|
39
|
+
if (selector.startsWith('UIA')) {
|
|
40
|
+
selector = selector.substring(3);
|
|
41
|
+
}
|
|
42
|
+
// now check if we need to add `XCUIElementType`
|
|
43
|
+
if (!selector.startsWith('XCUIElementType')) {
|
|
44
|
+
selector = stripViewFromSelector(`XCUIElementType${selector}`);
|
|
45
|
+
rewroteSelector = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (strategy === 'xpath' && MAGIC_FIRST_VIS_CHILD_SEL.test(selector)) {
|
|
50
|
+
return await this.getFirstVisibleChild(mult, context);
|
|
51
|
+
} else if (strategy === 'xpath' && MAGIC_SCROLLABLE_SEL.test(selector)) {
|
|
52
|
+
[strategy, selector] = rewriteMagicScrollable(mult, this.log);
|
|
53
|
+
} else if (strategy === 'xpath') {
|
|
54
|
+
// Replace UIA if it comes after a forward slash or is at the beginning of the string
|
|
55
|
+
selector = selector.replace(/(^|\/)(UIA)([^[/]+)/g, (str, g1, g2, g3) => {
|
|
56
|
+
rewroteSelector = true;
|
|
57
|
+
return g1 + stripViewFromSelector(`XCUIElementType${g3}`);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (rewroteSelector) {
|
|
62
|
+
this.log.info(
|
|
63
|
+
`Rewrote incoming selector from '${initSelector}' to ` +
|
|
64
|
+
`'${selector}' to match XCUI type. You should consider ` +
|
|
65
|
+
`updating your tests to use the new selectors directly`,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return await this.doNativeFind(strategy, selector, mult, context);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @this {XCUITestDriver}
|
|
74
|
+
*/
|
|
75
|
+
export async function doNativeFind(strategy, selector, mult, context) {
|
|
76
|
+
context = util.unwrapElement(context);
|
|
77
|
+
|
|
78
|
+
let endpoint = `/element${context ? `/${context}/element` : ''}${mult ? 's' : ''}`;
|
|
79
|
+
|
|
80
|
+
let body = {
|
|
81
|
+
using: strategy,
|
|
82
|
+
value: selector,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/** @type {import('./proxy-helper').AllowedHttpMethod} */
|
|
86
|
+
const method = 'POST';
|
|
87
|
+
|
|
88
|
+
// This is either an array is mult === true
|
|
89
|
+
// or an object if mult === false
|
|
90
|
+
/** @type {Element[]|undefined} */
|
|
91
|
+
let els;
|
|
92
|
+
try {
|
|
93
|
+
await this.implicitWaitForCondition(async () => {
|
|
94
|
+
try {
|
|
95
|
+
els = /** @type {Element[]|undefined} */ (
|
|
96
|
+
await this.proxyCommand(endpoint, method, body)
|
|
97
|
+
);
|
|
98
|
+
} catch {
|
|
99
|
+
els = [];
|
|
100
|
+
}
|
|
101
|
+
// we succeed if we get some elements
|
|
102
|
+
return !_.isEmpty(els);
|
|
103
|
+
});
|
|
104
|
+
} catch (err) {
|
|
105
|
+
if (err.message?.match(/Condition unmet/)) {
|
|
106
|
+
// condition was not met setting res to empty array
|
|
107
|
+
els = [];
|
|
108
|
+
} else {
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (mult) {
|
|
113
|
+
return els;
|
|
114
|
+
}
|
|
115
|
+
if (_.isEmpty(els)) {
|
|
116
|
+
throw new errors.NoSuchElementError();
|
|
117
|
+
}
|
|
118
|
+
return els;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @this {XCUITestDriver}
|
|
123
|
+
*/
|
|
124
|
+
export async function getFirstVisibleChild(mult, context) {
|
|
125
|
+
this.log.info(`Getting first visible child`);
|
|
126
|
+
if (mult) {
|
|
127
|
+
throw new Error('Cannot get multiple first visible children!');
|
|
128
|
+
}
|
|
129
|
+
if (!context) {
|
|
130
|
+
throw new Error('Cannot get first visible child without a context element');
|
|
131
|
+
}
|
|
132
|
+
let index = 1;
|
|
133
|
+
// loop through children via class-chain finds, until we run out of children
|
|
134
|
+
// or we find a visible one. This loop looks infinite but its not, because at
|
|
135
|
+
// some point the call to doNativeFind will throw with an Element Not Found
|
|
136
|
+
// error, when the index gets higher than the number of child elements. This
|
|
137
|
+
// is what we want because that error will halt the loop and make it all the
|
|
138
|
+
// way to the client.
|
|
139
|
+
while (true) {
|
|
140
|
+
const strategy = WDA_CLASS_CHAIN_STRATEGY;
|
|
141
|
+
const selector = `*[${index}]`;
|
|
142
|
+
const nthChild = await this.doNativeFind(strategy, selector, false, context);
|
|
143
|
+
const visible = await this.getAttribute('visible', nthChild);
|
|
144
|
+
if (visible === 'true') {
|
|
145
|
+
this.log.info(`Found first visible child at position ${index}`);
|
|
146
|
+
return nthChild;
|
|
147
|
+
}
|
|
148
|
+
index++;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// we override the xpath search for this first-visible-child selector, which
|
|
153
|
+
// looks like /*[@firstVisible="true"]
|
|
154
|
+
const MAGIC_FIRST_VIS_CHILD_SEL = /\/\*\[@firstVisible\s*=\s*('|")true\1\]/;
|
|
155
|
+
|
|
156
|
+
// we likewise override xpath search to provide a shortcut for finding all
|
|
157
|
+
// scrollable elements
|
|
158
|
+
const MAGIC_SCROLLABLE_SEL = /\/\/\*\[@scrollable\s*=\s*('|")true\1\]/;
|
|
159
|
+
|
|
160
|
+
const WDA_CLASS_CHAIN_STRATEGY = 'class chain';
|
|
161
|
+
|
|
162
|
+
// Check if the word 'View' is appended to selector and if it is, strip it out
|
|
163
|
+
function stripViewFromSelector(selector) {
|
|
164
|
+
// Don't strip it out if it's one of these 4 element types
|
|
165
|
+
// (see https://github.com/facebook/WebDriverAgent/blob/master/WebDriverAgentLib/Utilities/FBElementTypeTransformer.m for reference)
|
|
166
|
+
const keepView = [
|
|
167
|
+
'XCUIElementTypeScrollView',
|
|
168
|
+
'XCUIElementTypeCollectionView',
|
|
169
|
+
'XCUIElementTypeTextView',
|
|
170
|
+
'XCUIElementTypeWebView',
|
|
171
|
+
].includes(selector);
|
|
172
|
+
|
|
173
|
+
if (!keepView && selector.indexOf('View') === selector.length - 4) {
|
|
174
|
+
return selector.substr(0, selector.length - 4);
|
|
175
|
+
} else {
|
|
176
|
+
return selector;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
*
|
|
182
|
+
* @param {boolean} mult
|
|
183
|
+
* @param {import('@appium/types').AppiumLogger|null} log
|
|
184
|
+
* @returns {[string, string]}
|
|
185
|
+
*/
|
|
186
|
+
function rewriteMagicScrollable(mult, log = null) {
|
|
187
|
+
const pred = ['ScrollView', 'Table', 'CollectionView', 'WebView']
|
|
188
|
+
.map((t) => `type == "XCUIElementType${t}"`)
|
|
189
|
+
.join(' OR ');
|
|
190
|
+
const strategy = WDA_CLASS_CHAIN_STRATEGY;
|
|
191
|
+
let selector = '**/*[`' + pred + '`]';
|
|
192
|
+
if (!mult) {
|
|
193
|
+
selector += '[1]';
|
|
194
|
+
}
|
|
195
|
+
log?.info(
|
|
196
|
+
'Rewrote request for scrollable descendants to class chain ' +
|
|
197
|
+
`format with selector '${selector}'`,
|
|
198
|
+
);
|
|
199
|
+
return [strategy, selector];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
204
|
+
* @typedef {import('@appium/types').Element} Element
|
|
205
|
+
*/
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {errors} from 'appium/driver';
|
|
3
|
+
import moment from 'moment-timezone';
|
|
4
|
+
import {utilities} from 'appium-ios-device';
|
|
5
|
+
import {exec} from 'teen_process';
|
|
6
|
+
|
|
7
|
+
const MOMENT_FORMAT_ISO8601 = 'YYYY-MM-DDTHH:mm:ssZ';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @this {XCUITestDriver}
|
|
11
|
+
*/
|
|
12
|
+
export async function active() {
|
|
13
|
+
if (this.isWebContext()) {
|
|
14
|
+
return this.cacheWebElements(await this.executeAtom('active_element', []));
|
|
15
|
+
}
|
|
16
|
+
return await this.proxyCommand(`/element/active`, 'GET');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Trigger a touch/fingerprint match or match failure
|
|
21
|
+
*
|
|
22
|
+
* @param {boolean} match - whether the match should be a success or failure
|
|
23
|
+
* @this {XCUITestDriver}
|
|
24
|
+
*/
|
|
25
|
+
export async function touchId(match = true) {
|
|
26
|
+
await this.mobileSendBiometricMatch('touchId', match);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Toggle whether the device is enrolled in the touch ID program
|
|
30
|
+
*
|
|
31
|
+
* @param {boolean} isEnabled - whether to enable or disable the touch ID program
|
|
32
|
+
*
|
|
33
|
+
* @this {XCUITestDriver}
|
|
34
|
+
*/
|
|
35
|
+
export async function toggleEnrollTouchId(isEnabled = true) {
|
|
36
|
+
await this.mobileEnrollBiometric(isEnabled);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get the window size
|
|
41
|
+
* @this {XCUITestDriver}
|
|
42
|
+
* @returns {Promise<import('@appium/types').Size>}
|
|
43
|
+
*/
|
|
44
|
+
export async function getWindowSize() {
|
|
45
|
+
const {width, height} = await this.getWindowRect();
|
|
46
|
+
return {width, height};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Retrieves the actual device time.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} format - The format specifier string. Read the [MomentJS documentation](https://momentjs.com/docs/) to get the full list of supported datetime format specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601.
|
|
53
|
+
* @returns {Promise<string>} Formatted datetime string or the raw command output (if formatting fails)
|
|
54
|
+
* @this {XCUITestDriver}
|
|
55
|
+
*/
|
|
56
|
+
export async function getDeviceTime(format = MOMENT_FORMAT_ISO8601) {
|
|
57
|
+
this.log.info('Attempting to capture iOS device date and time');
|
|
58
|
+
if (!this.isRealDevice()) {
|
|
59
|
+
this.log.info('On simulator. Assuming device time is the same as host time');
|
|
60
|
+
const cmd = 'date';
|
|
61
|
+
const args = ['+%Y-%m-%dT%H:%M:%S%z'];
|
|
62
|
+
const inputFormat = 'YYYY-MM-DDTHH:mm:ssZZ';
|
|
63
|
+
const stdout = (await exec(cmd, args)).stdout.trim();
|
|
64
|
+
this.log.debug(`Got the following output out of '${cmd} ${args.join(' ')}': ${stdout}`);
|
|
65
|
+
const parsedTimestamp = moment.utc(stdout, inputFormat);
|
|
66
|
+
if (!parsedTimestamp.isValid()) {
|
|
67
|
+
this.log.warn(
|
|
68
|
+
`Cannot parse the timestamp '${stdout}' returned by '${cmd}' command. Returning it as is`,
|
|
69
|
+
);
|
|
70
|
+
return stdout;
|
|
71
|
+
}
|
|
72
|
+
// @ts-expect-error This internal prop of moment is evidently a private API
|
|
73
|
+
return parsedTimestamp.utcOffset(parsedTimestamp._tzm || 0).format(format);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const {timestamp, utcOffset, timeZone} = await utilities.getDeviceTime(this.opts.udid);
|
|
77
|
+
this.log.debug(`timestamp: ${timestamp}, utcOffset: ${utcOffset}, timeZone: ${timeZone}`);
|
|
78
|
+
const utc = moment.unix(timestamp).utc();
|
|
79
|
+
// at some point of time Apple started to return timestamps
|
|
80
|
+
// in utcOffset instead of actual UTC offsets
|
|
81
|
+
if (Math.abs(utcOffset) <= 12 * 60) {
|
|
82
|
+
return utc.utcOffset(utcOffset).format(format);
|
|
83
|
+
}
|
|
84
|
+
// timeZone could either be a time zone name or
|
|
85
|
+
// an UTC offset in seconds
|
|
86
|
+
if (_.includes(timeZone, '/')) {
|
|
87
|
+
return utc.tz(timeZone).format(format);
|
|
88
|
+
}
|
|
89
|
+
if (Math.abs(timeZone) <= 12 * 60 * 60) {
|
|
90
|
+
return utc.utcOffset(timeZone / 60).format(format);
|
|
91
|
+
}
|
|
92
|
+
this.log.warn('Did not know how to apply the UTC offset. Returning the timestamp without it');
|
|
93
|
+
return utc.format(format);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Retrieves the current device time
|
|
98
|
+
*
|
|
99
|
+
* @param {string} format - See {@linkcode getDeviceTime.format}
|
|
100
|
+
* @returns {Promise<string>} Formatted datetime string or the raw command output if formatting fails
|
|
101
|
+
* @this {XCUITestDriver}
|
|
102
|
+
*/
|
|
103
|
+
export async function mobileGetDeviceTime(format = MOMENT_FORMAT_ISO8601) {
|
|
104
|
+
return await this.getDeviceTime(format);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* For W3C
|
|
109
|
+
* @this {XCUITestDriver}
|
|
110
|
+
* @return {Promise<import('@appium/types').Rect>}
|
|
111
|
+
*/
|
|
112
|
+
export async function getWindowRect() {
|
|
113
|
+
if (this.isWebContext()) {
|
|
114
|
+
const script = 'return {' +
|
|
115
|
+
'x: window.screenX || 0,' +
|
|
116
|
+
'y: window.screenY || 0,' +
|
|
117
|
+
'width: window.innerWidth,' +
|
|
118
|
+
'height: window.innerHeight' +
|
|
119
|
+
'}';
|
|
120
|
+
return await this.executeAtom('execute_script', [script]);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return /** @type {import('@appium/types').Rect} */ (
|
|
124
|
+
await this.proxyCommand('/window/rect', 'GET')
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @this {XCUITestDriver}
|
|
130
|
+
*/
|
|
131
|
+
export async function removeApp(bundleId) {
|
|
132
|
+
return await this.mobileRemoveApp(bundleId);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @this {XCUITestDriver}
|
|
137
|
+
*/
|
|
138
|
+
export async function launchApp() {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`The launchApp API has been deprecated and is not supported anymore. ` +
|
|
141
|
+
`Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @this {XCUITestDriver}
|
|
147
|
+
*/
|
|
148
|
+
export async function closeApp() {
|
|
149
|
+
throw new Error(
|
|
150
|
+
`The closeApp API has been deprecated and is not supported anymore. ` +
|
|
151
|
+
`Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @this {XCUITestDriver}
|
|
157
|
+
* @param {string} url
|
|
158
|
+
* @returns {Promise<void>}
|
|
159
|
+
*/
|
|
160
|
+
export async function setUrl(url) {
|
|
161
|
+
this.log.debug(`Attempting to set url '${url}'`);
|
|
162
|
+
|
|
163
|
+
if (this.isWebContext()) {
|
|
164
|
+
this.setCurrentUrl(url);
|
|
165
|
+
// make sure to clear out any leftover web frames
|
|
166
|
+
this.curWebFrames = [];
|
|
167
|
+
await (/** @type {import('appium-remote-debugger').RemoteDebugger} */ (this.remote)).navToUrl(url);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (this.isRealDevice()) {
|
|
172
|
+
await this.proxyCommand('/url', 'POST', {url});
|
|
173
|
+
} else {
|
|
174
|
+
await /** @type {import('../driver').Simulator} */ (this.device).simctl.openUrl(url);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Retrieves the viewport dimensions.
|
|
180
|
+
*
|
|
181
|
+
* The viewport is the device's screen size with status bar size subtracted if the latter is present/visible.
|
|
182
|
+
* @returns {Promise<import('./types').Viewport>}
|
|
183
|
+
* @this {XCUITestDriver}
|
|
184
|
+
*/
|
|
185
|
+
export async function getViewportRect() {
|
|
186
|
+
const scale = await this.getDevicePixelRatio();
|
|
187
|
+
// status bar height comes in unscaled, so scale it
|
|
188
|
+
const statusBarHeight = Math.trunc((await this.getStatusBarHeight()) * scale);
|
|
189
|
+
const windowSize = await this.getWindowRect();
|
|
190
|
+
|
|
191
|
+
// ios returns coordinates/dimensions in logical pixels, not device pixels,
|
|
192
|
+
// so scale up to device pixels. status bar height is already scaled.
|
|
193
|
+
return {
|
|
194
|
+
left: 0,
|
|
195
|
+
top: statusBarHeight,
|
|
196
|
+
width: Math.trunc(windowSize.width * scale),
|
|
197
|
+
height: Math.trunc(windowSize.height * scale) - statusBarHeight,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Get information about the screen.
|
|
203
|
+
*
|
|
204
|
+
* @privateRemarks memoized in constructor
|
|
205
|
+
* @this {XCUITestDriver}
|
|
206
|
+
* @returns {Promise<ScreenInfo>}
|
|
207
|
+
*/
|
|
208
|
+
export async function getScreenInfo() {
|
|
209
|
+
return /** @type {ScreenInfo} */ (await this.proxyCommand('/wda/screen', 'GET'));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @this {XCUITestDriver}
|
|
214
|
+
*/
|
|
215
|
+
export async function getStatusBarHeight() {
|
|
216
|
+
const {statusBarSize} = await this.getScreenInfo();
|
|
217
|
+
return statusBarSize.height;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* memoized in constructor
|
|
222
|
+
* @this {XCUITestDriver}
|
|
223
|
+
*/
|
|
224
|
+
export async function getDevicePixelRatio() {
|
|
225
|
+
const {scale} = await this.getScreenInfo();
|
|
226
|
+
return scale;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Emulates press action on the given physical device button.
|
|
231
|
+
*
|
|
232
|
+
* This executes different methods based on the platform:
|
|
233
|
+
*
|
|
234
|
+
* - iOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuidevice/1619052-pressbutton)
|
|
235
|
+
* - tvOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton) or [`pressButton:forDuration:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton)
|
|
236
|
+
*
|
|
237
|
+
* Use {@linkcode mobilePerformIoHidEvent} to call a more universal API to perform a button press with duration on any supported device.
|
|
238
|
+
*
|
|
239
|
+
* @param {import('./types').ButtonName} name - The name of the button to be pressed.
|
|
240
|
+
* @param {number} [durationSeconds] - The duration of the button press in seconds (float).
|
|
241
|
+
* @this {XCUITestDriver}
|
|
242
|
+
*/
|
|
243
|
+
export async function mobilePressButton(name, durationSeconds) {
|
|
244
|
+
if (!name) {
|
|
245
|
+
throw new errors.InvalidArgumentError('Button name is mandatory');
|
|
246
|
+
}
|
|
247
|
+
if (!_.isNil(durationSeconds) && !_.isNumber(durationSeconds)) {
|
|
248
|
+
throw new errors.InvalidArgumentError('durationSeconds should be a number');
|
|
249
|
+
}
|
|
250
|
+
return await this.proxyCommand('/wda/pressButton', 'POST', {name, duration: durationSeconds});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Process a string as speech and send it to Siri.
|
|
255
|
+
*
|
|
256
|
+
* Presents the Siri UI, if it is not currently active, and accepts a string which is then processed as if it were recognized speech. See [the documentation of `activateWithVoiceRecognitionText`](https://developer.apple.com/documentation/xctest/xcuisiriservice/2852140-activatewithvoicerecognitiontext?language=objc) for more details.
|
|
257
|
+
|
|
258
|
+
* @param {string} text - Text to be sent to Siri
|
|
259
|
+
* @returns {Promise<void>}
|
|
260
|
+
* @this {XCUITestDriver}
|
|
261
|
+
*/
|
|
262
|
+
export async function mobileSiriCommand(text) {
|
|
263
|
+
if (!text) {
|
|
264
|
+
throw new errors.InvalidArgumentError('"text" argument is mandatory');
|
|
265
|
+
}
|
|
266
|
+
await this.proxyCommand('/wda/siri/activate', 'POST', {text});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* @typedef {Object} PressButtonOptions
|
|
271
|
+
* @property {string} name - The name of the button to be pressed.
|
|
272
|
+
* @property {number} [durationSeconds] - Duration in float seconds.
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
277
|
+
* @typedef {import('./types').ScreenInfo} ScreenInfo
|
|
278
|
+
*/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} GeolocationInfo
|
|
3
|
+
* @property {number|null} latitude Measurement of distance north or south of the Equator, or
|
|
4
|
+
* `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
|
|
5
|
+
* resetSimulatedLocation} has been called.
|
|
6
|
+
* @property {number|null} longitude Measurement of distance east or west of the prime meridian, or
|
|
7
|
+
* `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
|
|
8
|
+
* resetSimulatedLocation} has been called.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves the simulated geolocation value.
|
|
13
|
+
* Only works since Xcode 14.3/iOS 16.4
|
|
14
|
+
*
|
|
15
|
+
* @returns {Promise<GeolocationInfo>}
|
|
16
|
+
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
17
|
+
* @since 4.18
|
|
18
|
+
* @this {XCUITestDriver}
|
|
19
|
+
*/
|
|
20
|
+
export async function mobileGetSimulatedLocation() {
|
|
21
|
+
return await this.proxyCommand('/wda/simulatedLocation', 'GET');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Sets simulated geolocation value.
|
|
26
|
+
* Only works since Xcode 14.3/iOS 16.4
|
|
27
|
+
*
|
|
28
|
+
* @param {number} latitude
|
|
29
|
+
* @param {number} longitude
|
|
30
|
+
* @returns {Promise<void>}
|
|
31
|
+
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
32
|
+
* @since 4.18
|
|
33
|
+
* @this {XCUITestDriver}
|
|
34
|
+
*/
|
|
35
|
+
export async function mobileSetSimulatedLocation(latitude, longitude) {
|
|
36
|
+
return await this.proxyCommand('/wda/simulatedLocation', 'POST', {latitude, longitude});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Resets simulated geolocation value.
|
|
41
|
+
* Only works since Xcode 14.3/iOS 16.4.
|
|
42
|
+
* ! Do not forget to reset the simulated geolocation value after your automated test is finished.
|
|
43
|
+
* ! If the value is not reset explicitly then the simulated one will remain until the next device restart.
|
|
44
|
+
*
|
|
45
|
+
* @returns {Promise<void>}
|
|
46
|
+
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
47
|
+
* @since 4.18
|
|
48
|
+
* @this {XCUITestDriver}
|
|
49
|
+
*/
|
|
50
|
+
export async function mobileResetSimulatedLocation() {
|
|
51
|
+
return await this.proxyCommand('/wda/simulatedLocation', 'DELETE');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
56
|
+
*/
|