appium_lib_core 3.1.3 → 3.2.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: 5798df58380b50a707092f9b68a1ad39b3da1ac8e5103ee0c0b0f178a338c828
4
- data.tar.gz: ff85cb387a48c36ec2b4f50e4b59214cdc84fb4a7452e1f31ac7f8c127c9bebd
3
+ metadata.gz: 4ffb1cbef0e8af1c0cf3b8dba42764a0decc3f9b5938ebff6f95f09c7438e516
4
+ data.tar.gz: baaeb26f3d7333f9aeccfcb25e84a81caadae91ff90b95ce3b8f884c14fb7872
5
5
  SHA512:
6
- metadata.gz: 8bbdf3f1b440126a92ae5fac4e7f88a7edfffdcbf661acbab43c156678a3406df19294e6aa6417679b4ca6e7d1617ce89d37cd30e91c6e894bd79f8f41bc3f3f
7
- data.tar.gz: af3f57193be3c0e179b1fa0b96f0ce9a443b3e8e997df33d6ce76eaf8cb5bfd76f3f32bac4e0ebb8d13204c7e098ab7fb8646a756201914c5a7a2aaa2d47f917
6
+ metadata.gz: 7b102f1ee71cb033a2763b14f390fde773da2c02dc0c5ff6869c366a25067afd1c7448b228111c7117f1c6f5efd9e88e55f534b3c48dd1b3a1769a40bfb720c2
7
+ data.tar.gz: 70d55ecdd3cc250c6d504954006dfef47b7e89db80fcc05379ea7e71362ad572a61786651239c5f5cbd462efb4e0e8776aa594bef1540a0148278cf0789f9a4c
@@ -18,6 +18,9 @@ Metrics/ParameterLists:
18
18
  Max: 6
19
19
  Lint/NestedMethodDefinition:
20
20
  Enabled: false
21
+ # TODO: Replace <<- with <<~ after dropping Ruby 2.2
22
+ Layout/IndentHeredoc:
23
+ Enabled: false
21
24
  Style/Documentation:
22
25
  Enabled: false
23
26
  Style/CommentedKeyword:
@@ -10,6 +10,16 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
+ ## [3.2.0] - 2019-06-27
14
+
15
+ ### Enhancements
16
+ - Add `execute_driver` to run a batch script
17
+ - It requires Appium version which has `execute_driver` support
18
+
19
+ ### Bug fixes
20
+
21
+ ### Deprecations
22
+
13
23
  ## [3.1.3] - 2019-06-18
14
24
 
15
25
  ### Enhancements
@@ -28,6 +28,7 @@ require_relative 'device/battery_status'
28
28
  require_relative 'device/clipboard_content_type'
29
29
  require_relative 'device/device'
30
30
  require_relative 'device/touch_actions'
31
+ require_relative 'device/execute_driver'
31
32
 
32
33
  # The following files have selenium-webdriver related stuff.
33
34
  require_relative 'base/driver'
@@ -31,6 +31,7 @@ module Appium
31
31
  include Device::ScreenRecord::Command
32
32
  include Device::Device
33
33
  include Device::TouchActions
34
+ include Device::ExecuteDriver
34
35
 
35
36
  def commands(command)
36
37
  ::Appium::Core::Commands::MJSONWP::COMMANDS[command]
@@ -53,6 +54,13 @@ module Appium
53
54
  def send_actions(_data)
54
55
  raise Error::UnsupportedOperationError, '#send_actions has not been supported in MJSONWP'
55
56
  end
57
+
58
+ # For Appium
59
+ # @param [Hash] id The id which can get as a response from server
60
+ # @return [::Selenium::WebDriver::Element]
61
+ def convert_to_element(id)
62
+ ::Selenium::WebDriver::Element.new self, element_id_from(id)
63
+ end
56
64
  end # class MJSONWP
57
65
  end # class Bridge
58
66
  end # class Base
@@ -31,6 +31,7 @@ module Appium
31
31
  include Device::ScreenRecord::Command
32
32
  include Device::Device
33
33
  include Device::TouchActions
34
+ include Device::ExecuteDriver
34
35
 
35
36
  def commands(command)
36
37
  ::Appium::Core::Commands::W3C::COMMANDS[command]
@@ -133,6 +134,13 @@ module Appium
133
134
  ids.map { |id| ::Selenium::WebDriver::Element.new self, element_id_from(id) }
134
135
  end
135
136
 
137
+ # For Appium
138
+ # @param [Hash] id The id which can get as a response from server
139
+ # @return [::Selenium::WebDriver::Element]
140
+ def convert_to_element(id)
141
+ ::Selenium::WebDriver::Element.new self, element_id_from(id)
142
+ end
143
+
136
144
  # For Appium
137
145
  # override
138
146
  # called in `extend DriverExtensions::HasNetworkConnection`
@@ -1042,6 +1042,54 @@ module Appium
1042
1042
  template = Base64.strict_encode64 File.read img_path
1043
1043
  find_elements :image, template
1044
1044
  end
1045
+
1046
+ # @since Appium 1.14.0
1047
+ #
1048
+ # Run a set of script against the current session, allowing execution of many commands in one Appium request.
1049
+ # Supports {https://webdriver.io/docs/api.html WebdriverIO} API so far.
1050
+ # Please read {http://appium.io/docs/en/commands/session/execute-driver command API} for more details
1051
+ # about acceptable scripts and the output.
1052
+ #
1053
+ # @param [String] script The string consisting of the script itself
1054
+ # @param [String] type The name of the script type.
1055
+ # Defaults to 'webdriverio'. Depends on server implementation which type is supported.
1056
+ # @param [Integer] timeout_ms The number of `ms` Appium should wait for the script to finish
1057
+ # before killing it due to timeout.
1058
+ #
1059
+ # @return [Appium::Core::Base::Device::ExecuteDriver::Result] The script result parsed by
1060
+ # Appium::Core::Base::Device::ExecuteDriver::Result.
1061
+ #
1062
+ # @raise [::Selenium::WebDriver::Error::UnknownError] If something error happens in the script.
1063
+ # It has the original message.
1064
+ #
1065
+ # @example
1066
+ # script = <<~SCRIPT
1067
+ # const status = await driver.status();
1068
+ # console.warn('warning message');
1069
+ # return [status];
1070
+ # SCRIPT
1071
+ # r = @@driver.execute_driver(script: script, type: 'webdriverio', timeout: 10_000)
1072
+ # r #=> An instance of Appium::Core::Base::Device::ExecuteDriver::Result
1073
+ # r.result #=> The `result` key part as the result of the script
1074
+ # r.logs #=> The `logs` key part as `{'log' => [], 'warn' => [], 'error' => []}`
1075
+ #
1076
+ def execute_driver(script: '', type: 'webdriverio', timeout_ms: nil)
1077
+ @bridge.execute_driver(script: script, type: type, timeout_ms: timeout_ms)
1078
+ end
1079
+
1080
+ # Convert vanilla element response to ::Selenium::WebDriver::Element
1081
+ #
1082
+ # @param [Hash] id The id which can get as a response from server
1083
+ # @return [::Selenium::WebDriver::Element]
1084
+ #
1085
+ # @example
1086
+ # response = {"element-6066-11e4-a52e-4f735466cecf"=>"xxxx", "ELEMENT"=>"xxxx"}
1087
+ # ele = @driver.convert_to_element(response) #=> ::Selenium::WebDriver::Element
1088
+ # ele.rect #=> Can get the rect of the element
1089
+ #
1090
+ def convert_to_element(id)
1091
+ @bridge.convert_to_element id
1092
+ end
1045
1093
  end # class Driver
1046
1094
  end # class Base
1047
1095
  end # module Core
@@ -64,7 +64,8 @@ module Appium
64
64
  stop_recording_screen: [:post, 'session/:session_id/appium/stop_recording_screen'],
65
65
  start_recording_screen: [:post, 'session/:session_id/appium/start_recording_screen'],
66
66
  compare_images: [:post, 'session/:session_id/appium/compare_images'],
67
- is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown']
67
+ is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown'],
68
+ execute_driver: [:post, 'session/:session_id/appium/execute_driver']
68
69
  }.freeze
69
70
 
70
71
  COMMAND_ANDROID = {
@@ -0,0 +1,41 @@
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
+ module Device
19
+ module ExecuteDriver
20
+ class Result
21
+ attr_reader :result, :logs
22
+
23
+ def initialize(response)
24
+ @result = response['result']
25
+ @logs = response['logs']
26
+ end
27
+ end
28
+
29
+ def execute_driver(script: '', type: 'webdriverio', timeout_ms: nil)
30
+ option = { script: script, type: type }
31
+
32
+ option[:timeout] = timeout_ms if timeout_ms
33
+
34
+ response = execute :execute_driver, {}, option
35
+ Result.new(response)
36
+ end
37
+ end # module Execute
38
+ end # module Device
39
+ end # class Base
40
+ end # module Core
41
+ end # module Appium
@@ -39,7 +39,8 @@ module Appium
39
39
  :app_state,
40
40
  :stop_recording_screen, :stop_and_save_recording_screen,
41
41
  :shake, :device_time,
42
- :touch_actions, :multi_touch
42
+ :touch_actions, :multi_touch,
43
+ :execute_driver
43
44
  ].each(&method(:delegate_from_appium_driver))
44
45
  end
45
46
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '3.1.3' unless defined? ::Appium::Core::VERSION
18
- DATE = '2019-06-18' unless defined? ::Appium::Core::DATE
17
+ VERSION = '3.2.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2019-06-27' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -1,3 +1,12 @@
1
+ #### v3.2.0 2019-06-27
2
+
3
+ - [2f6ca23](https://github.com/appium/ruby_lib_core/commit/2f6ca23847de85fb8134f09da627391b4a66a544) Release 3.2.0
4
+ - [9376bf2](https://github.com/appium/ruby_lib_core/commit/9376bf2b3d573798ad1d335ca84954b5b5b15abe) add execuite_driver (#222)
5
+ - [8b70c86](https://github.com/appium/ruby_lib_core/commit/8b70c866f12f6341dfe204c3b4b1fa8946bbe305) add visual check for find by elemenet (#214)
6
+ - [f8338b9](https://github.com/appium/ruby_lib_core/commit/f8338b9386e478c498a1d6bdc4386d9590d3efa3) make uia test simple
7
+ - [b641af8](https://github.com/appium/ruby_lib_core/commit/b641af85d1e01a620d0f8cc2d033728947c92afc) wrap with wait
8
+
9
+
1
10
  #### v3.1.3 2019-06-18
2
11
 
3
12
  - [a63da6b](https://github.com/appium/ruby_lib_core/commit/a63da6b9e410d83fe1e1d35a89c430da0eae76b6) Release 3.1.3
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: 3.1.3
4
+ version: 3.2.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-06-18 00:00:00.000000000 Z
11
+ date: 2019-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -280,6 +280,7 @@ files:
280
280
  - lib/appium_lib_core/common/device/context.rb
281
281
  - lib/appium_lib_core/common/device/device.rb
282
282
  - lib/appium_lib_core/common/device/device_lock.rb
283
+ - lib/appium_lib_core/common/device/execute_driver.rb
283
284
  - lib/appium_lib_core/common/device/file_management.rb
284
285
  - lib/appium_lib_core/common/device/image_comparison.rb
285
286
  - lib/appium_lib_core/common/device/ime_actions.rb