appium_lib_core 4.7.1 → 5.0.0.beta1

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.
@@ -18,6 +18,7 @@ require_relative 'screenshot'
18
18
  require_relative 'rotable'
19
19
  require_relative 'remote_status'
20
20
  require_relative 'has_location'
21
+ require_relative 'has_network_connection'
21
22
 
22
23
  module Appium
23
24
  module Core
@@ -27,23 +28,55 @@ module Appium
27
28
  include ::Selenium::WebDriver::DriverExtensions::HasSessionId
28
29
  include ::Selenium::WebDriver::DriverExtensions::HasRemoteStatus
29
30
  include ::Selenium::WebDriver::DriverExtensions::HasWebStorage
30
- include ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
31
- include ::Selenium::WebDriver::DriverExtensions::HasTouchScreen
32
31
 
33
32
  include ::Appium::Core::Base::Rotatable
34
33
  include ::Appium::Core::Base::SearchContext
35
34
  include ::Appium::Core::Base::TakesScreenshot
36
35
  include ::Appium::Core::Base::HasRemoteStatus
37
36
  include ::Appium::Core::Base::HasLocation
37
+ include ::Appium::Core::Base::HasNetworkConnection
38
38
 
39
39
  # Private API.
40
40
  # Do not use this for general use. Used by flutter driver to get bridge for creating a new element
41
41
  attr_reader :bridge
42
42
 
43
- def initialize(opts = {})
44
- listener = opts.delete(:listener)
45
- @bridge = ::Appium::Core::Base::Bridge.handshake(**opts)
46
- super(@bridge, listener: listener)
43
+ # Almost same as self.handshake in ::Selenium::WebDriver::Remote::Bridge
44
+ #
45
+ # Implements protocol handshake which:
46
+ #
47
+ # 1. Creates session with driver.
48
+ # 2. Sniffs response.
49
+ # 3. Based on the response, understands which dialect we should use.
50
+ #
51
+ # @return [Bridge::W3C]
52
+ #
53
+ # TODO: Fixme
54
+ def create_bridge(**opts)
55
+ opts[:url] ||= service_url(opts)
56
+ caps = opts.delete(:capabilities)
57
+ # NOTE: This is deprecated
58
+ cap_array = caps.is_a?(Hash) ? [caps] : Array(caps)
59
+
60
+ desired_capabilities = opts.delete(:desired_capabilities)
61
+ if desired_capabilities
62
+ if desired_capabilities.is_a?(Hash)
63
+ desired_capabilities = ::Selenium::WebDriver::Remote::Capabilities(desired_capabilities)
64
+ end
65
+ cap_array << desired_capabilities
66
+ end
67
+
68
+ options = opts.delete(:options)
69
+ cap_array << options if options
70
+
71
+ capabilities = generate_capabilities(cap_array)
72
+
73
+ bridge_opts = { http_client: opts.delete(:http_client), url: opts.delete(:url) }
74
+ raise ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty?
75
+
76
+ bridge = ::Appium::Core::Base::Bridge::W3C.new(**bridge_opts)
77
+
78
+ bridge.create_session(capabilities)
79
+ bridge
47
80
  end
48
81
 
49
82
  # Get the dialect value
@@ -76,85 +109,6 @@ module Appium
76
109
  path: path)
77
110
  end
78
111
 
79
- AVAILABLE_METHODS = [
80
- :get, :head, :post, :put, :delete,
81
- :connect, :options, :trace, :patch
82
- ].freeze
83
- # Define a new custom method to the driver so that you can define your own method for
84
- # drivers/plugins in Appium 2.0. Appium 2.0 and its custom drivers/plugins allow you
85
- # to define custom commands that are not part of W3C spec.
86
- #
87
- # @param [Symbol] method HTTP request method as https://www.w3.org/TR/webdriver/#endpoints
88
- # @param [string] url The url to URL template as https://www.w3.org/TR/webdriver/#endpoints.
89
- # +:session_id+ is the placeholder of 'session id'.
90
- # Other place holders can be specified with +:+ prefix like +:id+.
91
- # Then, the +:id+ will be replaced with a given value as the seconds argument of +execute+
92
- # @param [Symbol] name The name of method that is called as the driver instance method.
93
- # @param [Proc] block The block to involve as the method.
94
- # Please define a method that has the same +name+ with arguments you want.
95
- # The method must has +execute+ method. tHe +execute+ is calls the +url+
96
- # with the given parameters.
97
- # The first argument should be +name+ as symbol.
98
- # The second argument should be hash. If keys in the hash matches +:+ prefix
99
- # string in the given url, the matched string in the given url will be
100
- # values in the hash.
101
- # The third argument should be hash. The hash will be the request body.
102
- # Please read examples below for more details.
103
- # @raise [ArgumentError] If the given +method+ are invalid value.
104
- #
105
- # @example
106
- #
107
- # @driver.add_command(
108
- # method: :get,
109
- # url: 'session/:session_id/path/to/custom/url',
110
- # name: :test_command
111
- # )
112
- # # Send a GET request to 'session/<session id>/path/to/custom/url'
113
- # @driver.test_command
114
- #
115
- #
116
- # @driver.add_command(
117
- # method: :post,
118
- # url: 'session/:session_id/path/to/custom/url',
119
- # name: :test_command
120
- # ) do
121
- # def test_command(argument)
122
- # execute(:test_command, {}, { dummy: argument })
123
- # end
124
- # end
125
- # # Send a POST request to 'session/<session id>/path/to/custom/url'
126
- # # with body "{ dummy: 1 }" as JSON object. "1" is the argument.
127
- # # ':session_id' in the given 'url' is replaced with current 'session id'.
128
- # @driver.test_command(1)
129
- #
130
- #
131
- # @driver.add_command(
132
- # method: :post,
133
- # url: 'session/:session_id/element/:id/custom/action',
134
- # name: :test_action_command
135
- # ) do
136
- # def test_action_command(element_id, action)
137
- # execute(:test_action_command, {id: element_id}, { dummy_action: action })
138
- # end
139
- # end
140
- # # Send a POST request to 'session/<session id>/element/<element id>/custom/action'
141
- # # with body "{ dummy_action: #{action} }" as JSON object. "action" is the seconds argument.
142
- # # ':session_id' in the given url is replaced with current 'session id'.
143
- # # ':id' in the given url is replaced with the given 'element_id'.
144
- # e = @driver.find_element :accessibility_id, 'an element'
145
- # @driver.test_action_command(e.ref, 'action')
146
- #
147
- def add_command(method:, url:, name:, &block)
148
- unless AVAILABLE_METHODS.include? method
149
- raise ::Appium::Core::Error::ArgumentError, "Available method is either #{AVAILABLE_METHODS}"
150
- end
151
-
152
- # TODO: Remove this logger
153
- ::Appium::Logger.info '[Experimental] this method is experimental for Appium 2.0. This interface may change.'
154
-
155
- @bridge.add_command method: method, url: url, name: name, &block
156
- end
157
-
158
112
  ### Methods for Appium
159
113
 
160
114
  # Lock the device
@@ -980,13 +934,13 @@ module Appium
980
934
  # Retrieve the capabilities of the specified session.
981
935
  # It's almost same as +@driver.capabilities+ but you can get more details.
982
936
  #
983
- # @return [Selenium::WebDriver::Remote::Capabilities, Selenium::WebDriver::Remote::W3C::Capabilities]
937
+ # @return [Selenium::WebDriver::Remote::Capabilities, Selenium::WebDriver::Remote::Capabilities]
984
938
  #
985
939
  # @example
986
940
  # @driver.session_capabilities
987
941
  #
988
942
  # #=> uiautomator2
989
- # # <Selenium::WebDriver::Remote::W3C::Capabilities:0x007fa38dae1360
943
+ # # <Selenium::WebDriver::Remote::Capabilities:0x007fa38dae1360
990
944
  # # @capabilities=
991
945
  # # {:proxy=>nil,
992
946
  # # :browser_name=>nil,
@@ -1036,7 +990,7 @@ module Appium
1036
990
  # # "viewportRect"=>{"left"=>0, "top"=>63, "width"=>1080, "height"=>1731}}>
1037
991
  # #
1038
992
  # #=> XCUITest
1039
- # # <Selenium::WebDriver::Remote::W3C::Capabilities:0x007fb15dc01370
993
+ # # <Selenium::WebDriver::Remote::Capabilities:0x007fb15dc01370
1040
994
  # # @capabilities=
1041
995
  # # {:proxy=>nil,
1042
996
  # # :browser_name=>"UICatalog",
@@ -52,26 +52,19 @@ module Appium
52
52
  # @param [String, Number] latitude Set the latitude.
53
53
  # @param [String, Number] longitude Set the longitude.
54
54
  # @param [String, Number] altitude Set the altitude.
55
- # @param [String, Number] speed Set the speed to apply the location on Android real devices
56
- # in meters/second @since Appium 1.21.0 and in knots for emulators @since Appium 1.22.0.
57
- # @param [String, Number] satellites Sets the count of geo satellites being tracked in range 1..12 @since Appium 1.22.0.
58
- # This number is respected on Emulators.
55
+ # @param [String, Number] speed Set the speed to apply the location on Android real devices @since Appium 1.21.0.
59
56
  # @param [::Selenium::WebDriver::Location]
60
57
  #
61
58
  # @example
62
59
  #
63
60
  # driver.location = ::Selenium::WebDriver::Location.new(10, 10, 10)
64
61
  #
65
- def set_location(latitude, longitude, altitude, speed: nil, satellites: nil)
66
- if speed.nil? && satellites.nil?
62
+ def set_location(latitude, longitude, altitude, speed: nil)
63
+ if speed.nil?
67
64
  self.location = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
68
65
  else
69
66
  loc = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
70
-
71
- speed = Float(speed) unless speed.nil?
72
- satellites = Integer(satellites) unless satellites.nil?
73
-
74
- @bridge.set_location loc.latitude, loc.longitude, loc.altitude, speed: speed, satellites: satellites
67
+ @bridge.set_location loc.latitude, loc.longitude, loc.altitude, speed: Float(speed)
75
68
  end
76
69
  end
77
70
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Appium
16
+ module Core
17
+ class Base
18
+ #
19
+ # @api private
20
+ #
21
+ module HasNetworkConnection
22
+ def network_connection_type
23
+ connection_value = @bridge.network_connection
24
+
25
+ connection_type = values_to_type[connection_value]
26
+
27
+ # In case the connection type is not recognized return the
28
+ # connection value.
29
+ connection_type || connection_value
30
+ end
31
+
32
+ def network_connection_type=(connection_type)
33
+ raise ArgumentError, 'Invalid connection type' unless valid_type? connection_type
34
+
35
+ connection_value = type_to_values[connection_type]
36
+
37
+ @bridge.network_connection = connection_value
38
+ end
39
+
40
+ private
41
+
42
+ def type_to_values
43
+ { airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0 }
44
+ end
45
+
46
+ def values_to_type
47
+ type_to_values.invert
48
+ end
49
+
50
+ def valid_type?(type)
51
+ type_to_values.keys.include? type
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -34,7 +34,6 @@ require_relative 'device/orientation'
34
34
  # The following files have selenium-webdriver related stuff.
35
35
  require_relative 'base/driver'
36
36
  require_relative 'base/bridge'
37
- require_relative 'base/bridge/mjsonwp'
38
37
  require_relative 'base/bridge/w3c'
39
38
  require_relative 'base/capabilities'
40
39
  require_relative 'base/http_default'
@@ -14,5 +14,4 @@
14
14
 
15
15
  require_relative 'base/command'
16
16
  require_relative 'command/common'
17
- require_relative 'command/mjsonwp'
18
17
  require_relative 'command/w3c'
@@ -27,11 +27,8 @@ module Appium
27
27
 
28
28
  class UnsupportedOperationError < CoreError; end
29
29
 
30
- # Server side errors
30
+ # Server side error
31
31
  class ServerError < CoreError; end
32
-
33
- # ruby_lib_core library specific errors
34
- class ArgumentError < CoreError; end
35
32
  end
36
33
  end
37
34
  end
@@ -79,10 +79,6 @@ module Appium
79
79
  end
80
80
 
81
81
  def create_bridge_command(method, &block)
82
- ::Appium::Core::Base::Bridge::MJSONWP.class_eval do
83
- undef_method method if method_defined? method
84
- block_given? ? class_eval(&block) : define_method(method) { execute method }
85
- end
86
82
  ::Appium::Core::Base::Bridge::W3C.class_eval do
87
83
  undef_method method if method_defined? method
88
84
  block_given? ? class_eval(&block) : define_method(method) { execute method }
@@ -368,10 +368,10 @@ module Appium
368
368
 
369
369
  begin
370
370
  # included https://github.com/SeleniumHQ/selenium/blob/43f8b3f66e7e01124eff6a5805269ee441f65707/rb/lib/selenium/webdriver/remote/driver.rb#L29
371
- @driver = ::Appium::Core::Base::Driver.new(http_client: @http_client,
372
- desired_capabilities: @caps,
373
- url: @custom_url,
374
- listener: @listener)
371
+ @driver = ::Appium::Core::Base::Driver.new(listener: @listener,
372
+ http_client: @http_client,
373
+ desired_capabilities: @caps,
374
+ url: @custom_url)
375
375
 
376
376
  if @direct_connect
377
377
  d_c = DirectConnections.new(@driver.capabilities)
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '4.7.1' unless defined? ::Appium::Core::VERSION
18
- DATE = '2021-09-26' unless defined? ::Appium::Core::DATE
17
+ VERSION = '5.0.0.beta1' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-03-21' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
data/release_notes.md CHANGED
@@ -1,36 +1,3 @@
1
- #### v4.7.1 2021-09-26
2
-
3
- - [cdd8906](https://github.com/appium/ruby_lib_core/commit/cdd890662585aa5051912d20d90ec3c3866ad8b1) Release 4.7.1
4
- - [059b092](https://github.com/appium/ruby_lib_core/commit/059b0920becd60d691b0b4fac05cc0d96bcc59c7) ci: tweak brew install
5
- - [fb32697](https://github.com/appium/ruby_lib_core/commit/fb32697d5ee7cf4ea4367aa9f9bf4458723d6fce) feat: allow to override an existing method by add_command (#330)
6
- - [cbf7f1f](https://github.com/appium/ruby_lib_core/commit/cbf7f1fc2ce6bb8833e2a7324446d79cbc848834) chore(deps-dev): update webmock requirement from ~> 3.13.0 to ~> 3.14.0 (#329)
7
- - [beefb17](https://github.com/appium/ruby_lib_core/commit/beefb179ac25e9337bf2badaf4eb0c4cfc5b1e45) chore(deps-dev): update rubocop requirement from = 1.12.0 to = 1.12.1 (#322)
8
- - [3438b48](https://github.com/appium/ruby_lib_core/commit/3438b481523ec978d06bc243cd42eee8dc00356f) docs: tweak docstring
9
-
10
-
11
- #### v4.7.0 2021-07-17
12
-
13
- - [0059974](https://github.com/appium/ruby_lib_core/commit/0059974b0b1d79a822db84d8b0169e8393e00ef9) Release 4.7.0
14
- - [0f93a52](https://github.com/appium/ruby_lib_core/commit/0f93a52bbdc44bf916c9b974fe9fd09d48e5ff39) test: add more example and test (#328)
15
- - [9e37b3b](https://github.com/appium/ruby_lib_core/commit/9e37b3bc15f72f7c0117a49945a3fe482598f374) feat: add satellites for Android emulators (#327)
16
- - [3063a73](https://github.com/appium/ruby_lib_core/commit/3063a73fa291dc378daa53b7df2e4b0b8a6f03d2) ci: calls quit_driver to ensure close the previous session
17
- - [43fb9e7](https://github.com/appium/ruby_lib_core/commit/43fb9e77f5492a92f4f8c5a5bda71be9c3a9e2c8) chore: tweak naming in an internal variable
18
-
19
-
20
- #### v4.6.0 2021-06-03
21
-
22
- - [0dacfab](https://github.com/appium/ruby_lib_core/commit/0dacfab1256e1447e1f7a5974dfcf48ee0a72b9d) Release 4.6.0
23
- - [b9f015d](https://github.com/appium/ruby_lib_core/commit/b9f015d7dea14964a0733f2385ebcff68da1e18e) feat: allow to add commands dynamically (#325)
24
- - [3de96ee](https://github.com/appium/ruby_lib_core/commit/3de96eea133ccbcbc5c4d77adc7d67c065a5a38c) chore(deps-dev): update webmock requirement from ~> 3.12.1 to ~> 3.13.0 (#324)
25
- - [f1a9e79](https://github.com/appium/ruby_lib_core/commit/f1a9e79f3bd4d134e125fc2ed9adcf3d085afc9a) docs: address func test code as working example
26
- - [eb85b1b](https://github.com/appium/ruby_lib_core/commit/eb85b1b26623436cb0aae95a00fef7bc2d795520) remove ; in a test
27
- - [1632637](https://github.com/appium/ruby_lib_core/commit/1632637fd872c0b80dfb97b8514ada6a7164eebf) chore(deps-dev): update rubocop requirement from = 1.11.0 to = 1.12.0 (#321)
28
- - [b9e47aa](https://github.com/appium/ruby_lib_core/commit/b9e47aa9b02f060ffa91e8410ab97dc87d3640a4) docs: add docstring
29
- - [954a2fe](https://github.com/appium/ruby_lib_core/commit/954a2feebb768a55b496a2614d9e4dd8b702fc1e) chore(deps-dev): update rubocop requirement from = 1.8.1 to = 1.11.0 (#316)
30
- - [a5b9651](https://github.com/appium/ruby_lib_core/commit/a5b9651aa349c10bd9759fedac6f09e27012a5e5) chore(deps-dev): update webmock requirement from ~> 3.11.0 to ~> 3.12.1 (#319)
31
- - [485c096](https://github.com/appium/ruby_lib_core/commit/485c096273178aa5e21f28d93545fd127cbb8735) test: add assertion
32
-
33
-
34
1
  #### v4.5.0 2021-03-14
35
2
 
36
3
  - [656230e](https://github.com/appium/ruby_lib_core/commit/656230e688ed86414c06efaa73bce7359933cc91) Release 4.5.0
data/script/commands.rb CHANGED
@@ -18,25 +18,21 @@ require './lib/appium_lib_core'
18
18
  module Script
19
19
  class CommandsChecker
20
20
  attr_reader :spec_commands,
21
- :implemented_mjsonwp_commands, :implemented_w3c_commands, :implemented_core_commands,
22
- :webdriver_oss_commands, :webdriver_w3c_commands
21
+ :implemented_w3c_commands, :implemented_core_commands,
22
+ :webdriver_w3c_commands
23
23
 
24
24
  # Set commands implemented in this core library.
25
25
  #
26
- # - implemented_mjsonwp_commands: All commands include ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS
27
26
  # - implemented_w3c_commands: All commands include ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS
28
27
  # - implemented_core_commands: All commands except for selenium-webdriver's commands
29
- # - webdriver_oss_commands: ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS
30
28
  # - webdriver_w3c_commands: ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS
31
29
  #
32
30
  def initialize
33
31
  @spec_commands = nil
34
32
 
35
- @implemented_mjsonwp_commands = convert_driver_commands Appium::Core::Commands::MJSONWP::COMMANDS
36
33
  @implemented_w3c_commands = convert_driver_commands Appium::Core::Commands::W3C::COMMANDS
37
34
  @implemented_core_commands = convert_driver_commands Appium::Core::Commands::COMMANDS
38
35
 
39
- @webdriver_oss_commands = convert_driver_commands Appium::Core::Base::Commands::OSS
40
36
  @webdriver_w3c_commands = convert_driver_commands Appium::Core::Base::Commands::W3C
41
37
  end
42
38
 
@@ -80,18 +76,6 @@ module Script
80
76
  end
81
77
  end
82
78
 
83
- # All commands which haven't been implemented in ruby core library yet.
84
- # @return [Hash]
85
- #
86
- def all_diff_commands_mjsonwp
87
- result = compare_commands(@spec_commands, @implemented_mjsonwp_commands)
88
-
89
- white_list.each { |v| result.delete v }
90
- w3c_spec.each { |v| result.delete v }
91
-
92
- result
93
- end
94
-
95
79
  # All commands which haven't been implemented in ruby core library yet.
96
80
  # @return [Hash]
97
81
  #
@@ -111,13 +95,6 @@ module Script
111
95
  result
112
96
  end
113
97
 
114
- def diff_webdriver_oss
115
- result = compare_commands(@spec_commands, @webdriver_oss_commands)
116
- white_list.each { |v| result.delete v }
117
- w3c_spec.each { |v| result.delete v }
118
- result
119
- end
120
-
121
98
  def diff_webdriver_w3c
122
99
  result = compare_commands(@spec_commands, @webdriver_w3c_commands)
123
100
  white_list.each { |v| result.delete v }
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.1
4
+ version: 5.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2021-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '3.14'
20
- - - ">="
17
+ - - '='
21
18
  - !ruby/object:Gem::Version
22
- version: 3.14.1
19
+ version: 4.0.0.beta2
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '3.14'
30
- - - ">="
24
+ - - '='
31
25
  - !ruby/object:Gem::Version
32
- version: 3.14.1
26
+ version: 4.0.0.beta2
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: faye-websocket
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -120,28 +114,28 @@ dependencies:
120
114
  requirements:
121
115
  - - "~>"
122
116
  - !ruby/object:Gem::Version
123
- version: 3.14.0
117
+ version: 3.12.1
124
118
  type: :development
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - "~>"
129
123
  - !ruby/object:Gem::Version
130
- version: 3.14.0
124
+ version: 3.12.1
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: rubocop
133
127
  requirement: !ruby/object:Gem::Requirement
134
128
  requirements:
135
129
  - - '='
136
130
  - !ruby/object:Gem::Version
137
- version: 1.12.1
131
+ version: 1.11.0
138
132
  type: :development
139
133
  prerelease: false
140
134
  version_requirements: !ruby/object:Gem::Requirement
141
135
  requirements:
142
136
  - - '='
143
137
  - !ruby/object:Gem::Version
144
- version: 1.12.1
138
+ version: 1.11.0
145
139
  - !ruby/object:Gem::Dependency
146
140
  name: appium_thor
147
141
  requirement: !ruby/object:Gem::Requirement
@@ -262,12 +256,12 @@ files:
262
256
  - lib/appium_lib_core/common.rb
263
257
  - lib/appium_lib_core/common/base.rb
264
258
  - lib/appium_lib_core/common/base/bridge.rb
265
- - lib/appium_lib_core/common/base/bridge/mjsonwp.rb
266
259
  - lib/appium_lib_core/common/base/bridge/w3c.rb
267
260
  - lib/appium_lib_core/common/base/capabilities.rb
268
261
  - lib/appium_lib_core/common/base/command.rb
269
262
  - lib/appium_lib_core/common/base/driver.rb
270
263
  - lib/appium_lib_core/common/base/has_location.rb
264
+ - lib/appium_lib_core/common/base/has_network_connection.rb
271
265
  - lib/appium_lib_core/common/base/http_default.rb
272
266
  - lib/appium_lib_core/common/base/platform.rb
273
267
  - lib/appium_lib_core/common/base/remote_status.rb
@@ -276,7 +270,6 @@ files:
276
270
  - lib/appium_lib_core/common/base/search_context.rb
277
271
  - lib/appium_lib_core/common/command.rb
278
272
  - lib/appium_lib_core/common/command/common.rb
279
- - lib/appium_lib_core/common/command/mjsonwp.rb
280
273
  - lib/appium_lib_core/common/command/w3c.rb
281
274
  - lib/appium_lib_core/common/device/app_management.rb
282
275
  - lib/appium_lib_core/common/device/app_state.rb
@@ -334,7 +327,7 @@ homepage: https://github.com/appium/ruby_lib_core/
334
327
  licenses:
335
328
  - Apache-2.0
336
329
  metadata: {}
337
- post_install_message:
330
+ post_install_message:
338
331
  rdoc_options: []
339
332
  require_paths:
340
333
  - lib
@@ -342,15 +335,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
342
335
  requirements:
343
336
  - - ">="
344
337
  - !ruby/object:Gem::Version
345
- version: '2.4'
338
+ version: '2.5'
346
339
  required_rubygems_version: !ruby/object:Gem::Requirement
347
340
  requirements:
348
- - - ">="
341
+ - - ">"
349
342
  - !ruby/object:Gem::Version
350
- version: '0'
343
+ version: 1.3.1
351
344
  requirements: []
352
- rubygems_version: 3.2.15
353
- signing_key:
345
+ rubygems_version: 3.1.2
346
+ signing_key:
354
347
  specification_version: 4
355
348
  summary: Minimal Ruby library for Appium.
356
349
  test_files: []
@@ -1,108 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- module Appium
16
- module Core
17
- class Base
18
- class Bridge
19
- class MJSONWP < ::Selenium::WebDriver::Remote::OSS::Bridge
20
- include Device::DeviceLock
21
- include Device::Keyboard
22
- include Device::ImeActions
23
- include Device::Setting
24
- include Device::Context
25
- include Device::Value
26
- include Device::FileManagement
27
- include Device::KeyEvent
28
- include Device::ImageComparison
29
- include Device::AppManagement
30
- include Device::AppState
31
- include Device::ScreenRecord::Command
32
- include Device::Device
33
- include Device::TouchActions
34
- include Device::ExecuteDriver
35
-
36
- attr_reader :available_commands
37
-
38
- def initialize(capabilities, session_id, **opts)
39
- @available_commands = ::Appium::Core::Commands::MJSONWP::COMMANDS.dup
40
- super(capabilities, session_id, **opts)
41
- end
42
-
43
- def commands(command)
44
- @available_commands[command]
45
- end
46
-
47
- # command for Appium 2.0.
48
- def add_command(method:, url:, name:, &block)
49
- ::Appium::Logger.debug "Overriding the method '#{name}' for '#{url}'" if @available_commands.key? name
50
-
51
- @available_commands[name] = [method, url]
52
-
53
- ::Appium::Core::Device.add_endpoint_method name, &block
54
- end
55
-
56
- # Returns all available sessions on the Appium server instance
57
- def sessions
58
- execute :get_all_sessions
59
- end
60
-
61
- def status
62
- execute :status
63
- end
64
-
65
- # For Appium
66
- def log_event(vendor, event)
67
- execute :post_log_event, {}, { vendor: vendor, event: event }
68
- end
69
-
70
- # For Appium
71
- def log_events(type = nil)
72
- args = {}
73
- args['type'] = type unless type.nil?
74
-
75
- execute :get_log_events, {}, args
76
- end
77
-
78
- def take_element_screenshot(element)
79
- execute :take_element_screenshot, id: element.ref
80
- end
81
-
82
- def take_viewport_screenshot
83
- # TODO: this hasn't been supported by Espresso driver
84
- execute_script('mobile: viewportScreenshot')
85
- end
86
-
87
- def send_actions(_data)
88
- raise Error::UnsupportedOperationError, '#send_actions has not been supported in MJSONWP'
89
- end
90
-
91
- # For Appium
92
- # @param [Hash] id The id which can get as a response from server
93
- # @return [::Selenium::WebDriver::Element]
94
- def convert_to_element(id)
95
- ::Selenium::WebDriver::Element.new self, element_id_from(id)
96
- end
97
-
98
- def set_location(lat, lon, alt = 0.0, speed: nil, satellites: nil)
99
- loc = { latitude: lat, longitude: lon, altitude: alt }
100
- loc[:speed] = speed unless speed.nil?
101
- loc[:satellites] = satellites unless satellites.nil?
102
- execute :set_location, {}, { location: loc }
103
- end
104
- end # class MJSONWP
105
- end # class Bridge
106
- end # class Base
107
- end # module Core
108
- end # module Appium