appium_lib_core 2.3.4 → 3.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bceabea49800493b2a7f3ca6180df16e44c46b931442cfbc34d6e081127d5249
4
- data.tar.gz: dac898db424d25bf06eee64e3cb8c338f4de8c50b2bccecce46a7e3479f028aa
3
+ metadata.gz: 964bd12f85a4c6d913e71f664c9a672114b978f0b439fcee38470891128d1740
4
+ data.tar.gz: bc62600215d921364530c368bf3d02d6b685444130bd9c36209ac42f7d2b92d9
5
5
  SHA512:
6
- metadata.gz: 7caa9b73f44e35aad52e9226044dc0faa1e9f79d2968ffbf8f51f8783ed1f034a15ea368347ce3bcaa6d97d1cf229ad3f07ced9524a3c12a19445440c7496472
7
- data.tar.gz: 4c3c9c079d7815c6f515984898aa8d547a613fb929f79081fbba696aff8b1b23190f4a3ac8ed2dc07c4f215ab8c9bedc93b419e6d0d882eec44c4aa7cdf35f6c
6
+ metadata.gz: 57e0aae70e9a102f94012dba112df99f6ed2a1ad615f18d91e55000eca18c3c29648403765b712c3019df880cb43b9453c1ec0de664f6c6674b656411b8ad3af
7
+ data.tar.gz: b2327a0fb7650b001f36f87bee57d77bc00d34a906dba295c20d2bc2a10254c9c8ecceb30aaa673e2bf89fe7d7b56732b6121db85c6bceb0534fd1b0a0118f03
@@ -14,6 +14,8 @@ before_install:
14
14
  script:
15
15
  - bundle exec rake rubocop
16
16
  - bundle exec parallel_test test/unit/ -n 4
17
+ - AUTOMATION_NAME_DROID=espresso bundle exec parallel_test test/unit/android -n 4
18
+ - AUTOMATION_NAME_DROID=appium AUTOMATION_NAME_IOS=appium bundle exec parallel_test test/unit -n 4
17
19
 
18
20
  notifications:
19
21
  email:
@@ -3,15 +3,44 @@ All notable changes to this project will be documented in this file.
3
3
  Read `release_notes.md` for commit level details.
4
4
 
5
5
  ## [Unreleased]
6
+
7
+ ### Enhancements
8
+
9
+ ### Bug fixes
10
+
11
+ ### Deprecations
12
+
13
+ ## [3.0.0] - 2019-02-06
14
+
15
+ This release has a breaking change about an implicit wait.
16
+ Ruby client sets `0` seconds as implicit wait by default instead of `20` seconds.
17
+ The behaviour follows the default spec in WebDriver.
18
+
6
19
  ### Enhancements
20
+ - **Breaking changes**
21
+ - Set implicit wait zero by default
22
+ - Can configure `wait: 20` as `appium_lib` capability to keep the behaviour
23
+ - [Experimental] Add `direct_connect` capability for the Ruby client in order to handle `directConnect` capability in a create session response by Appium server
24
+ - Update http client following `directConnectProtocol`, `directConnectHost`, `directConnectPort` and `directConnectPath`
25
+ if `direct_connect` capability for ruby_lib_core is `true`
26
+ - This will resolve a performance issue if a user has a proxy server to handle requests from client to Appium server.
27
+ With this feature, the user can send requests directly to the Appium server after create session skipping the proxy server.
28
+ ```
29
+ # create session
30
+ client <---> proxy server <---> appium server <> devices
31
+ # Following requests after the create session
32
+ client <----------------------> appium server <> devices
33
+ ```
7
34
 
8
35
  ### Bug fixes
36
+ - Fix potential override of `AppManagement#background_app`
9
37
 
10
38
  ### Deprecations
11
39
 
12
40
  ## [2.3.4] - 2019-01-31
13
41
  ### Enhancements
14
42
  - Add 3D touch option for `TouchAction#press` [appium/WebDriverAgent#79](https://github.com/appium/WebDriverAgent/pull/79)
43
+ - `:pressure` option
15
44
 
16
45
  ### Bug fixes
17
46
  - Stop sending blank value in `start_activity`
@@ -326,7 +326,7 @@ module Appium
326
326
  end
327
327
  end
328
328
 
329
- # Android, Override
329
+ # Android, Override included method in bridge
330
330
  ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
331
331
  def hide_keyboard(close_key = nil, strategy = nil)
332
332
  option = {}
@@ -338,6 +338,13 @@ module Appium
338
338
  end
339
339
  end
340
340
 
341
+ # Android, Override included method in bridge
342
+ ::Appium::Core::Device.add_endpoint_method(:background_app) do
343
+ def background_app(duration = 0)
344
+ execute :background_app, {}, seconds: duration
345
+ end
346
+ end
347
+
341
348
  # TODO: TEST ME
342
349
  ::Appium::Core::Device.add_endpoint_method(:end_coverage) do
343
350
  def end_coverage(path, intent)
@@ -37,6 +37,23 @@ module Appium
37
37
  @bridge.dialect
38
38
  end
39
39
 
40
+ # Update `server_url` and HTTP clients following this arguments, protocol, host, port and path.
41
+ # After this method, `@bridge.http` will be a new instance following them instead of `server_url` which is
42
+ # set before creating session.
43
+ #
44
+ # @example
45
+ #
46
+ # driver = core.start_driver server_url: 'http://example1.com:8000/wd/hub # @bridge.http is for `http://example1.com:8000/wd/hub/`
47
+ # driver.update_sending_request_to protocol: 'https', host: 'example2.com', port: 9000, path: '/wd/hub'
48
+ # driver.manage.timeouts.implicit_wait = 10 # @bridge.http is for `https://example2.com:9000/wd/hub/`
49
+ #
50
+ def update_sending_request_to(protocol:, host:, port:, path:)
51
+ @bridge.http.update_sending_request_to(scheme: protocol,
52
+ host: host,
53
+ port: port,
54
+ path: path)
55
+ end
56
+
40
57
  ### Methods for Appium
41
58
 
42
59
  # Lock the device
@@ -12,6 +12,37 @@ module Appium
12
12
  "appium/ruby_lib_core/#{VERSION} (#{::Selenium::WebDriver::Remote::Http::Common::DEFAULT_HEADERS['User-Agent']})"
13
13
  }.freeze
14
14
 
15
+ # Update `server_url` to.
16
+ # Set `@http` as nil to re-create http client for the server_url
17
+ # @private
18
+ #
19
+ # @param [string] scheme: A scheme to update server_url to
20
+ # @param [string] host: A host to update server_url to
21
+ # @param [string|integer] port: A port number to update server_url to
22
+ # @param [string] path: A path to update server_url to
23
+ #
24
+ # @return [URI] An instance of URI updated to. Returns default `server_url` if some of arguments are `nil`
25
+ def update_sending_request_to(scheme:, host:, port:, path:)
26
+ return @server_url unless validate_url_param(scheme, host, port, path)
27
+
28
+ Logger.debug("[experimental] This feature, #{__method__}, is an experimental")
29
+
30
+ # Add / if `path` does not have it
31
+ path = path.start_with?('/') ? path : "/#{path}"
32
+ path = path.end_with?('/') ? path : "#{path}/"
33
+
34
+ @http = nil
35
+ @server_url = URI.parse "#{scheme}://#{host}:#{port}#{path}"
36
+ end
37
+
38
+ private
39
+
40
+ def validate_url_param(scheme, host, port, path)
41
+ !(scheme.nil? || host.nil? || port.nil? || path.nil?)
42
+ end
43
+
44
+ public
45
+
15
46
  # override to use default header
16
47
  # https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/remote/http/common.rb#L46
17
48
  def call(verb, url, command_hash)
@@ -20,8 +20,9 @@ module Appium
20
20
  execute :app_strings, {}, opts
21
21
  end
22
22
 
23
- def background_app(duration = 0)
24
- execute :background_app, {}, seconds: duration
23
+ def background_app(duration = 0) # rubocop:disable Lint/UnusedMethodArgument
24
+ # Should override in each driver
25
+ raise NotImplementedError
25
26
  end
26
27
 
27
28
  def install_app(path,
@@ -43,11 +43,12 @@ module Appium
43
43
  # @return [String] By default, session id is exported in '/tmp/appium_lib_session'
44
44
  attr_reader :export_session_path
45
45
 
46
- # Default wait time for elements to appear
47
- # Returns the default client side wait. 20 seconds is by default.
46
+ # Default wait time for elements to appear in Appium server side.
47
+ # Returns the default client side wait. 0 seconds is by default. Users should handle the timeout stuff in user-side.
48
48
  # Provide Appium::Drive like { appium_lib: { wait: 30 } }
49
49
  # @return [Integer]
50
50
  attr_reader :default_wait
51
+ DEFAULT_IMPLICIT_WAIT = 0
51
52
 
52
53
  # Appium's server port. 4723 is by default.
53
54
  # Provide Appium::Drive like { appium_lib: { port: 8080 } }
@@ -75,6 +76,16 @@ module Appium
75
76
  # @return [Appium::Core::Base::Driver]
76
77
  attr_reader :driver
77
78
 
79
+ # [Experimental feature]
80
+ # Enable an experimental feature updating Appium HTTP client following `directConnectProtocol`, `directConnectHost`,
81
+ # `directConnectPort` and `directConnectPath` after session creation if the server returns them as a part of the response
82
+ # capability in _create session_.
83
+ #
84
+ # Ignore them if this parameter is `false`. Defaults to false.
85
+ #
86
+ # @return [Bool]
87
+ attr_reader :direct_connect
88
+
78
89
  # Creates a new global driver and extend particular methods to `target`
79
90
  # @param [Class] target Extend particular methods to this target.
80
91
  # @param [Hash] opts A options include capabilities for the Appium Server and for the client.
@@ -244,6 +255,13 @@ module Appium
244
255
  url: @custom_url,
245
256
  listener: @listener)
246
257
 
258
+ if @direct_connect
259
+ @driver.update_sending_request_to(protocol: @driver.capabilities['directConnectProtocol'],
260
+ host: @driver.capabilities['directConnectHost'],
261
+ port: @driver.capabilities['directConnectPort'],
262
+ path: @driver.capabilities['directConnectPath'])
263
+ end
264
+
247
265
  # export session
248
266
  write_session_id(@driver.session_id, @export_session_path) if @export_session
249
267
  rescue Errno::ECONNREFUSED
@@ -448,12 +466,14 @@ module Appium
448
466
  # @private
449
467
  def set_appium_lib_specific_values(appium_lib_opts)
450
468
  @custom_url ||= appium_lib_opts.fetch :server_url, nil
451
- @default_wait = appium_lib_opts.fetch :wait, 20
469
+ @default_wait = appium_lib_opts.fetch :wait, DEFAULT_IMPLICIT_WAIT
452
470
 
453
471
  # bump current session id into a particular file
454
472
  @export_session = appium_lib_opts.fetch :export_session, false
455
473
  @export_session_path = appium_lib_opts.fetch :export_session_path, default_tmp_appium_lib_session
456
474
 
475
+ @direct_connect = appium_lib_opts.fetch :direct_access, false
476
+
457
477
  @port = appium_lib_opts.fetch :port, DEFAULT_APPIUM_PORT
458
478
 
459
479
  # timeout and interval used in ::Appium::Comm.wait/wait_true
@@ -2,4 +2,5 @@
2
2
  require_relative 'ios/device'
3
3
 
4
4
  require_relative 'ios/uiautomation/patch'
5
+ require_relative 'ios/uiautomation/device'
5
6
  require_relative 'ios/uiautomation/bridge'
@@ -7,6 +7,7 @@ module Appium
7
7
  target.extend Appium::Core::Ios::Device
8
8
 
9
9
  Core::Ios::Uiautomation.patch_webdriver_element
10
+ Core::Ios::Uiautomation::Device.add_methods
10
11
  end
11
12
  end
12
13
  end
@@ -0,0 +1,30 @@
1
+ module Appium
2
+ module Core
3
+ module Ios
4
+ module Uiautomation
5
+ module Device
6
+ def self.add_methods
7
+ # UiAutomation, Override included method in bridge
8
+ ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
9
+ def hide_keyboard(close_key = nil, strategy = nil)
10
+ option = {}
11
+
12
+ option[:key] = close_key || 'Done' # default to Done key.
13
+ option[:strategy] = strategy || :pressKey # default to pressKey
14
+
15
+ execute :hide_keyboard, {}, option
16
+ end
17
+ end
18
+
19
+ # UiAutomation, Override included method in bridge
20
+ ::Appium::Core::Device.add_endpoint_method(:background_app) do
21
+ def background_app(duration = 0)
22
+ execute :background_app, {}, seconds: duration
23
+ end
24
+ end
25
+ end
26
+ end # module Device
27
+ end # module Uiautomation
28
+ end # module Ios
29
+ end # module Core
30
+ end # module Appium
@@ -150,7 +150,7 @@ module Appium
150
150
 
151
151
  class << self
152
152
  def extended(_mod)
153
- # Override
153
+ # Xcuitest, Override included method in bridge
154
154
  ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
155
155
  def hide_keyboard(close_key = nil, strategy = nil)
156
156
  option = {}
@@ -162,7 +162,7 @@ module Appium
162
162
  end
163
163
  end
164
164
 
165
- # Override
165
+ # Xcuitest, Override included method in bridge
166
166
  ::Appium::Core::Device.add_endpoint_method(:background_app) do
167
167
  def background_app(duration = 0)
168
168
  # https://github.com/appium/ruby_lib/issues/500, https://github.com/appium/appium/issues/7741
@@ -1,6 +1,6 @@
1
1
  module Appium
2
2
  module Core
3
- VERSION = '2.3.4'.freeze unless defined? ::Appium::Core::VERSION
4
- DATE = '2019-01-31'.freeze unless defined? ::Appium::Core::DATE
3
+ VERSION = '3.0.0'.freeze unless defined? ::Appium::Core::VERSION
4
+ DATE = '2019-02-06'.freeze unless defined? ::Appium::Core::DATE
5
5
  end
6
6
  end
@@ -1,3 +1,13 @@
1
+ #### v3.0.0 2019-02-06
2
+
3
+ - [ba653c3](https://github.com/appium/ruby_lib_core/commit/ba653c3be70bad3b9a9e233121b4b3a9455fa287) Release 3.0.0
4
+ - [77e7cd2](https://github.com/appium/ruby_lib_core/commit/77e7cd2f58bcc1fb368f9721fe071b210e071435) Release 3.0.0
5
+ - [1315dae](https://github.com/appium/ruby_lib_core/commit/1315dae75712b65707b8b519228860d6d89ac96c) set default zero implicit wait (#186)
6
+ - [61a927f](https://github.com/appium/ruby_lib_core/commit/61a927f6e6f15b718cf6b4bfb8a26242e571a2f9) Experimental add direct host (#189)
7
+ - [c9fff7b](https://github.com/appium/ruby_lib_core/commit/c9fff7b3e12eaa20a55742460147d7694f61658d) Improve override background (#188)
8
+ - [1e588c8](https://github.com/appium/ruby_lib_core/commit/1e588c87842f3844763e6c9559087302219280ab) update changelog
9
+
10
+
1
11
  #### v2.3.4 2019-01-31
2
12
 
3
13
  - [f217263](https://github.com/appium/ruby_lib_core/commit/f217263febd2bd3d6c8663f440d7959096492f7a) Release 2.3.4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.4
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-31 00:00:00.000000000 Z
11
+ date: 2019-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -297,6 +297,7 @@ files:
297
297
  - lib/appium_lib_core/ios/device.rb
298
298
  - lib/appium_lib_core/ios/device/clipboard.rb
299
299
  - lib/appium_lib_core/ios/uiautomation/bridge.rb
300
+ - lib/appium_lib_core/ios/uiautomation/device.rb
300
301
  - lib/appium_lib_core/ios/uiautomation/patch.rb
301
302
  - lib/appium_lib_core/ios/xcuitest/bridge.rb
302
303
  - lib/appium_lib_core/ios/xcuitest/device.rb