appium_lib 9.8.1 → 9.8.2

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.
@@ -0,0 +1,30 @@
1
+ Perform touch actions for W3C module. Generate `touch` pointer action here and users can use this via `driver.action`
2
+
3
+ [Documentation](http://www.rubydoc.info/github/appium/ruby_lib_core/Appium%2FCore%2FBase%2FCoreBridgeW3C:action)
4
+
5
+ # Example
6
+
7
+ ```ruby
8
+ dialect #=> :w3c
9
+
10
+ # then
11
+ el = find_element(:name, 'Pickers')
12
+ driver.action.click(el).perform #=> work
13
+
14
+ driver.action
15
+ .move_to_location(500, 500).pointer_down(:left)
16
+ .move_to_location(0, 700)
17
+ .release.perform
18
+ ```
19
+
20
+ # Note
21
+ ## Coordinate points
22
+ - jsonwp
23
+ - Relative action coordinates are counted relatively to the **top left point** of element's rectangle
24
+ - W3C
25
+ - Relative action coordinates are counted relatively to the **center** of element's rectangle
26
+
27
+ ## Limitations
28
+ - WebDriverAgent support only `touch` as a `pointer type`.
29
+ - By default, [ruby_lib_core](https://github.com/appium/ruby_lib_core/blob/ab5d7c5ed31f318a9395e5aeafe1d0d655d3cff4/lib/appium_lib_core/common/base/w3c_bridge.rb#L26) generate `touch` based actions.
30
+ - About `pointer type` => [W3C](https://www.w3.org/TR/webdriver/#perform-actions) and [Simple WD Spec](https://github.com/jlipps/simple-wd-spec#perform-actions)
@@ -1,4 +1,5 @@
1
1
  require_relative 'common/helper'
2
+ require_relative 'common/command/command'
2
3
 
3
4
  require_relative 'element/alert'
4
5
  require_relative 'element/button'
@@ -17,6 +18,7 @@ module Appium
17
18
  class Bridge
18
19
  def self.for(target)
19
20
  target.extend Appium::Android
21
+ target.extend Appium::Android::Command
20
22
  end
21
23
  end
22
24
  end
@@ -0,0 +1,21 @@
1
+ module Appium
2
+ module Android
3
+ module Command
4
+ # Conduct an adb shell script on Appium server.
5
+ # Require `--relaxed-security` arguments when run Appium server as server side arguments.
6
+ #
7
+ # @param [String] command Command for "adb shell"
8
+ # @param [Array] arguments Arguments for the adb command
9
+ #
10
+ # @example
11
+ #
12
+ # shell "echo", "list" #=> "list"
13
+ #
14
+ def shell(command, arguments)
15
+ args = { command: command, args: arguments }
16
+ # --relaxed-security
17
+ @driver.execute_script 'mobile: shell', args
18
+ end
19
+ end
20
+ end
21
+ end
@@ -6,6 +6,7 @@ module Appium
6
6
  class Bridge
7
7
  def self.for(target)
8
8
  target.extend Appium::Android
9
+ target.extend Appium::Android::Command
9
10
  target.extend Appium::Android::Espresso
10
11
  end
11
12
  end
@@ -6,6 +6,7 @@ module Appium
6
6
  class Bridge
7
7
  def self.for(target)
8
8
  target.extend Appium::Android
9
+ target.extend Appium::Android::Command
9
10
  target.extend Appium::Android::Uiautomator2
10
11
  target.extend Appium::Android::Uiautomator2::Helper
11
12
  target.extend Appium::Android::Uiautomator2::Element
@@ -282,6 +282,26 @@ module Appium
282
282
  !@core.automation_name.nil? && @core.automation_name == :xcuitest
283
283
  end
284
284
 
285
+ # Get the dialect value whether current driver is OSS or W3C
286
+ #
287
+ # @return [:oss | :w3c]
288
+ #
289
+ # @example
290
+ #
291
+ # if dialect == :w3c
292
+ # driver.action
293
+ # .move_to_location(500, 500).pointer_down(:left)
294
+ # .move_to_location(0, 700)
295
+ # .release.perform
296
+ # else
297
+ # action = TouchAction.new(driver).press(x: 500, y: 500).move_to(500, 700).release
298
+ # action.perform
299
+ # end
300
+ #
301
+ def dialect
302
+ @driver.dialect
303
+ end
304
+
285
305
  # Return true if the target Appium server is over REQUIRED_VERSION_XCUITEST.
286
306
  # If the Appium server is under REQUIRED_VERSION_XCUITEST, then error is raised.
287
307
  # @return [Boolean]
@@ -395,9 +415,23 @@ module Appium
395
415
  # screenshot '/tmp/hi.png'
396
416
  #
397
417
  # @param png_save_path [String] the full path to save the png
398
- # @return [nil]
418
+ # @return [File]
399
419
  def screenshot(png_save_path)
400
420
  @driver.save_screenshot png_save_path
421
+ end
422
+
423
+ # Takes a png screenshot of particular element's area
424
+ #
425
+ # @example
426
+ #
427
+ # el = find_element :accessibility_id, zzz
428
+ # element_screenshot el, '/tmp/hi.png'
429
+ #
430
+ # @param [String] element Element take a screenshot
431
+ # @param [String] png_save_path the full path to save the png
432
+ # @return [File]
433
+ def element_screenshot(element, png_save_path)
434
+ @driver.take_element_screenshot element, png_save_path
401
435
  nil
402
436
  end
403
437
 
@@ -467,8 +501,6 @@ module Appium
467
501
  @appium_server_status = appium_server_version
468
502
  check_server_version_xcuitest
469
503
 
470
- set_implicit_wait(@core.default_wait)
471
-
472
504
  @driver
473
505
  end
474
506
 
@@ -8,10 +8,11 @@ module Appium
8
8
  target.extend Appium::Ios
9
9
  target.extend Appium::Ios::Device
10
10
  target.extend Appium::Ios::Xcuitest
11
- target.extend Appium::Ios::Xcuitest::Command
11
+ target.extend Appium::Ios::Xcuitest::PasteBoard
12
12
  target.extend Appium::Ios::Xcuitest::Source
13
13
  target.extend Appium::Ios::Xcuitest::Helper
14
14
  target.extend Appium::Ios::Xcuitest::Gesture
15
+ target.extend Appium::Ios::Xcuitest::MultiAppHandler
15
16
  target.extend Appium::Ios::Xcuitest::Element
16
17
  end
17
18
  end
@@ -1,6 +1,7 @@
1
1
  require_relative 'command/pasteboard'
2
2
  require_relative 'command/gestures'
3
3
  require_relative 'command/source'
4
+ require_relative 'command/multi_app_handler'
4
5
 
5
6
  module Appium
6
7
  module Ios
@@ -0,0 +1,125 @@
1
+ module Appium
2
+ module Ios
3
+ module Xcuitest
4
+ # **Note** Works only for Xcode 9+.
5
+ # Instance methods have `xcuitest_` prefix to prevent conflicts for core commands.
6
+ # see: https://github.com/appium/ruby_lib_core/blob/82e2526de95b05e8a49872e0b69835e99acc66e5/lib/appium_lib_core/common/command.rb#L39
7
+ module MultiAppHandler
8
+ # Installs given application to the device under test. If the same application is already installed
9
+ # then it's going to be installed over it, which allows to test upgrades.
10
+ # Be careful while reinstalling the main application under test - make sure you called terminateApp
11
+ # for it first, otherwise WebDriverAgent will detect it as a potential application crash.
12
+ #
13
+ # @param [String] app The path to an existing .ipa/.app file on the server file system, zipped .app file
14
+ # or an URL pointing to a remote .ipa/.zip file. Mandatory argument.
15
+ # @return {}
16
+ #
17
+ # @example
18
+ #
19
+ # xcuitest_install_app(app: "path/to/app.app")
20
+ #
21
+ def xcuitest_install_app(app:)
22
+ args = { app: app }
23
+ @driver.execute_script 'mobile: installApp', args
24
+ end
25
+
26
+ # Verifies whether the application with given bundle identifier is installed on the device.
27
+ #
28
+ # @param [String] bundle_id The bundle identifier of the application, which is going to be verified.
29
+ # @return [boolean]
30
+ #
31
+ # @example
32
+ #
33
+ # xcuitest_app_installed?(bundle_id: "io.appium.bundle") #=> true or false
34
+ #
35
+ def xcuitest_app_installed?(bundle_id:)
36
+ args = { bundleId: bundle_id }
37
+ @driver.execute_script 'mobile: isAppInstalled', args
38
+ end
39
+
40
+ # Uninstalls an existing application from the device under test. This endpoint does not verify
41
+ # whether the application is already installed or not before uninstalling it.
42
+ #
43
+ # @param [String] bundle_id The bundle identifier of the application, which is going to be uninstalled.
44
+ # @return {}
45
+ #
46
+ # @example
47
+ #
48
+ # xcuitest_remove_app(bundle_id: "io.appium.bundle") #=> 1
49
+ #
50
+ def xcuitest_remove_app(bundle_id:)
51
+ args = { bundleId: bundle_id }
52
+ @driver.execute_script 'mobile: removeApp', args
53
+ end
54
+
55
+ # Executes an existing application on the device. If the application is already running then
56
+ # it will be brought to the foreground.
57
+ #
58
+ # @param [String] bundle_id The bundle identifier of the application, which is going to be executed.
59
+ # @return {}
60
+ #
61
+ # @example
62
+ #
63
+ # xcuitest_launch_app(bundle_id: "io.appium.bundle") #=> 1
64
+ #
65
+ def xcuitest_launch_app(bundle_id:)
66
+ args = { bundleId: bundle_id }
67
+ @driver.execute_script 'mobile: launchApp', args
68
+ end
69
+
70
+ # Terminates an existing application on the device. If the application is not running then
71
+ # the returned result will be false, otherwise true.
72
+ #
73
+ # @param [String] bundle_id The bundle identifier of the application, which is going to be terminated.
74
+ # @return {}
75
+ #
76
+ # @example
77
+ #
78
+ # xcuitest_terminate_app(bundle_id: "io.appium.bundle") #=> 1
79
+ #
80
+ def xcuitest_terminate_app(bundle_id:)
81
+ args = { bundleId: bundle_id }
82
+ @driver.execute_script 'mobile: terminateApp', args
83
+ end
84
+
85
+ # Get the status of an existing application on the device.
86
+ # State:
87
+ # 0: The current application state cannot be determined/is unknown
88
+ # 1: The application is not running
89
+ # 2: The application is running in the background and is suspended
90
+ # 3: The application is running in the background and is not suspended
91
+ # 4: The application is running in the foreground
92
+ #
93
+ # For more details: https://developer.apple.com/documentation/xctest/xcuiapplicationstate
94
+ #
95
+ # @param [String] bundle_id A target app's bundle id
96
+ # @return [0|1|2|3|4] A number of the state
97
+ #
98
+ # @example
99
+ #
100
+ # xcuitest_query_app_status(bundle_id: "io.appium.bundle") #=> 1
101
+ #
102
+ def xcuitest_query_app_status(bundle_id:)
103
+ args = { bundleId: bundle_id }
104
+ @driver.execute_script 'mobile: queryAppState', args
105
+ end
106
+
107
+ # Activates an existing application on the device under test and moves it to the foreground.
108
+ # The application should be already running in order to activate it.
109
+ # The call is ignored if the application is already in foreground.
110
+ #
111
+ # @param [String] bundle_id The bundle identifier of the application, which is going to be brought to the foreground.
112
+ # @return {}
113
+ #
114
+ # @example
115
+ #
116
+ # xcuitest_activate_app(bundle_id: "io.appium.bundle") #=> 1
117
+ #
118
+ def xcuitest_activate_app(bundle_id:)
119
+ args = { bundleId: bundle_id }
120
+ @driver.execute_script 'mobile: activateApp', args
121
+ end
122
+ end
123
+ end # module Xcuitest
124
+ end # module Ios
125
+ end # module Appium
@@ -1,7 +1,7 @@
1
1
  module Appium
2
2
  module Ios
3
3
  module Xcuitest
4
- module Command
4
+ module PasteBoard
5
5
  # @param [string] content The content of the pasteboard. The previous content is going to be overridden.
6
6
  # The parameter is mandatory
7
7
  # @option opts [string] :encoding Encoding of the given content. UTF-8 by default.
@@ -1,6 +1,7 @@
1
1
  module Appium
2
2
  module Ios
3
3
  module Xcuitest
4
+ # Instance method have `xcuitest_` prefix to prevent conflicts for core commands.
4
5
  module Source
5
6
  # @param [String|Symbol] format :xml or :json. :xml is by default.
6
7
  # @option opts [Element] :element Element to swipe on
@@ -1,5 +1,5 @@
1
1
  module Appium
2
2
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
3
- VERSION = '9.8.1'.freeze unless defined? ::Appium::VERSION
4
- DATE = '2017-12-16'.freeze unless defined? ::Appium::DATE
3
+ VERSION = '9.8.2'.freeze unless defined? ::Appium::VERSION
4
+ DATE = '2017-12-27'.freeze unless defined? ::Appium::DATE
5
5
  end
@@ -1,3 +1,12 @@
1
+ #### v9.8.1 2017-12-17
2
+
3
+ - [1081ae0](https://github.com/appium/ruby_lib/commit/1081ae01e7cf5c4682cadcf0219b07912cc3734f) [Release 9 8 1 (#731)](https://github.com/appium/ruby_lib/issues/731)
4
+ - [8212de4](https://github.com/appium/ruby_lib/commit/8212de4037f8c0bcd0c9a5d828dec6db32ace697) [update ruby_core to fix creating session for the W3C createSession for Appium (#730)](https://github.com/appium/ruby_lib/issues/730)
5
+ - [e12787d](https://github.com/appium/ruby_lib/commit/e12787dc1ebd35a9760e9e59e094bc30b2dfe627) [add alias (#725)](https://github.com/appium/ruby_lib/issues/725)
6
+ - [047ed32](https://github.com/appium/ruby_lib/commit/047ed3296ce5a33a4ea9814348dc4b8af2fbebcc) [Release 9 8 0 (#724)](https://github.com/appium/ruby_lib/issues/724)
7
+ - [9dfa0b9](https://github.com/appium/ruby_lib/commit/9dfa0b9c0c3df6f7ec88d578e304ad1fd3704742) [refactor: replace core directory to core library (#718)](https://github.com/appium/ruby_lib/issues/718)
8
+
9
+
1
10
  #### v9.7.5 2017-11-04
2
11
 
3
12
  - [1e1bb7e](https://github.com/appium/ruby_lib/commit/1e1bb7e3f1f500fa0dffe361b875b6b16941e290) [Release 9 7 5 (#717)](https://github.com/appium/ruby_lib/issues/717)
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.8.1
4
+ version: 9.8.2
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-12-16 00:00:00.000000000 Z
11
+ date: 2017-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appium_lib_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: 1.2.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.1'
26
+ version: 1.2.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tomlrb
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -140,14 +140,14 @@ dependencies:
140
140
  requirements:
141
141
  - - "~>"
142
142
  - !ruby/object:Gem::Version
143
- version: '0.8'
143
+ version: 0.9.11
144
144
  type: :development
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
- version: '0.8'
150
+ version: 0.9.11
151
151
  - !ruby/object:Gem::Dependency
152
152
  name: rubocop
153
153
  requirement: !ruby/object:Gem::Requirement
@@ -217,10 +217,12 @@ files:
217
217
  - docs/migration.md
218
218
  - docs/parallel.md
219
219
  - docs/travis.sample.yml
220
+ - docs/w3c.md
220
221
  - docs_gen/docs_from_js.md
221
222
  - docs_gen/make_docs.rb
222
223
  - lib/appium_lib.rb
223
224
  - lib/appium_lib/android/android.rb
225
+ - lib/appium_lib/android/common/command/command.rb
224
226
  - lib/appium_lib/android/common/helper.rb
225
227
  - lib/appium_lib/android/element/alert.rb
226
228
  - lib/appium_lib/android/element/button.rb
@@ -255,6 +257,7 @@ files:
255
257
  - lib/appium_lib/ios/xcuitest/bridge.rb
256
258
  - lib/appium_lib/ios/xcuitest/command.rb
257
259
  - lib/appium_lib/ios/xcuitest/command/gestures.rb
260
+ - lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb
258
261
  - lib/appium_lib/ios/xcuitest/command/pasteboard.rb
259
262
  - lib/appium_lib/ios/xcuitest/command/source.rb
260
263
  - lib/appium_lib/ios/xcuitest/element.rb