appium_lib 9.7.2 → 9.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/docs/android_docs.md +220 -168
  4. data/docs/docs.md +13 -37
  5. data/docs/ios_docs.md +278 -220
  6. data/docs/ios_xcuitest.md +0 -4
  7. data/docs/parallel.md +8 -0
  8. data/lib/appium_lib/android/android.rb +3 -0
  9. data/lib/appium_lib/android/common/helper.rb +3 -0
  10. data/lib/appium_lib/android/espresso.rb +9 -0
  11. data/lib/appium_lib/android/espresso/bridge.rb +14 -0
  12. data/lib/appium_lib/common/multi_touch.rb +151 -4
  13. data/lib/appium_lib/common/touch_actions.rb +21 -0
  14. data/lib/appium_lib/common/wait.rb +2 -22
  15. data/lib/appium_lib/core/android.rb +1 -0
  16. data/lib/appium_lib/core/android/espresso/bridge.rb +18 -0
  17. data/lib/appium_lib/core/android/touch.rb +15 -0
  18. data/lib/appium_lib/core/android/uiautomator1/bridge.rb +3 -1
  19. data/lib/appium_lib/core/android/uiautomator2/bridge.rb +3 -1
  20. data/lib/appium_lib/core/android_espresso.rb +5 -0
  21. data/lib/appium_lib/core/android_uiautomator2.rb +1 -0
  22. data/lib/appium_lib/core/core.rb +1 -1
  23. data/lib/appium_lib/core/device/touch_actions.rb +8 -23
  24. data/lib/appium_lib/core/driver.rb +93 -17
  25. data/lib/appium_lib/core/ios.rb +1 -0
  26. data/lib/appium_lib/core/ios/touch.rb +16 -0
  27. data/lib/appium_lib/core/ios/uiautomation/bridge.rb +2 -0
  28. data/lib/appium_lib/core/ios/xcuitest/bridge.rb +2 -0
  29. data/lib/appium_lib/core/ios/xcuitest/search_context.rb +23 -12
  30. data/lib/appium_lib/core/ios_xcuitest.rb +1 -0
  31. data/lib/appium_lib/driver.rb +18 -15
  32. data/lib/appium_lib/ios/xcuitest/bridge.rb +1 -0
  33. data/lib/appium_lib/ios/xcuitest/command.rb +1 -0
  34. data/lib/appium_lib/ios/xcuitest/command/source.rb +20 -0
  35. data/lib/appium_lib/version.rb +2 -2
  36. data/readme.md +14 -29
  37. data/release_notes.md +8 -0
  38. metadata +10 -3
  39. data/lib/appium_lib/core/device/multi_touch.rb +0 -213
@@ -1,3 +1,11 @@
1
+ #### v9.7.2 2017-10-07
2
+
3
+ - [1f20df4](https://github.com/appium/ruby_lib/commit/1f20df4ea663c881d10d173c2df178169f257c95) [Release 9 7 2 (#692)](https://github.com/appium/ruby_lib/issues/692)
4
+ - [b9bb275](https://github.com/appium/ruby_lib/commit/b9bb2751313ea478ee775d979543f05dc44f9e21) [feature: add flatten_hash_keys (#688)](https://github.com/appium/ruby_lib/issues/688)
5
+ - [3bdc1f9](https://github.com/appium/ruby_lib/commit/3bdc1f9cf6ad5eb2279dfd6cb43e35fc469720de) [fix: path for uiautomation (#690)](https://github.com/appium/ruby_lib/issues/690)
6
+ - [3102784](https://github.com/appium/ruby_lib/commit/31027845774373e22b907242944f391ddf755581) [fix: export session (#689)](https://github.com/appium/ruby_lib/issues/689)
7
+
8
+
1
9
  #### v9.7.1 2017-10-01
2
10
 
3
11
  - [ebde85f](https://github.com/appium/ruby_lib/commit/ebde85fac616ac09e19a5f8215195e536d88344d) [Release 9 7 1 (#682)](https://github.com/appium/ruby_lib/issues/682)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.7.2
4
+ version: 9.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-07 00:00:00.000000000 Z
11
+ date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -249,6 +249,7 @@ files:
249
249
  - docs/ios_docs.md
250
250
  - docs/ios_xcuitest.md
251
251
  - docs/migration.md
252
+ - docs/parallel.md
252
253
  - docs/travis.sample.yml
253
254
  - docs_gen/docs_from_js.md
254
255
  - docs_gen/make_docs.rb
@@ -260,6 +261,8 @@ files:
260
261
  - lib/appium_lib/android/element/generic.rb
261
262
  - lib/appium_lib/android/element/text.rb
262
263
  - lib/appium_lib/android/element/textfield.rb
264
+ - lib/appium_lib/android/espresso.rb
265
+ - lib/appium_lib/android/espresso/bridge.rb
263
266
  - lib/appium_lib/android/uiautomator2.rb
264
267
  - lib/appium_lib/android/uiautomator2/bridge.rb
265
268
  - lib/appium_lib/android/uiautomator2/element.rb
@@ -274,9 +277,12 @@ files:
274
277
  - lib/appium_lib/common/wait.rb
275
278
  - lib/appium_lib/core/android.rb
276
279
  - lib/appium_lib/core/android/device.rb
280
+ - lib/appium_lib/core/android/espresso/bridge.rb
277
281
  - lib/appium_lib/core/android/search_context.rb
282
+ - lib/appium_lib/core/android/touch.rb
278
283
  - lib/appium_lib/core/android/uiautomator1/bridge.rb
279
284
  - lib/appium_lib/core/android/uiautomator2/bridge.rb
285
+ - lib/appium_lib/core/android_espresso.rb
280
286
  - lib/appium_lib/core/android_uiautomator2.rb
281
287
  - lib/appium_lib/core/common.rb
282
288
  - lib/appium_lib/core/common/base.rb
@@ -293,12 +299,12 @@ files:
293
299
  - lib/appium_lib/core/common/log.rb
294
300
  - lib/appium_lib/core/common/logger.rb
295
301
  - lib/appium_lib/core/core.rb
296
- - lib/appium_lib/core/device/multi_touch.rb
297
302
  - lib/appium_lib/core/device/touch_actions.rb
298
303
  - lib/appium_lib/core/driver.rb
299
304
  - lib/appium_lib/core/ios.rb
300
305
  - lib/appium_lib/core/ios/device.rb
301
306
  - lib/appium_lib/core/ios/search_context.rb
307
+ - lib/appium_lib/core/ios/touch.rb
302
308
  - lib/appium_lib/core/ios/uiautomation/bridge.rb
303
309
  - lib/appium_lib/core/ios/uiautomation/patch.rb
304
310
  - lib/appium_lib/core/ios/xcuitest/bridge.rb
@@ -320,6 +326,7 @@ files:
320
326
  - lib/appium_lib/ios/xcuitest/command.rb
321
327
  - lib/appium_lib/ios/xcuitest/command/gestures.rb
322
328
  - lib/appium_lib/ios/xcuitest/command/pasteboard.rb
329
+ - lib/appium_lib/ios/xcuitest/command/source.rb
323
330
  - lib/appium_lib/ios/xcuitest/element.rb
324
331
  - lib/appium_lib/ios/xcuitest/element/button.rb
325
332
  - lib/appium_lib/ios/xcuitest/element/generic.rb
@@ -1,213 +0,0 @@
1
- module Appium
2
- module Core
3
- # MultiTouch actions allow for multiple touches to happen at the same time,
4
- # for instance, to simulate multiple finger swipes.
5
- #
6
- # Create a series of touch actions by themselves (without a `prepare()`), then
7
- # add to a new MultiTouch action. When ready, call `prepare()` and all
8
- # actions will be executed simultaneously.
9
- #
10
- # ```ruby
11
- # action_1 = TouchAction.new.press(x: 45, y: 100).wait(5).release
12
- # action_2 = TouchAction.new.tap(element: el, x: 50, y:5, count: 3)
13
- #
14
- # driver = Appium::Driver.new(opts, false).start_driver
15
- # multi_touch_action = MultiTouch.new(driver)
16
- # multi_touch_action.add action_1
17
- # multi_touch_action.add action_2
18
- # multi_touch_action.perform
19
- # ```
20
-
21
- class MultiTouch
22
- class << self
23
- # Convenience method for pinching the screen.
24
- # Places two fingers at the edges of the screen and brings them together.
25
- # @param percentage (int) The percent size by which to shrink the screen when pinched.
26
- # @param auto_perform (boolean) Whether to perform the action immediately (default true)
27
- # @param driver (Driver) Set a driver to conduct the action. DEfault is global driver($driver)
28
- #
29
- # ```ruby
30
- # driver = Appium::Driver.new(opts, false).start_driver
31
- # pinch percentage: 75, driver: driver #=> Pinch the screen from the top right and bottom left corners
32
- # ```
33
- #
34
- # Without auto_perform
35
- #
36
- # ```ruby
37
- # driver = Appium::Driver.new(opts, false).start_driver
38
- # action = pinch percentage: 75, auto_perform: false, driver: driver
39
- # #=> Pinch the screen from the top right and bottom left corners
40
- # action.perform #=> to 25% of its size.
41
- # ```
42
- def pinch(percentage: 25, auto_perform: true, driver:)
43
- raise ArgumentError("Can't pinch to greater than screen size.") if percentage > 100
44
-
45
- rate = Float(percentage) / 100
46
- pinch = MultiTouch.new(driver)
47
-
48
- # TODO: Don't use driver automation handler here.
49
- if pinch.driver.automation_name_is_xcuitest?
50
- top, bottom = pinch_for_xcuitest(rate, pinch.driver)
51
- elsif pinch.driver.device_is_android?
52
- top, bottom = pinch_android(rate, pinch.driver)
53
- else
54
- top, bottom = pinch_ios(rate, pinch.driver)
55
- end
56
-
57
- pinch.add top
58
- pinch.add bottom
59
- return pinch unless auto_perform
60
- pinch.perform
61
- end
62
-
63
- # Convenience method for zooming the screen.
64
- # Places two fingers at the edges of the screen and brings them together.
65
- # @param percentage (int) The percent size by which to shrink the screen when pinched.
66
- # @param auto_perform (boolean) Whether to perform the action immediately (default true)
67
- # @param driver (Driver) Set a driver to conduct the action. DEfault is global driver($driver)
68
- #
69
- # ```ruby
70
- # driver = Appium::Driver.new(opts, false).start_driver
71
- # action = zoom percentage: 200, driver: driver #=> Zoom in the screen from the center until it doubles in size.
72
- # ```
73
- #
74
- # Without auto_perform
75
- #
76
- # ```ruby
77
- # driver = Appium::Driver.new(opts, false).start_driver
78
- # action = zoom percentage: 200, auto_perform: false, driver: driver
79
- # #=> Zoom in the screen from the center until it doubles in size.
80
- # action.perform #=> to 25% of its size.
81
- # ```
82
- def zoom(percentage: 200, auto_perform: true, driver:)
83
- raise ArgumentError("Can't zoom to smaller then screen size.") if percentage < 100
84
-
85
- rate = 100 / Float(percentage)
86
- zoom = MultiTouch.new(driver)
87
-
88
- # TODO: Don't use driver automation handler here.
89
- if zoom.driver.automation_name_is_xcuitest?
90
- top, bottom = zoom_for_xcuitest(rate, zoom.driver)
91
- elsif zoom.driver.device_is_android?
92
- top, bottom = zoom_android(rate, zoom.driver)
93
- else
94
- top, bottom = zoom_ios(rate, zoom.driver)
95
- end
96
-
97
- zoom.add top
98
- zoom.add bottom
99
- return zoom unless auto_perform
100
- zoom.perform
101
- end
102
-
103
- private
104
-
105
- def pinch_for_xcuitest(rate, driver)
106
- height = 100
107
-
108
- ele = driver.find_element :class, 'XCUIElementTypeApplication'
109
- top = ::Appium::Core::TouchAction.new(driver)
110
- top.swipe({ start_x: 0.5, start_y: 0.0,
111
- offset_x: 0.0, offset_y: (1 - rate) * height }, ele)
112
-
113
- bottom = ::Appium::Core::TouchAction.new(driver)
114
- bottom.swipe({ start_x: 0.5, start_y: 1.0,
115
- offset_x: 0.0, offset_y: rate * height }, ele)
116
-
117
- [top, bottom]
118
- end
119
-
120
- def pinch_android(rate, driver)
121
- height = 100
122
-
123
- top = ::Appium::Core::TouchAction.new(driver)
124
- top.swipe start_x: 0.5, start_y: 1.0 * height,
125
- end_x: 0.5, end_y: rate * height, duration: 1_000
126
-
127
- bottom = ::Appium::Core::TouchAction.new(driver)
128
- bottom.swipe start_x: 0.5, start_y: 0.0,
129
- end_x: 0.5, end_y: (1 - rate) * height, duration: 1_000
130
-
131
- [top, bottom]
132
- end
133
-
134
- def pinch_ios(rate, driver)
135
- height = 100
136
-
137
- top = ::Appium::Core::TouchAction.new(driver)
138
- top.swipe start_x: 0.5, start_y: 0.0,
139
- offset_x: 0.0, offset_y: (1 - rate) * height, duration: 1_000
140
-
141
- bottom = ::Appium::Core::TouchAction.new(driver)
142
- bottom.swipe start_x: 0.5, start_y: 1.0,
143
- offset_x: 0.0, offset_y: rate * height, duration: 1_000
144
-
145
- [top, bottom]
146
- end
147
-
148
- def zoom_for_xcuitest(rate, driver)
149
- height = 100
150
-
151
- ele = driver.find_element :class, 'XCUIElementTypeApplication'
152
- top = ::Appium::Core::TouchAction.new(driver)
153
- top.swipe({ start_x: 0.5, start_y: (1 - rate) * height,
154
- offset_x: 0.0, offset_y: - (1 - rate) * height }, ele)
155
-
156
- bottom = ::Appium::Core::TouchAction.new(driver)
157
- bottom.swipe({ start_x: 0.5, start_y: rate * height,
158
- offset_x: 0.0, offset_y: (1 - rate) * height }, ele)
159
-
160
- [top, bottom]
161
- end
162
-
163
- def zoom_android(rate, driver)
164
- height = 100
165
-
166
- top = ::Appium::Core::TouchAction.new(driver)
167
- top.swipe start_x: 0.5, start_y: (1.0 - rate) * height,
168
- end_x: 0.5, end_y: 0.0, duration: 1_000
169
-
170
- bottom = ::Appium::Core::TouchAction.new(driver)
171
- bottom.swipe start_x: 0.5, start_y: rate * height,
172
- end_x: 0.5, end_y: 1.0 * height, duration: 1_000
173
-
174
- [top, bottom]
175
- end
176
-
177
- def zoom_ios(rate, driver)
178
- height = 100
179
-
180
- top = ::Appium::Core::TouchAction.new(driver)
181
- top.swipe start_x: 0.5, start_y: (1 - rate) * height,
182
- offset_x: 0.0, offset_y: - (1 - rate) * height, duration: 1_000
183
-
184
- bottom = ::Appium::Core::TouchAction.new(driver)
185
- bottom.swipe start_x: 0.5, start_y: rate * height,
186
- offset_x: 0.0, offset_y: (1 - rate) * height, duration: 1_000
187
-
188
- [top, bottom]
189
- end
190
- end # self
191
-
192
- attr_reader :actions, :driver
193
-
194
- # Create a new multi-action with Driver
195
- def initialize(driver)
196
- @actions = []
197
- @driver = driver
198
- end
199
-
200
- # Add a touch_action to be performed
201
- # @param chain (TouchAction) The action to add to the chain
202
- def add(chain)
203
- @actions << chain.actions
204
- end
205
-
206
- # Ask Appium to perform the actions
207
- def perform
208
- @driver.multi_touch @actions
209
- @actions.clear
210
- end
211
- end # class MultiTouch
212
- end # module Core
213
- end # module Appium