appium-xcuitest-driver 3.43.0 → 3.46.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.
Files changed (44) hide show
  1. package/README.md +311 -18
  2. package/build/index.js +12 -9
  3. package/build/lib/app-utils.js +188 -0
  4. package/build/lib/commands/certificate.js +2 -4
  5. package/build/lib/commands/context.js +223 -18
  6. package/build/lib/commands/element.js +48 -6
  7. package/build/lib/commands/execute.js +35 -10
  8. package/build/lib/commands/file-movement.js +2 -4
  9. package/build/lib/commands/general.js +86 -13
  10. package/build/lib/commands/gesture.js +100 -75
  11. package/build/lib/commands/index.js +4 -2
  12. package/build/lib/commands/localization.js +34 -0
  13. package/build/lib/commands/log.js +52 -11
  14. package/build/lib/commands/timeouts.js +49 -5
  15. package/build/lib/commands/web.js +349 -6
  16. package/build/lib/cookies.js +82 -0
  17. package/build/lib/desired-caps.js +91 -17
  18. package/build/lib/device-log/ios-crash-log.js +31 -5
  19. package/build/lib/device-log/ios-performance-log.js +66 -0
  20. package/build/lib/driver.js +17 -7
  21. package/build/lib/simulator-management.js +189 -1
  22. package/build/lib/utils.js +40 -41
  23. package/index.js +6 -3
  24. package/lib/app-utils.js +159 -0
  25. package/lib/commands/certificate.js +1 -2
  26. package/lib/commands/context.js +205 -17
  27. package/lib/commands/element.js +41 -5
  28. package/lib/commands/execute.js +34 -11
  29. package/lib/commands/file-movement.js +1 -2
  30. package/lib/commands/general.js +83 -11
  31. package/lib/commands/gesture.js +89 -58
  32. package/lib/commands/index.js +2 -1
  33. package/lib/commands/localization.js +46 -0
  34. package/lib/commands/log.js +51 -9
  35. package/lib/commands/timeouts.js +38 -3
  36. package/lib/commands/web.js +297 -4
  37. package/lib/cookies.js +96 -0
  38. package/lib/desired-caps.js +93 -11
  39. package/lib/device-log/ios-crash-log.js +31 -5
  40. package/lib/device-log/ios-performance-log.js +54 -0
  41. package/lib/driver.js +21 -9
  42. package/lib/simulator-management.js +171 -2
  43. package/lib/utils.js +34 -49
  44. package/package.json +9 -8
package/README.md CHANGED
@@ -111,8 +111,8 @@ Capability | Description
111
111
  `appium:app` | Full path to the application to be tested (the app must be located on the same machine where the server is running). `.ipa` and `.app` application extensions are supported. Zipped `.app` bundles are supported as well. Could also be an URL to a remote location. If neither of the `app` or `bundleId` capabilities are provided then the driver starts from the Home screen and expects the test to know what to do next. Do not provide both `app` and `browserName` capabilities at once.
112
112
  `appium:localizableStringsDir` | Where to look for localizable strings in the application bundle. Defaults to `en.lproj`
113
113
  `appium:otherApps` | App or list of apps (as a JSON array) to install prior to running tests. Note that it will not work with iOS real devices. Fore example: `["http://appium.github.io/appium/assets/TestApp9.4.app.zip", "/path/to/app-b.app"]`
114
- `appium:language` | Language to set for iOS, for example `fr`
115
- `appium:locale` | Locale to set for iOS, for example `fr_CA`
114
+ `appium:language` | Language to set for iOS, for example `fr`. Please read [Language IDs](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html) to get more details abuot available values for this capability.
115
+ `appium:locale` | Locale to set for iOS, for example `fr_CA`. Please read [Locale IDs](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html#//apple_ref/doc/uid/10000171i-CH15-SW9) to get more details abuot available values for this capability.
116
116
  `appium:appPushTimeout` | The timeout for application upload in milliseconds. Works for real devices only. The default value is `30000`ms
117
117
 
118
118
  ### WebDriverAgent
@@ -341,7 +341,7 @@ one to select or value selection suing `sendKeys` API does not work because of a
341
341
 
342
342
  Name | Type | Required | Description | Example
343
343
  --- | --- | --- | --- | ---
344
- element | string | yes | PickerWheel's internal element id (as hexadecimal hash string) to perform value selection on. The element must be of type XCUIElementTypePickerWheel | abcdef12-1111-2222-3333-444444
344
+ elementId (`element` before version 1.22) | string | yes | PickerWheel's internal element id (as hexadecimal hash string) to perform value selection on. The element must be of type XCUIElementTypePickerWheel | abcdef12-1111-2222-3333-444444
345
345
  order | string | yes | Either `next` to select the value next to the current one from the target picker wheel or `previous` to select the previous one. | next
346
346
  offset | number | no | The value in range [0.01, 0.5]. It defines how far from picker wheel's center the click should happen. The actual distance is calculated by multiplying this value to the actual picker wheel height. Too small offset value may not change the picker wheel value and too high value may cause the wheel to switch two or more values at once. Usually the optimal value is located in range [0.15, 0.3]. `0.2` by default | 0.15
347
347
 
@@ -617,13 +617,15 @@ Check the `+ (id<FBResponsePayload>)handleActiveAppInfo:(FBRouteRequest *)reques
617
617
 
618
618
  ### mobile: pressButton
619
619
 
620
- Emulates press action on the given physical device button.
620
+ Emulates press action on the given physical device button. iOS is [pressButton:](https://developer.apple.com/documentation/xctest/xcuidevice/1619052-pressbutton), tvOS is [pressButton:](https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton) or [pressButton:forDuration:](https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton).
621
+ [mobile: performIoHidEvent](#mobile-performiohidevent) calls a more universal API to perform press with duration on any supported device.
621
622
 
622
623
  #### Arguments
623
624
 
624
625
  Name | Type | Required | Description | Example
625
626
  --- | --- | --- | --- | ---
626
627
  name | string | yes | The name of the button to be pressed. Supported button names for iOS-based devices are (case-insensitive): `home`, `volumeup`, `volumedown`. For tvOS-based devices (case-insensitive): `home`, `up`, `down`, `left`, `right`, `menu`, `playpause`, `select` | home
628
+ durationSeconds | number | no | Duration in float seconds for tvOS-based devices since Appium 1.22.0 | 10
627
629
 
628
630
  ### mobile: pushNotification
629
631
 
@@ -637,7 +639,7 @@ command for more details.
637
639
  Name | Type | Required | Description | Example
638
640
  --- | --- | --- | --- | ---
639
641
  bundleId | string | yes | The bundle identifier of the target application | com.apple.Preferences
640
- payload | map | yes | Valid Apple Push Notification values. Read the `Create the JSON Payload` topic of the [official Apple documentation](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification?language=objc) for more details on the payload creation. | `{"aps": {"alert": "This is a simulated notification!", "badge": 3, "sound": "default"} }`
642
+ payload | map | yes | Valid Apple Push Notification values. Read the `Create the JSON Payload` topic of the [official Apple documentation](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification?language=objc) for more details on the payload creation. | `{"aps": {"alert": {"title": "This is a simulated notification!"}, "badge": 3, "sound": "default"} }`
641
643
 
642
644
  ### mobile: expectNotification
643
645
 
@@ -800,6 +802,28 @@ Name | Type | Required | Description | Example
800
802
  --- | --- | --- | --- | ---
801
803
  remotePath | string | yes | Same value as for `mobile: deleteFile` except of the fact it should be pointing to a folder and should end with a single slash `/` | @com.mycompany.myapp:documents/myfolder/
802
804
 
805
+ ### mobile: configureLocalization
806
+
807
+ Change localization settings on the currently booted Simulator.
808
+ The changed settings are only applied for the *newly started* applications/activities.
809
+ Currently running applications will stay unchanged. This means, for example, that the keyboard
810
+ should be hidden and shown again in order to observe the changed layout, and curresponding
811
+ apps must be restarted in order to observe their interface using the newly set locale/language.
812
+ Be careful while setting the actual arguments since their actual values are not strictly checked.
813
+ This could lead to an unexpected behavior if an incorrect/unsupported language or locale abbreviation is provided.
814
+
815
+ #### Arguments
816
+
817
+ Name | Type | Required | Description | Example
818
+ --- | --- | --- | --- | ---
819
+ keyboard | map | no | On-screen keyboard properties. The `name` key is required and should be set to a valid locale abbreviation. The `layout` key is also required. The `hardware` key is optional and could be omitted or set to `Automated`. You could switch the keyboard layout in system preferences of your booted simulator, run `xcrun simctl spawn booted defaults read .GlobalPreferences.plist`, and inspect the value of `AppleKeyboards` to see possible combinations. | `{"name": "de_CH", "layout": "QWERTZ", "hardware": "Automated"}`
820
+ language | map | no | System language properties. The `name` key is required and should be set to a valid language abbreviation. You could switch the system language in preferences of your booted simulator, run `xcrun simctl spawn booted defaults read .GlobalPreferences.plist`, and inspect the value of `AppleLanguages` to see possible combinations. | `{"name": "zh-Hant-CN"}`
821
+ locale | map | no | System locale properties. The `name` key is required and should be set to a valid language abbreviation. The `calendar`key is optonal and could be set to a valid calendar format name. You could switch the system locale/calendar format in preferences of your booted simulator, run `xcrun simctl spawn booted defaults read .GlobalPreferences.plist`, and inspect the value of `AppleLocale` to see possible combinations. | `{"name": "uk_UA", "calendar": "gregorian"}`
822
+
823
+ #### Returned Result
824
+
825
+ `true` if any of settings has been successfully changed.
826
+
803
827
  ### mobile: startAudioRecording
804
828
 
805
829
  Records the given hardware audio input into an .mp4 file. You must allow the `audio_record` security feature in order to use this extension. Also it is required that [FFMpeg](https://ffmpeg.org/) is installed on the machibe where Appium server is running.
@@ -910,24 +934,293 @@ The response looks like `{"value":{"statusBarSize":{"width":414,"height":48},"sc
910
934
  `statusBarSize` contains status bar dimensions. It is the result of [status bar](https://developer.apple.com/documentation/xctest/xcuielementtypequeryprovider/1500428-statusbars).
911
935
  `scale` is [screen scale](https://developer.apple.com/documentation/uikit/uiscreen/1617836-scale).
912
936
 
937
+ ### mobile: swipe
938
+
939
+ This gesture performs a simple "swipe" gesture on the particular screen element or
940
+ on the application element, which is usually the whole screen. This method does not
941
+ accept coordinates and simply emulates single swipe with one finger. It might be
942
+ useful for such cases like album pagination, switching views, etc. More advanced
943
+ cases may require to call [mobile: dragFromToForDuration](#mobile-dragfromtoforduration),
944
+ where one can supply coordinates and duration.
945
+
946
+ #### Arguments
947
+
948
+ Name | Type | Required | Description | Example
949
+ --- | --- | --- | --- | ---
950
+ elementId ("element" prior to Appium v 1.22) | string | no | The internal element identifier (as hexadecimal hash string) to swipe on. Application element will be used instead if this argument is not provided | fe50b60b-916d-420b-8728-ee2072ec53eb
951
+ direction | Either 'up', 'down', 'left' or 'right' | yes | The direction in which to swipe | up
952
+ velocity | number | no | This argument is optional and is only supported since Appium server version 1.19 and Xcode SDK version 11.4+. The value is measured in pixels per second and same values could behave differently on different devices depending on their display density. Higher values make swipe gesture faster (which usually scrolls larger areas if we apply it to a list) and lower values slow it down. Only values greater than zero have effect. | 250
953
+
954
+ #### Examples
955
+
956
+ ```java
957
+ // Java
958
+ JavascriptExecutor js = (JavascriptExecutor) driver;
959
+ Map<String, Object> params = new HashMap<>();
960
+ params.put("direction", "down");
961
+ params.put("velocity", 2500);
962
+ params.put("element", ((RemoteWebElement) element).getId());
963
+ js.executeScript("mobile: swipe", params);
964
+ ```
965
+
966
+ #### References
967
+
968
+ - [swipeDown](https://developer.apple.com/documentation/xctest/xcuielement/1618664-swipedown?language=objc)
969
+ - [swipeDownWithVelocity:](https://developer.apple.com/documentation/xctest/xcuielement/3551694-swipedownwithvelocity?language=objc)
970
+ - [swipeUp](https://developer.apple.com/documentation/xctest/xcuielement/1618667-swipeup?language=objc)
971
+ - [swipeUpWithVelocity:](https://developer.apple.com/documentation/xctest/xcuielement/3551697-swipeupwithvelocity?language=objc)
972
+ - [swipeLeft](https://developer.apple.com/documentation/xctest/xcuielement/1618668-swipeleft?language=objc)
973
+ - [swipeLeftWithVelocity:](https://developer.apple.com/documentation/xctest/xcuielement/3551695-swipeleftwithvelocity?language=objc)
974
+ - [swipeRight](https://developer.apple.com/documentation/xctest/xcuielement/1618674-swiperight?language=objc)
975
+ - [swipeRightWithVelocity:](https://developer.apple.com/documentation/xctest/xcuielement/3551696-swiperightwithvelocity?language=objc)
976
+
977
+ ### mobile: scroll
978
+
979
+ Scrolls the element or the whole screen. Different scrolling strategies are supported.
980
+ Arguments define the choosen strategy: either 'name', 'direction', 'predicateString' or
981
+ 'toVisible' in that order. All strategies are exclusive and only one strategy
982
+ can be applied at a single moment of time. Use "mobile: scroll" to emulate precise
983
+ scrolling in tables or collection views, where it is already known to which element
984
+ the scrolling should be performed. Although, there is one known limitation there: in case
985
+ it is necessary to perform too many scroll gestures on parent container to reach the
986
+ necessary child element (tens of them) then the method call may fail.
987
+ _Important_: The implemntation of this extension relies on several undocumented XCTest features, which might not always be reliable. Thus it might *not* always work as expected.
988
+
989
+ #### Arguments
990
+
991
+ Name | Type | Required | Description | Example
992
+ --- | --- | --- | --- | ---
993
+ elementId ("element" prior to Appium v 1.22) | string | no | The internal element identifier (as hexadecimal hash string) to scroll on (e.g. the container). Application element will be used if this argument is not set | fe50b60b-916d-420b-8728-ee2072ec53eb
994
+ name | string | no | The accessibility id of the child element, to which scrolling is performed. The same result can be achieved by setting _predicateString_ argument to 'name == accessibilityId'. Has no effect if _elementId_ is not a container | cell12
995
+ direction | Either 'up', 'down', 'left' or 'right' | yes | The main difference from [swipe](#mobile-swipe) call with the same argument is that _scroll_ will try to move the current viewport exactly to the next/previous page (the term "page" means the content, which fits into a single device screen) | down
996
+ predicateString | string | no | The NSPredicate locator of the child element, to which the scrolling should be performed. Has no effect if _elementId_ is not a container | label == "foo"
997
+ toVisible | boolean | no | If set to _true_ then asks to scroll to the first visible _elementId_ in the parent container. Has no effect if _elementId_ is not set | true
998
+
999
+ #### Examples
1000
+
1001
+ ```python
1002
+ # Python
1003
+ driver.execute_script('mobile: scroll', {'direction': 'down'});
1004
+ ```
1005
+
1006
+ ### mobile: pinch
1007
+
1008
+ Performs pinch gesture on the given element or on the application element.
1009
+
1010
+ #### Arguments
1011
+
1012
+ Name | Type | Required | Description | Example
1013
+ --- | --- | --- | --- | ---
1014
+ elementId ("element" prior to Appium v 1.22) | string | no | The internal element identifier (as hexadecimal hash string) to pinch on. Application element will be used instead if this parameter is not provided | fe50b60b-916d-420b-8728-ee2072ec53eb
1015
+ scale | number | yes | Pinch scale of type float. Use a scale between 0 and 1 to "pinch close" or zoom out and a scale greater than 1 to "pinch open" or zoom in. | 0.5
1016
+ velocity | number | yes | The velocity of the pinch in scale factor per second (float value) | 2.2
1017
+
1018
+ #### Examples
1019
+
1020
+ ```ruby
1021
+ # Ruby
1022
+ execute_script 'mobile: pinch', scale: 0.5, velocity: 1.1, element: element.ref
1023
+ ```
1024
+
1025
+ #### Reference
1026
+
1027
+ [pinchWithScale:velocity:](https://developer.apple.com/documentation/xctest/xcuielement/1618669-pinchwithscale?language=objc)
1028
+
1029
+ ### mobile: doubleTap
1030
+
1031
+ Performs double tap gesture on the given element or on the screen.
1032
+
1033
+ #### Arguments
1034
+
1035
+ Name | Type | Required | Description | Example
1036
+ --- | --- | --- | --- | ---
1037
+ elementId ("element" prior to Appium v 1.22) | string | no if x and y are set | The internal element identifier (as hexadecimal hash string) to double tap on | fe50b60b-916d-420b-8728-ee2072ec53eb
1038
+ x | number | no if elementId is set | Screen x tap coordinate of type float. | 100
1039
+ y | number | no if elementId is set | Screen y tap coordinate of type float. | 100
1040
+
1041
+ #### Examples
1042
+
1043
+ ```javascript
1044
+ // javascript
1045
+ driver.execute('mobile: doubleTap', {element: element.value.ELEMENT});
1046
+ ```
1047
+
1048
+ ### mobile: touchAndHold
1049
+
1050
+ Performs long press gesture on the given element or on the screen.
1051
+
1052
+ #### Arguments
1053
+
1054
+ Name | Type | Required | Description | Example
1055
+ --- | --- | --- | --- | ---
1056
+ elementId ("element" prior to Appium v 1.22) | string | no if x and y are set | The internal element identifier (as hexadecimal hash string) to long tap on | fe50b60b-916d-420b-8728-ee2072ec53eb
1057
+ duration | number | yes | The float duration of press action in seconds | 1.5
1058
+ x | number | no if elementId is set | Screen x tap coordinate of type float. | 100
1059
+ y | number | no if elementId is set | Screen y tap coordinate of type float. | 100
1060
+
1061
+ #### Examples
1062
+
1063
+ ```csharp
1064
+ // c#
1065
+ Dictionary<string, object> tfLongTap = new Dictionary<string, object>();
1066
+ tfLongTap.Add("element", element.Id);
1067
+ tfLongTap.Add("duration", 2.0);
1068
+ ((IJavaScriptExecutor)driver).ExecuteScript("mobile: touchAndHold", tfLongTap);
1069
+ ```
1070
+
1071
+ #### Reference
913
1072
 
1073
+ [pressForDuration:](https://developer.apple.com/documentation/xctest/xcuielement/1618663-pressforduration?language=objc)
914
1074
 
915
- ### Mobile Gesture Commands
1075
+ ### mobile: twoFingerTap
916
1076
 
917
- XCUITest driver provides several extensions that allow to automate popular mobile gesture shortcuts:
1077
+ Performs two finger tap gesture on the given element or on the application element.
918
1078
 
919
- - mobile: tap
920
- - mobile: scroll
921
- - mobile: pinch
922
- - mobile: doubleTap
923
- - mobile: touchAndHold
924
- - mobile: twoFingerTap
925
- - mobile: tap
926
- - mobile: dragFromToForDuration
927
- - mobile: tapWithNumberOfTaps
928
- - mobile: rotateElement
1079
+ #### Arguments
1080
+
1081
+ Name | Type | Required | Description | Example
1082
+ --- | --- | --- | --- | ---
1083
+ elementId ("element" prior to Appium v 1.22) | string | no | The internal element identifier (as hexadecimal hash string) to tap on. Application element will be used instead if this parameter is not provided | fe50b60b-916d-420b-8728-ee2072ec53eb
1084
+
1085
+ #### Examples
1086
+
1087
+ ```csharp
1088
+ // c#
1089
+ Dictionary<string, object> tfTap = new Dictionary<string, object>();
1090
+ tfTap.Add("element", element.Id);
1091
+ ((IJavaScriptExecutor)driver).ExecuteScript("mobile: twoFingerTap", tfTap);
1092
+ ```
1093
+
1094
+ #### Reference
1095
+
1096
+ [twoFingerTap](https://developer.apple.com/documentation/xctest/xcuielement/1618675-twofingertap?language=objc)
1097
+
1098
+ ### mobile: tap
1099
+
1100
+ Performs tap gesture by coordinates on the given element or on the screen.
1101
+
1102
+ #### Arguments
1103
+
1104
+ Name | Type | Required | Description | Example
1105
+ --- | --- | --- | --- | ---
1106
+ elementId ("element" prior to Appium v 1.22) | string | no | The internal element identifier (as hexadecimal hash string) to tap on. _x_ and _y_ tap coordinates will be calulated relatively to the current element position on the screen if this argument is provided. Otherwise they should be calculated relatively to the active application element. | fe50b60b-916d-420b-8728-ee2072ec53eb
1107
+ x | number | yes | Screen x tap coordinate of type float. | 100
1108
+ y | number | yes | Screen y tap coordinate of type float. | 100
1109
+
1110
+ ### mobile: dragFromToForDuration
1111
+
1112
+ Performs drag and drop gesture by coordinates. This can be done either on an element or
1113
+ on the screen
1114
+
1115
+ #### Arguments
1116
+
1117
+ Name | Type | Required | Description | Example
1118
+ --- | --- | --- | --- | ---
1119
+ elementId ("element" prior to Appium v 1.22) | string | no | The internal element identifier (as hexadecimal hash string) to perform drag on. All the coordinates will be calculated relatively this this element position on the screen. Absolute screen coordinates are expected if this argument is not set | fe50b60b-916d-420b-8728-ee2072ec53eb
1120
+ duration | number | yes | Float number of seconds in range [0.5, 60]. How long the tap gesture at starting drag point should be before to start dragging | 5.3
1121
+ fromX | number | yes | The x coordinate of starting drag point | 100
1122
+ fromY | number | yes | The y coordinate of starting drag point | 100
1123
+ toX | number | yes | The x coordinate of ending drag point | 200
1124
+ toY | number | yes | The y coordinate of ending drag point | 200
1125
+
1126
+ #### Examples
1127
+
1128
+ ```java
1129
+ // Java
1130
+ JavascriptExecutor js = (JavascriptExecutor) driver;
1131
+ Map<String, Object> params = new HashMap<>();
1132
+ params.put("duration", 1.0);
1133
+ params.put("fromX", 100);
1134
+ params.put("fromY", 100);
1135
+ params.put("toX", 200);
1136
+ params.put("toY", 200);
1137
+ params.put("element", ((RemoteWebElement) element).getId());
1138
+ js.executeScript("mobile: dragFromToForDuration", params);
1139
+ ```
1140
+
1141
+ #### Reference
1142
+
1143
+ [clickForDuration:thenDragToElement:](https://developer.apple.com/documentation/xctest/xcuielement/1500989-clickforduration?language=objc)
1144
+
1145
+ ### mobile: selectPickerWheelValue
1146
+
1147
+ Performs selection of the next or previous picker wheel value. This might
1148
+ be useful if these values are populated dynamically, so you don't know which
1149
+ one to select or value selection does not work because of XCTest bug.
1150
+
1151
+ #### Arguments
1152
+
1153
+ Name | Type | Required | Description | Example
1154
+ --- | --- | --- | --- | ---
1155
+ elementId ("element" prior to Appium v 1.22) | string | yes | PickerWheel's internal element id (as hexadecimal hash string) to perform value selection on. The element must be of type XCUIElementTypePickerWheel | fe50b60b-916d-420b-8728-ee2072ec53eb
1156
+ order | string | yes | Either _next_ to select the value next to the current one from the target picker wheel or _previous_ to select the previous one | next
1157
+ offset | number | no | The value in range [0.01, 0.5]. It defines how far from picker wheel's center the click should happen. The actual distance is calculated by multiplying this value to the actual picker wheel height. Too small offset value may not change the picker wheel value and too high value may cause the wheel to switch two or more values at once. Usually the optimal value is located in range [0.15, 0.3]. _0.2_ by default | 0.3
1158
+
1159
+ #### Examples
1160
+
1161
+ ```java
1162
+ // Java
1163
+ JavascriptExecutor js = (JavascriptExecutor) driver;
1164
+ Map<String, Object> params = new HashMap<>();
1165
+ params.put("order", "next");
1166
+ params.put("offset", 0.15);
1167
+ params.put("element", ((RemoteWebElement) element).getId());
1168
+ js.executeScript("mobile: selectPickerWheelValue", params);
1169
+ ```
1170
+
1171
+ ### mobile: rotateElement
1172
+
1173
+ Performs [rotate](https://developer.apple.com/documentation/xctest/xcuielement/1618665-rotate?language=objc) gesture on the given element.
1174
+
1175
+ #### Arguments
1176
+
1177
+ Name | Type | Required | Description | Example
1178
+ --- | --- | --- | --- | ---
1179
+ elementId ("element" prior to Appium v 1.22) | string | yes | Internal element id (as hexadecimal hash string) to perform rotation on | fe50b60b-916d-420b-8728-ee2072ec53eb
1180
+ rotation | number | yes | The rotation of the gesture in radians | Math.PI
1181
+ velocity | number | yes | The velocity of the rotation gesture in radians per second | Math.PI / 4
1182
+
1183
+ #### Examples
1184
+
1185
+ ```java
1186
+ // Java
1187
+ JavascriptExecutor js = (JavascriptExecutor) driver;
1188
+ js.executeScript("mobile: rotateElement", ImmutableMap.of(
1189
+ // rotate clockwise, 90 degrees
1190
+ "rotation", -Math.PI / 2,
1191
+ // in approximately two seconds
1192
+ "velocity", Math.PI / 4,
1193
+ "element", ((RemoteWebElement) element).getId()
1194
+ ));
1195
+ ```
1196
+
1197
+ #### Reference
1198
+
1199
+ [rotate:withVelocity:](https://developer.apple.com/documentation/xctest/xcuielement/1618665-rotate?language=objc)
1200
+
1201
+ ### mobile: tapWithNumberOfTaps
1202
+
1203
+ Sends one or more taps with one or more touch points since Appium 1.17.1.
1204
+
1205
+ #### Arguments
1206
+
1207
+ Name | Type | Required | Description | Example
1208
+ --- | --- | --- | --- | ---
1209
+ elementId ("element" prior to Appium v 1.22) | string | yes | The internal element identifier (as hexadecimal hash string) to perform one or more taps. | fe50b60b-916d-420b-8728-ee2072ec53eb
1210
+ numberOfTaps | number | yes | The number of taps | 2
1211
+ numberOfTouches | number | yes | The number of touch points | 2
1212
+
1213
+ #### Examples
1214
+
1215
+ ```ruby
1216
+ # Ruby
1217
+ e = @driver.find_element :id, 'target element'
1218
+ # Taps the element with a single touch point twice
1219
+ @driver.execute_script 'mobile: tapWithNumberOfTaps', {element: e.ref, numberOfTaps: 2, numberOfTouches: 1}
1220
+ ```
929
1221
 
930
- These gestures are documented in the [Automating Mobile Gestures for iOS](https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios/ios-xctest-mobile-gestures.md) tutorial. Refer [W3C Actions API](https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api) if you need to automate more complicated gestures.
1222
+ #### Reference
1223
+ [tapWithNumberOfTaps:numberOfTouches:](https://developer.apple.com/documentation/xctest/xcuielement/1618671-tapwithnumberoftaps)
931
1224
 
932
1225
 
933
1226
  ## Known issues
package/build/index.js CHANGED
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
3
  Object.defineProperty(exports, "__esModule", {
8
4
  value: true
9
5
  });
@@ -11,14 +7,16 @@ exports.default = exports.startServer = exports.XCUITestDriver = void 0;
11
7
 
12
8
  require("source-map-support/register");
13
9
 
14
- var _yargs = _interopRequireDefault(require("yargs"));
15
-
16
10
  var _asyncbox = require("asyncbox");
17
11
 
18
12
  var driver = _interopRequireWildcard(require("./lib/driver"));
19
13
 
20
14
  var server = _interopRequireWildcard(require("./lib/server"));
21
15
 
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
22
20
  const {
23
21
  XCUITestDriver
24
22
  } = driver;
@@ -31,8 +29,13 @@ const DEFAULT_HOST = 'localhost';
31
29
  const DEFAULT_PORT = 4723;
32
30
 
33
31
  async function main() {
34
- let port = _yargs.default.argv.port || DEFAULT_PORT;
35
- let host = _yargs.default.argv.host || DEFAULT_HOST;
32
+ const getArgValue = argName => {
33
+ const argIndex = process.argv.indexOf(argName);
34
+ return argIndex > 0 ? process.argv[argIndex + 1] : null;
35
+ };
36
+
37
+ const port = parseInt(getArgValue('--port'), 10) || DEFAULT_PORT;
38
+ const host = getArgValue('--host') || DEFAULT_HOST;
36
39
  return await startServer(port, host);
37
40
  }
38
41
 
@@ -44,4 +47,4 @@ var _default = XCUITestDriver;
44
47
  exports.default = _default;require('source-map-support').install();
45
48
 
46
49
 
47
- //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbIlhDVUlUZXN0RHJpdmVyIiwiZHJpdmVyIiwic3RhcnRTZXJ2ZXIiLCJzZXJ2ZXIiLCJERUZBVUxUX0hPU1QiLCJERUZBVUxUX1BPUlQiLCJtYWluIiwicG9ydCIsInlhcmdzIiwiYXJndiIsImhvc3QiLCJyZXF1aXJlIiwibW9kdWxlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7O0FBRUE7O0FBQ0E7O0FBQ0E7O0FBQ0E7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ID0+IHtcbiAgICBjb25zdCBhcmdJbmRleCA9IHByb2Nlc3MuYXJndi5pbmRleE9mKGFyZ05hbWUpO1xuICAgIHJldHVybiBhcmdJbmRleCA+IDAgPyBwcm9jZXNzLmFyZ3ZbYXJnSW5kZXggKyAxXSA6IG51bGw7XG4gIH07XG4gIGNvbnN0IHBvcnQgPSBwYXJzZUludChnZXRBcmdWYWx1ZSgnLS1wb3J0JyksIDEwKSB8fCBERUZBVUxUX1BPUlQ7XG4gIGNvbnN0IGhvc3QgPSBnZXRBcmdWYWx1ZSgnLS1ob3N0JykgfHwgREVGQVVMVF9IT1NUO1xuICByZXR1cm4gYXdhaXQgc3RhcnRTZXJ2ZXIocG9ydCwgaG9zdCk7XG59XG5cbmlmIChyZXF1aXJlLm1haW4gPT09IG1vZHVsZSkge1xuICBhc3luY2lmeShtYWluKTtcbn1cblxuZXhwb3J0IHsgWENVSVRlc3REcml2ZXIsIHN0YXJ0U2VydmVyIH07XG5leHBvcnQgZGVmYXVsdCBYQ1VJVGVzdERyaXZlcjtcbiJdLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiLi4ifQ==
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.extractBundleId = extractBundleId;
9
+ exports.verifyApplicationPlatform = verifyApplicationPlatform;
10
+ exports.parseLocalizableStrings = parseLocalizableStrings;
11
+
12
+ require("source-map-support/register");
13
+
14
+ var _lodash = _interopRequireDefault(require("lodash"));
15
+
16
+ var _path = _interopRequireDefault(require("path"));
17
+
18
+ var _appiumSupport = require("appium-support");
19
+
20
+ var _logger = _interopRequireDefault(require("./logger.js"));
21
+
22
+ const STRINGSDICT_RESOURCE = '.stringsdict';
23
+ const STRINGS_RESOURCE = '.strings';
24
+
25
+ async function extractPlistEntry(app, entryName) {
26
+ const plistPath = _path.default.resolve(app, 'Info.plist');
27
+
28
+ try {
29
+ return (await _appiumSupport.plist.parsePlistFile(plistPath))[entryName];
30
+ } catch (err) {
31
+ throw new Error(`Could not extract Info.plist from '${_path.default.basename(app)}': ${err.message}`);
32
+ }
33
+ }
34
+
35
+ async function extractBundleId(app) {
36
+ const bundleId = await extractPlistEntry(app, 'CFBundleIdentifier');
37
+
38
+ _logger.default.debug(`Getting bundle ID from app '${app}': '${bundleId}'`);
39
+
40
+ return bundleId;
41
+ }
42
+
43
+ async function verifyApplicationPlatform(app, expectedPlatform) {
44
+ _logger.default.debug('Verifying application platform');
45
+
46
+ let supportedPlatforms;
47
+
48
+ try {
49
+ supportedPlatforms = await extractPlistEntry(app, 'CFBundleSupportedPlatforms');
50
+ } catch (err) {
51
+ _logger.default.debug(err.message);
52
+
53
+ return;
54
+ }
55
+
56
+ _logger.default.debug(`CFBundleSupportedPlatforms: ${JSON.stringify(supportedPlatforms)}`);
57
+
58
+ if (!_lodash.default.isArray(supportedPlatforms)) {
59
+ _logger.default.debug(`CFBundleSupportedPlatforms key does not exist in '${_path.default.basename(app)}'`);
60
+
61
+ return;
62
+ }
63
+
64
+ const {
65
+ isSimulator,
66
+ isTvOS
67
+ } = expectedPlatform;
68
+ const prefix = isTvOS ? 'AppleTV' : 'iPhone';
69
+ const suffix = isSimulator ? 'Simulator' : 'OS';
70
+ const dstPlatform = `${prefix}${suffix}`;
71
+
72
+ if (!supportedPlatforms.includes(dstPlatform)) {
73
+ throw new Error(`${isSimulator ? 'Simulator' : 'Real device'} architecture is unsupported by the '${app}' application. ` + `Make sure the correct deployment target has been selected for its compilation in Xcode.`);
74
+ }
75
+ }
76
+
77
+ async function readResource(resourcePath) {
78
+ const data = await _appiumSupport.plist.parsePlistFile(resourcePath);
79
+ const result = {};
80
+
81
+ for (const [key, value] of _lodash.default.toPairs(data)) {
82
+ result[key] = _lodash.default.isString(value) ? value : JSON.stringify(value);
83
+ }
84
+
85
+ return result;
86
+ }
87
+
88
+ async function parseLocalizableStrings(opts) {
89
+ const {
90
+ app,
91
+ language = 'en',
92
+ localizableStringsDir,
93
+ stringFile,
94
+ strictMode
95
+ } = opts;
96
+
97
+ if (!app) {
98
+ const message = `Strings extraction is not supported if 'app' capability is not set`;
99
+
100
+ if (strictMode) {
101
+ throw new Error(message);
102
+ }
103
+
104
+ _logger.default.info(message);
105
+
106
+ return {};
107
+ }
108
+
109
+ let lprojRoot;
110
+
111
+ for (const subfolder of [`${language}.lproj`, localizableStringsDir, '']) {
112
+ lprojRoot = _path.default.resolve(app, subfolder);
113
+
114
+ if (await _appiumSupport.fs.exists(lprojRoot)) {
115
+ break;
116
+ }
117
+
118
+ const message = `No '${lprojRoot}' resources folder has been found`;
119
+
120
+ if (strictMode) {
121
+ throw new Error(message);
122
+ }
123
+
124
+ _logger.default.debug(message);
125
+ }
126
+
127
+ _logger.default.info(`Will extract resource strings from '${lprojRoot}'`);
128
+
129
+ const resourcePaths = [];
130
+
131
+ if (stringFile) {
132
+ const dstPath = _path.default.resolve(lprojRoot, stringFile);
133
+
134
+ if (await _appiumSupport.fs.exists(dstPath)) {
135
+ resourcePaths.push(dstPath);
136
+ } else {
137
+ const message = `No '${dstPath}' resource file has been found for '${app}'`;
138
+
139
+ if (strictMode) {
140
+ throw new Error(message);
141
+ }
142
+
143
+ _logger.default.info(message);
144
+
145
+ _logger.default.info(`Getting all the available strings from '${lprojRoot}'`);
146
+ }
147
+ }
148
+
149
+ if (_lodash.default.isEmpty(resourcePaths) && (await _appiumSupport.fs.exists(lprojRoot))) {
150
+ const resourceFiles = (await _appiumSupport.fs.readdir(lprojRoot)).filter(name => _lodash.default.some([STRINGS_RESOURCE, STRINGSDICT_RESOURCE], x => name.endsWith(x))).map(name => _path.default.resolve(lprojRoot, name));
151
+ resourcePaths.push(...resourceFiles);
152
+ }
153
+
154
+ _logger.default.info(`Got ${resourcePaths.length} resource file(s) in '${lprojRoot}'`);
155
+
156
+ if (_lodash.default.isEmpty(resourcePaths)) {
157
+ return {};
158
+ }
159
+
160
+ const resultStrings = {};
161
+
162
+ const toAbsolutePath = function (p) {
163
+ return _path.default.isAbsolute(p) ? p : _path.default.resolve(process.cwd(), p);
164
+ };
165
+
166
+ for (const resourcePath of resourcePaths) {
167
+ if (!_appiumSupport.util.isSubPath(toAbsolutePath(resourcePath), toAbsolutePath(app))) {
168
+ throw new Error(`'${resourcePath}' is expected to be located under '${app}'`);
169
+ }
170
+
171
+ try {
172
+ const data = await readResource(resourcePath);
173
+
174
+ _logger.default.debug(`Parsed ${_lodash.default.keys(data).length} string(s) from '${resourcePath}'`);
175
+
176
+ _lodash.default.merge(resultStrings, data);
177
+ } catch (e) {
178
+ _logger.default.warn(`Cannot parse '${resourcePath}' resource. Original error: ${e.message}`);
179
+ }
180
+ }
181
+
182
+ _logger.default.info(`Got ${_lodash.default.keys(resultStrings).length} string(s) from '${lprojRoot}'`);
183
+
184
+ return resultStrings;
185
+ }require('source-map-support').install();
186
+
187
+
188
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9hcHAtdXRpbHMuanMiXSwibmFtZXMiOlsiU1RSSU5HU0RJQ1RfUkVTT1VSQ0UiLCJTVFJJTkdTX1JFU09VUkNFIiwiZXh0cmFjdFBsaXN0RW50cnkiLCJhcHAiLCJlbnRyeU5hbWUiLCJwbGlzdFBhdGgiLCJwYXRoIiwicmVzb2x2ZSIsInBsaXN0IiwicGFyc2VQbGlzdEZpbGUiLCJlcnIiLCJFcnJvciIsImJhc2VuYW1lIiwibWVzc2FnZSIsImV4dHJhY3RCdW5kbGVJZCIsImJ1bmRsZUlkIiwibG9nIiwiZGVidWciLCJ2ZXJpZnlBcHBsaWNhdGlvblBsYXRmb3JtIiwiZXhwZWN0ZWRQbGF0Zm9ybSIsInN1cHBvcnRlZFBsYXRmb3JtcyIsIkpTT04iLCJzdHJpbmdpZnkiLCJfIiwiaXNBcnJheSIsImlzU2ltdWxhdG9yIiwiaX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