appium_lib_core 1.8.4 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcdd560eba95515aba5c80f8fb3970002dafb55d
4
- data.tar.gz: 30b34aea4b1ca749039eb25af1f28b1fa95120a9
3
+ metadata.gz: e54e7cdd9d8e4b055e6163dc93a84773e7485fa1
4
+ data.tar.gz: dd1e4c1c37c7f16dabf8a9efd1bdf98b0382f20a
5
5
  SHA512:
6
- metadata.gz: be9a5b0f0a10c636f172cbf94f91e6a22ff96fe02401a531f669c0ce4b9491b2af39f9a06659c514412b52df6610f1f0c58af99b771b88585cfd4c713593e5c8
7
- data.tar.gz: afc331fbdeaeaf0f6c3b8e364dfc76eb969e7f38bc050eb8c250e47e87cfa969e031c5ba4d602761a0d6d356e3bab80c33c26e2ce79fc64f962733199d4fafd2
6
+ metadata.gz: aec282e234f4055fac207057889bb7cfbcd2d3eb3852c50a5b7cb17ed0b8ed78764d28639620d6ff4683446bfe3597597394397e141b6ba5747806e5411bd9af
7
+ data.tar.gz: 63b10b77c865e4399e617c794f725edd23d559b8f03dfb9377057fef66543efcd83a21073a3951d61410d5f4178747f35f3cec816a58c1df48ffc0e366c2ff72
data/CHANGELOG.md CHANGED
@@ -8,6 +8,18 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  ### Deprecations
10
10
 
11
+ ## [1.9.0] - 2018-08-05
12
+ ### Enhancements
13
+ - Update documentation about `start_recording_screen`
14
+ - Port `send_keys/type` for active element [#122](https://github.com/appium/ruby_lib_core/pull/122)
15
+ - Support `find_element/s :image, partial_image` [#119](https://github.com/appium/ruby_lib_core/pull/119)
16
+ - Requires `selenium-webdriver 3.14+` because of W3C actions [#115](https://github.com/appium/ruby_lib_core/pull/115)
17
+
18
+ ### Bug fixes
19
+
20
+ ### Deprecations
21
+ - [Internal] Deprecate experimental `ImageElement` in favor of `Element`
22
+
11
23
  ## [1.8.4] - 2018-07-28
12
24
  ### Enhancements
13
25
  - silence warning for pointeractions [#113](https://github.com/appium/ruby_lib_core/pull/113)
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_runtime_dependency 'selenium-webdriver', '~> 3.5', '< 3.14'
25
+ spec.add_runtime_dependency 'selenium-webdriver', '~> 3.14'
26
26
  spec.add_runtime_dependency 'faye-websocket', '~> 0.10.0'
27
27
 
28
28
  spec.add_development_dependency 'bundler', '~> 1.14'
@@ -1,4 +1,3 @@
1
1
  # loaded in common/driver.rb
2
- require_relative 'android/search_context'
3
2
  require_relative 'android/device'
4
3
  require_relative 'android/uiautomator1/bridge'
@@ -202,6 +202,11 @@ module Appium
202
202
  # use a size supported by your device's Advanced Video Coding (AVC) encoder.
203
203
  # For example, "1280x720"
204
204
  # @param [String] time_limit: Recording time. 180 seconds is by default.
205
+ # Since Appium 1.8.2 the time limit can be up to 1800 seconds (30 minutes).
206
+ # Appium will automatically try to merge the 3-minutes chunks recorded
207
+ # by the screenrecord utility, however, this requires FFMPEG utility
208
+ # to be installed and available in PATH on the server machine. If the utility is not
209
+ # present then the most recent screen recording chunk is going to be returned as the result.
205
210
  # @param [String] bit_rate: The video bit rate for the video, in megabits per second.
206
211
  # 4 Mbp/s(4000000) is by default for Android API level below 27. 20 Mb/s(20000000) for API level 27 and above.
207
212
  # @param [Boolean] bug_report: Set it to `true` in order to display additional information on the video overlay,
@@ -5,7 +5,6 @@ module Appium
5
5
  module Bridge
6
6
  def self.for(target)
7
7
  target.extend Appium::Core::Android::Device
8
- Core::Android::SearchContext.extend
9
8
  end
10
9
  end
11
10
  end
@@ -5,7 +5,6 @@ module Appium
5
5
  module Bridge
6
6
  def self.for(target)
7
7
  target.extend Appium::Core::Android::Device
8
- Core::Android::SearchContext.extend
9
8
  end
10
9
  end
11
10
  end
@@ -5,7 +5,6 @@ module Appium
5
5
  module Bridge
6
6
  def self.for(target)
7
7
  target.extend Appium::Core::Android::Device
8
- Core::Android::SearchContext.extend
9
8
  target.extend Appium::Core::Android::Uiautomator2::Device
10
9
  end
11
10
  end
@@ -1,4 +1,3 @@
1
1
  # loaded in common/driver.rb
2
- require_relative 'android/search_context'
3
2
  require_relative 'android/device'
4
3
  require_relative 'android/espresso/bridge'
@@ -1,5 +1,4 @@
1
1
  # loaded in common/driver.rb
2
- require_relative 'android/search_context'
3
2
  require_relative 'android/device'
4
3
 
5
4
  require_relative 'android/uiautomator2/bridge'
@@ -22,70 +22,6 @@ module Appium
22
22
  ::Appium::Core::Commands::MJSONWP::COMMANDS[command]
23
23
  end
24
24
 
25
- #
26
- # @return [::Appium::Core::ImageElement|nil]
27
- # @raise [::Selenium::WebDriver::Error::TimeOutError|::Selenium::WebDriver::Error::WebDriverError]
28
- #
29
- def find_element_by_image(full_image:, partial_image:, match_threshold: nil, visualize: false)
30
- options = {}
31
- options[:threshold] = match_threshold unless match_threshold.nil?
32
- options[:visualize] = visualize
33
-
34
- params = {}
35
- params[:mode] = :matchTemplate
36
- params[:firstImage] = full_image
37
- params[:secondImage] = partial_image
38
- params[:options] = options if options
39
-
40
- result = execute(:compare_images, {}, params)
41
- rect = result['rect']
42
-
43
- if rect
44
- return ::Appium::Core::ImageElement.new(self,
45
- rect['x'],
46
- rect['y'],
47
- rect['width'],
48
- rect['height'],
49
- result['visualization'])
50
- end
51
- nil
52
- end
53
-
54
- #
55
- # @return [[]|[::Appium::Core::ImageElement]]
56
- # @raise [::Selenium::WebDriver::Error::TimeOutError|::Selenium::WebDriver::Error::WebDriverError]
57
- #
58
- def find_elements_by_image(full_image:, partial_images:, match_threshold: nil, visualize: false)
59
- options = {}
60
- options[:threshold] = match_threshold unless match_threshold.nil?
61
- options[:visualize] = visualize
62
-
63
- params = {}
64
- params[:mode] = :matchTemplate
65
- params[:firstImage] = full_image
66
- params[:options] = options if options
67
-
68
- partial_images.each_with_object([]) do |partial_image, acc|
69
- params[:secondImage] = partial_image
70
-
71
- begin
72
- result = execute(:compare_images, {}, params)
73
- rect = result['rect']
74
-
75
- if result['rect']
76
- acc.push ::Appium::Core::ImageElement.new(self,
77
- rect['x'],
78
- rect['y'],
79
- rect['width'],
80
- rect['height'],
81
- result['visualization'])
82
- end
83
- rescue ::Selenium::WebDriver::Error::WebDriverError => e
84
- acc if e.message.include?('Cannot find any occurrences')
85
- end
86
- end
87
- end
88
-
89
25
  def take_element_screenshot(element)
90
26
  execute :take_element_screenshot, id: element.ref
91
27
  end
@@ -1,18 +1,8 @@
1
- require 'base64'
2
-
3
1
  module Appium
4
2
  module Core
5
3
  class Base
6
4
  class Bridge
7
5
  class W3C < ::Selenium::WebDriver::Remote::W3C::Bridge
8
- def self.silence_warnings_redefining(&block)
9
- warn_level = $VERBOSE
10
- $VERBOSE = nil
11
- result = block.call
12
- $VERBOSE = warn_level
13
- result
14
- end
15
-
16
6
  include Device::DeviceLock
17
7
  include Device::Keyboard
18
8
  include Device::ImeActions
@@ -28,10 +18,6 @@ module Appium
28
18
  include Device::Device
29
19
  include Device::TouchActions
30
20
 
31
- # Used for default duration of each touch actions
32
- # Override from 250 milliseconds to 50 milliseconds
33
- W3C.silence_warnings_redefining { ::Selenium::WebDriver::PointerActions::DEFAULT_MOVE_DURATION = 0.05 }
34
-
35
21
  def commands(command)
36
22
  ::Appium::Core::Commands::W3C::COMMANDS[command]
37
23
  end
@@ -50,9 +36,13 @@ module Appium
50
36
  # element = @driver.find_element(:id, "some id")
51
37
  # @driver.action.click(element).perform # The `click` is a part of `PointerActions`
52
38
  #
53
- # # You can change the kind as the below.
54
- # @driver.action(kind: :mouse).click(element).perform # The `click` is a part of `PointerActions`
55
- #
39
+ def action(async = false)
40
+ # Used for default duration of each touch actions
41
+ # Override from 250 milliseconds to 50 milliseconds
42
+ action_builder = super
43
+ action_builder.default_move_duration = 0.05
44
+ action_builder
45
+ end
56
46
 
57
47
  # Port from MJSONWP
58
48
  def get_timeouts
@@ -64,6 +54,12 @@ module Appium
64
54
  ::Selenium::WebDriver::Remote::W3C::Capabilities.json_create execute(:get_capabilities)
65
55
  end
66
56
 
57
+ # Port from MJSONWP
58
+ def send_keys_to_active_element(key)
59
+ text = ::Selenium::WebDriver::Keys.encode(key).join('')
60
+ execute :send_keys_to_active_element, {}, { value: text.split(//) }
61
+ end
62
+
67
63
  # For Appium
68
64
  # override
69
65
  def page_source
@@ -109,70 +105,6 @@ module Appium
109
105
  ids.map { |id| ::Selenium::WebDriver::Element.new self, element_id_from(id) }
110
106
  end
111
107
 
112
- #
113
- # @return [::Appium::Core::ImageElement|nil]
114
- # @raise [::Selenium::WebDriver::Error::TimeOutError|::Selenium::WebDriver::Error::WebDriverError]
115
- #
116
- def find_element_by_image(full_image:, partial_image:, match_threshold: nil, visualize: false)
117
- options = {}
118
- options[:threshold] = match_threshold unless match_threshold.nil?
119
- options[:visualize] = visualize
120
-
121
- params = {}
122
- params[:mode] = :matchTemplate
123
- params[:firstImage] = full_image
124
- params[:secondImage] = partial_image
125
- params[:options] = options if options
126
-
127
- result = execute(:compare_images, {}, params)
128
- rect = result['rect']
129
-
130
- if rect
131
- return ::Appium::Core::ImageElement.new(self,
132
- rect['x'],
133
- rect['y'],
134
- rect['width'],
135
- rect['height'],
136
- result['visualization'])
137
- end
138
- nil
139
- end
140
-
141
- #
142
- # @return [[]|[::Appium::Core::ImageElement]]
143
- # @raise [::Selenium::WebDriver::Error::TimeOutError|::Selenium::WebDriver::Error::WebDriverError]
144
- #
145
- def find_elements_by_image(full_image:, partial_images:, match_threshold: nil, visualize: false)
146
- options = {}
147
- options[:threshold] = match_threshold unless match_threshold.nil?
148
- options[:visualize] = visualize
149
-
150
- params = {}
151
- params[:mode] = :matchTemplate
152
- params[:firstImage] = full_image
153
- params[:options] = options if options
154
-
155
- partial_images.each_with_object([]) do |partial_image, acc|
156
- params[:secondImage] = partial_image
157
-
158
- begin
159
- result = execute(:compare_images, {}, params)
160
- rect = result['rect']
161
-
162
- if result['rect']
163
- acc.push ::Appium::Core::ImageElement.new(self,
164
- rect['x'],
165
- rect['y'],
166
- rect['width'],
167
- rect['height'],
168
- result['visualization'])
169
- end
170
- rescue ::Selenium::WebDriver::Error::WebDriverError => e
171
- acc if e.message.include?('Cannot find any occurrences')
172
- end
173
- end
174
- end
175
-
176
108
  # For Appium
177
109
  # override
178
110
  # called in `extend DriverExtensions::HasNetworkConnection`
@@ -99,6 +99,18 @@ module Appium
99
99
  @bridge.is_keyboard_shown
100
100
  end
101
101
 
102
+ # Send keys for a current active element
103
+ # @param [String] key Input text
104
+ #
105
+ # @example
106
+ #
107
+ # @driver.send_keys 'happy testing!'
108
+ #
109
+ def send_keys(*key)
110
+ @bridge.send_keys_to_active_element(key)
111
+ end
112
+ alias type send_keys
113
+
102
114
  # Get appium Settings for current test session
103
115
  #
104
116
  # @example
@@ -786,73 +798,47 @@ module Appium
786
798
  @bridge.compare_images(mode: mode, first_image: first_image, second_image: second_image, options: options)
787
799
  end
788
800
 
789
- # Return ImageElement if current view has a partial image
801
+ # @since Appium 1.8.2
802
+ # Return an element if current view has a partial image. The logic depends on template matching by OpenCV.
803
+ # @see https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
804
+ # You can handle settings for the comparision following below.
805
+ # @see https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js#L6
790
806
  #
791
807
  # @param [String] png_img_path A path to a partial image you'd like to find
792
- # @param [Flood] match_threshold At what normalized threshold to reject
793
- # @param [Bool] visualize Makes the endpoint to return an image, which contains the visualized result of
794
- # the corresponding picture matching operation. This option is disabled by default.
795
808
  #
796
- # @return [::Appium::Core::ImageElement]
797
- # @raise [::Appium::Core::Error::NoSuchElementError|::Appium::Core::Error::CoreError] No such element
809
+ # @return [::Selenium::WebDriver::Element]
798
810
  #
799
811
  # @example
800
812
  #
813
+ # @@driver.update_settings({ fixImageFindScreenshotDims: false, fixImageTemplateSize: true,
814
+ # autoUpdateImageElementPosition: true })
801
815
  # e = @@driver.find_element_by_image './test/functional/data/test_element_image.png'
802
816
  #
803
- def find_element_by_image(png_img_path, match_threshold: DEFAULT_MATCH_THRESHOLD, visualize: false)
804
- full_image = @bridge.screenshot
805
- partial_image = Base64.encode64 File.read(png_img_path)
806
-
807
- element = begin
808
- @bridge.find_element_by_image(full_image: full_image,
809
- partial_image: partial_image,
810
- match_threshold: match_threshold,
811
- visualize: visualize)
812
- rescue Selenium::WebDriver::Error::TimeOutError
813
- raise ::Appium::Core::Error::NoSuchElementError
814
- rescue ::Selenium::WebDriver::Error::WebDriverError => e
815
- raise ::Appium::Core::Error::NoSuchElementError if e.message.include?('Cannot find any occurrences')
816
- raise ::Appium::Core::Error::CoreError, e.message
817
- end
818
- raise ::Appium::Core::Error::NoSuchElementError if element.nil?
819
-
820
- element
817
+ def find_element_by_image(png_img_path)
818
+ template = Base64.encode64 File.read png_img_path
819
+ find_element :image, template
821
820
  end
822
821
 
823
- # Return ImageElement if current view has partial images
822
+ # @since Appium 1.8.2
823
+ # Return elements if current view has a partial image. The logic depends on template matching by OpenCV.
824
+ # @see https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
825
+ # You can handle settings for the comparision following below.
826
+ # @see https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js#L6
824
827
  #
825
- # @param [[String]] png_img_paths Paths to a partial image you'd like to find
826
- # @param [Flood] match_threshold At what normalized threshold to reject
827
- # @param [Bool] visualize Makes the endpoint to return an image, which contains the visualized result of
828
- # the corresponding picture matching operation. This option is disabled by default.
828
+ # @param [String] png_img_path A path to a partial image you'd like to find
829
829
  #
830
- # @return [[::Appium::Core::ImageElement]]
831
- # @return [::Appium::Core::Error::CoreError]
830
+ # @return [::Selenium::WebDriver::Element]
832
831
  #
833
832
  # @example
834
833
  #
834
+ # @@driver.update_settings({ fixImageFindScreenshotDims: false, fixImageTemplateSize: true,
835
+ # autoUpdateImageElementPosition: true })
835
836
  # e = @@driver.find_elements_by_image ['./test/functional/data/test_element_image.png']
836
837
  # e == [] # if the `e` is empty
837
838
  #
838
- def find_elements_by_image(png_img_paths, match_threshold: DEFAULT_MATCH_THRESHOLD, visualize: false)
839
- full_image = @bridge.screenshot
840
-
841
- partial_images = png_img_paths.map do |png_img_path|
842
- Base64.encode64 File.read(png_img_path)
843
- end
844
-
845
- begin
846
- @bridge.find_elements_by_image(full_image: full_image,
847
- partial_images: partial_images,
848
- match_threshold: match_threshold,
849
- visualize: visualize)
850
- rescue Selenium::WebDriver::Error::TimeOutError
851
- []
852
- rescue ::Selenium::WebDriver::Error::WebDriverError => e
853
- return [] if e.message.include?('Cannot find any occurrences')
854
- raise ::Appium::Core::Error::CoreError, e.message
855
- end
839
+ def find_elements_by_image(png_img_path)
840
+ template = Base64.encode64 File.read png_img_path
841
+ find_elements :image, template
856
842
  end
857
843
  end # class Driver
858
844
  end # class Base
@@ -4,28 +4,85 @@ module Appium
4
4
  module SearchContext
5
5
  # referenced: ::Selenium::WebDriver::SearchContext
6
6
 
7
- FINDERS = ::Selenium::WebDriver::SearchContext::FINDERS.merge(accessibility_id: 'accessibility id')
8
-
9
- def self.add_finders(finders)
10
- FINDERS.merge!(finders)
11
- end
7
+ FINDERS = ::Selenium::WebDriver::SearchContext::FINDERS.merge(
8
+ accessibility_id: 'accessibility id',
9
+ image: '-image',
10
+ # Android
11
+ uiautomator: '-android uiautomator',
12
+ # iOS
13
+ uiautomation: '-ios uiautomation',
14
+ predicate: '-ios predicate string',
15
+ class_chain: '-ios class chain',
16
+ # Windows
17
+ windows_uiautomation: '-windows uiautomation',
18
+ # Tizen
19
+ tizen_uiautomation: '-tizen uiautomation'
20
+ )
12
21
 
13
22
  #
14
23
  # Find the first element matching the given arguments
15
24
  #
25
+ # Android can find with uiautomator like a [UISelector](http://developer.android.com/tools/help/uiautomator/UiSelector.html).
26
+ # iOS can find with a [UIAutomation command](https://developer.apple.com/library/ios/documentation/ToolsLanguages/Reference/UIAWindowClassReference/UIAWindow/UIAWindow.html#//apple_ref/doc/uid/TP40009930).
27
+ # iOS, only for XCUITest(WebDriverAgent), can find with a [class chain]( https://github.com/facebook/WebDriverAgent/wiki/Queries)
28
+ #
29
+ # Find with image.
30
+ # Return an element if current view has a partial image. The logic depends on template matching by OpenCV.
31
+ # @see https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
32
+ # You can handle settings for the comparision following below.
33
+ # @see https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js#L6
34
+ #
16
35
  # @overload find_element(how, what)
17
36
  # @param [Symbol, String] how The method to find the element by
18
37
  # @param [String] what The locator to use
38
+ #
19
39
  # @overload find_element(opts)
20
40
  # @param [Hash] opts Find options
21
41
  # @option opts [Symbol] :how Key named after the method to find the element by, containing the locator
22
42
  # @return [Element]
23
- #
24
43
  # @raise [Error::NoSuchElementError] if the element doesn't exist
25
44
  #
26
- # @example Find element with accessibility id
27
- # find_elements :accessibility_id, 'Animation'
28
- # find_elements :accessibility_id, 'Animation'
45
+ # @example Find element with each keys
46
+ #
47
+ # # with accessibility id. All platforms.
48
+ # find_elements :accessibility_id, 'Animation'
49
+ # find_elements :accessibility_id, 'Animation'
50
+ #
51
+ # # with base64 encoded template image. All platforms.
52
+ # find_elements :image, Base64.encode64(File.read(file_path))
53
+ #
54
+ # # For Android
55
+ # ## With uiautomator
56
+ # find_elements :uiautomator, 'new UiSelector().clickable(true)'
57
+ #
58
+ # # For iOS
59
+ # ## With :predicate
60
+ # find_elements :predicate, "isWDVisible == 1"
61
+ # find_elements :predicate, 'wdName == "Buttons"'
62
+ # find_elements :predicate, 'wdValue == "SearchBar" AND isWDDivisible == 1'
63
+ #
64
+ # ## With Class Chain
65
+ # ### select the third child button of the first child window element
66
+ # find_elements :class_chain, 'XCUIElementTypeWindow/XCUIElementTypeButton[3]'
67
+ # ### select all the children windows
68
+ # find_elements :class_chain, 'XCUIElementTypeWindow'
69
+ # ### select the second last child of the second child window
70
+ # find_elements :class_chain, 'XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]'
71
+ # ### matching predicate. <code>`</code> is the mark.
72
+ # find_elements :class_chain, 'XCUIElementTypeWindow[`visible = 1][`name = "bla"`]'
73
+ # ### containing predicate. `$` is the mark.
74
+ # ### Require appium-xcuitest-driver 2.54.0+. PR: https://github.com/facebook/WebDriverAgent/pull/707/files
75
+ # find_elements :class_chain, 'XCUIElementTypeWindow[$name = \"bla$$$bla\"$]'
76
+ # e = find_element :class_chain, "**/XCUIElementTypeWindow[$name == 'Buttons'$]"
77
+ # e.tag_name #=> "XCUIElementTypeWindow"
78
+ # e = find_element :class_chain, "**/XCUIElementTypeStaticText[$name == 'Buttons'$]"
79
+ # e.tag_name #=> "XCUIElementTypeStaticText"
80
+ #
81
+ # # For Windows
82
+ # find_elements :windows_uiautomation, '....'
83
+ #
84
+ # # For Tizen
85
+ # find_elements :tizen_uiautomation, '....'
29
86
  #
30
87
  def find_element(*args)
31
88
  how, what = extract_args(args)
@@ -55,8 +112,7 @@ module Appium
55
112
  private
56
113
 
57
114
  def _set_by_from_finders(how)
58
- finders = FINDERS
59
- by = finders[how.to_sym]
115
+ by = FINDERS[how.to_sym]
60
116
  raise ArgumentError, "cannot find element by #{how.inspect}" unless by
61
117
  by
62
118
  end
@@ -9,10 +9,6 @@ module Appium
9
9
  status: [:get, 'status'.freeze],
10
10
  is_element_displayed: [:get, 'session/:session_id/element/:id/displayed'.freeze],
11
11
 
12
- # FIXME: remove after apply https://github.com/SeleniumHQ/selenium/pull/5249
13
- # The fix will be included in selenium-3.8.2
14
- get_page_source: [:get, 'session/:session_id/source'.freeze],
15
-
16
12
  get_timeouts: [:get, 'session/:session_id/timeouts'.freeze],
17
13
 
18
14
  ## Add OSS commands to W3C commands. We can remove them if we would like to remove them from W3C module.
@@ -33,6 +29,8 @@ module Appium
33
29
  ime_deactivate: [:post, 'session/:session_id/ime/deactivate'.freeze],
34
30
  ime_activate_engine: [:post, 'session/:session_id/ime/activate'.freeze],
35
31
 
32
+ send_keys_to_active_element: [:post, 'session/:session_id/keys'.freeze],
33
+
36
34
  ### Logs
37
35
  get_available_log_types: [:get, 'session/:session_id/log/types'.freeze],
38
36
  get_log: [:post, 'session/:session_id/log'.freeze]
@@ -1,7 +1,3 @@
1
- require_relative 'element/image'
2
-
3
- require 'base64'
4
-
5
1
  module Appium
6
2
  module Core
7
3
  module Device
@@ -1,5 +1,4 @@
1
1
  # loaded in common/driver.rb
2
- require_relative 'ios/search_context'
3
2
  require_relative 'ios/device'
4
3
 
5
4
  require_relative 'ios/uiautomation/patch'
@@ -4,7 +4,6 @@ module Appium
4
4
  module Uiautomation
5
5
  module Bridge
6
6
  def self.for(target)
7
- Core::Ios::SearchContext.extend
8
7
  target.extend Appium::Core::Ios::Device
9
8
 
10
9
  Core::Ios::Uiautomation.patch_webdriver_element
@@ -4,8 +4,6 @@ module Appium
4
4
  module Xcuitest
5
5
  module Bridge
6
6
  def self.for(target)
7
- Core::Ios::SearchContext.extend
8
- Core::Ios::Xcuitest::SearchContext.extend
9
7
  target.extend Appium::Core::Ios::Device
10
8
  target.extend Appium::Core::Ios::Xcuitest::Device
11
9
  end
@@ -1,7 +1,5 @@
1
1
  # loaded in common/driver.rb
2
- require_relative 'ios/search_context'
3
2
  require_relative 'ios/device'
4
3
 
5
- require_relative 'ios/xcuitest/search_context'
6
4
  require_relative 'ios/xcuitest/device'
7
5
  require_relative 'ios/xcuitest/bridge'
@@ -1,6 +1,6 @@
1
1
  module Appium
2
2
  module Core
3
- VERSION = '1.8.4'.freeze unless defined? ::Appium::Core::VERSION
4
- DATE = '2018-07-28'.freeze unless defined? ::Appium::Core::DATE
3
+ VERSION = '1.9.0'.freeze unless defined? ::Appium::Core::VERSION
4
+ DATE = '2018-08-05'.freeze unless defined? ::Appium::Core::DATE
5
5
  end
6
6
  end
data/release_notes.md CHANGED
@@ -1,3 +1,13 @@
1
+ #### v1.9.0 2018-08-05
2
+
3
+ - [cc9e378](https://github.com/appium/ruby_lib_core/commit/cc9e378eba22eb448feec764d6227aff1647aaba) Release 1.9.0
4
+ - [7b44bf7](https://github.com/appium/ruby_lib_core/commit/7b44bf70bba97532daabb9b496bbe36618d77593) use default_move_duration (#115)
5
+ - [590e798](https://github.com/appium/ruby_lib_core/commit/590e7981f924524ba40b9d918b41af22cf14cc59) Add image strategy (#119)
6
+ - [24d2a62](https://github.com/appium/ruby_lib_core/commit/24d2a6265bc351e6e2ca3d410c597ad9b744c072) port send keys for an active element (#122)
7
+ - [283059f](https://github.com/appium/ruby_lib_core/commit/283059f971b4a4aeda707de0542c3991accac128) update (#121)
8
+ - [c188829](https://github.com/appium/ruby_lib_core/commit/c1888292bb28fead792824d8bb7b3a0df94ee891) gather search contexts (#118)
9
+
10
+
1
11
  #### v1.8.4 2018-07-28
2
12
 
3
13
  - [1775354](https://github.com/appium/ruby_lib_core/commit/1775354f201658243737a0a455fe4123ce2e87a7) Release 1.8.4
metadata CHANGED
@@ -1,23 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4
4
+ version: 1.9.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: 2018-07-28 00:00:00.000000000 Z
11
+ date: 2018-08-05 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
17
  - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '3.5'
20
- - - "<"
21
18
  - !ruby/object:Gem::Version
22
19
  version: '3.14'
23
20
  type: :runtime
@@ -25,9 +22,6 @@ dependencies:
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '3.5'
30
- - - "<"
31
25
  - !ruby/object:Gem::Version
32
26
  version: '3.14'
33
27
  - !ruby/object:Gem::Dependency
@@ -235,7 +229,6 @@ files:
235
229
  - lib/appium_lib_core/android/device/performance.rb
236
230
  - lib/appium_lib_core/android/device/screen.rb
237
231
  - lib/appium_lib_core/android/espresso/bridge.rb
238
- - lib/appium_lib_core/android/search_context.rb
239
232
  - lib/appium_lib_core/android/uiautomator1/bridge.rb
240
233
  - lib/appium_lib_core/android/uiautomator2/bridge.rb
241
234
  - lib/appium_lib_core/android/uiautomator2/device.rb
@@ -283,11 +276,9 @@ files:
283
276
  - lib/appium_lib_core/common/ws/websocket.rb
284
277
  - lib/appium_lib_core/device.rb
285
278
  - lib/appium_lib_core/driver.rb
286
- - lib/appium_lib_core/element/image.rb
287
279
  - lib/appium_lib_core/ios.rb
288
280
  - lib/appium_lib_core/ios/device.rb
289
281
  - lib/appium_lib_core/ios/device/clipboard.rb
290
- - lib/appium_lib_core/ios/search_context.rb
291
282
  - lib/appium_lib_core/ios/uiautomation/bridge.rb
292
283
  - lib/appium_lib_core/ios/uiautomation/patch.rb
293
284
  - lib/appium_lib_core/ios/xcuitest/bridge.rb
@@ -295,7 +286,6 @@ files:
295
286
  - lib/appium_lib_core/ios/xcuitest/device/battery.rb
296
287
  - lib/appium_lib_core/ios/xcuitest/device/performance.rb
297
288
  - lib/appium_lib_core/ios/xcuitest/device/screen.rb
298
- - lib/appium_lib_core/ios/xcuitest/search_context.rb
299
289
  - lib/appium_lib_core/ios_xcuitest.rb
300
290
  - lib/appium_lib_core/patch.rb
301
291
  - lib/appium_lib_core/version.rb
@@ -1,18 +0,0 @@
1
- module Appium
2
- module Core
3
- module Android
4
- module SearchContext
5
- # @!method uiautomator_find
6
- # find_element/s can be used with a [UISelector](http://developer.android.com/tools/help/uiautomator/UiSelector.html).
7
- #
8
- # @example
9
- #
10
- # @driver.find_elements :uiautomator, 'new UiSelector().clickable(true)'
11
- #
12
- def self.extend
13
- ::Appium::Core::Base::SearchContext.add_finders(uiautomator: '-android uiautomator')
14
- end
15
- end # class << self
16
- end # module Ios
17
- end # module Core
18
- end # module Appium
@@ -1,106 +0,0 @@
1
- module Appium
2
- module Core
3
- #
4
- # ImageElement is an element for images by `find_element/s_by_image`
5
- # Experimental feature
6
- #
7
- class ImageElement
8
- Point = Struct.new(:x, :y)
9
- Dimension = Struct.new(:width, :height)
10
- Rectangle = Struct.new(:x, :y, :width, :height)
11
-
12
- # Base64ed format
13
- # @example
14
- #
15
- # File.write 'result.png', Base64.decode64(e.visual)
16
- #
17
- attr_reader :visual
18
-
19
- def initialize(bridge, x, y, width, height, visual = nil)
20
- @bridge = bridge
21
- @visual = visual
22
-
23
- @center_x = x + width / 2
24
- @center_y = y + height / 2
25
- @x = x
26
- @y = y
27
- @width = width
28
- @height = height
29
- end
30
-
31
- #
32
- # Click this element.
33
- #
34
- # @example
35
- #
36
- # e = @@driver.find_element_by_image './test/functional/data/test_element_image.png'
37
- # e.click
38
- #
39
- def click
40
- @bridge.action.move_to_location(@center_x, @center_y).click.perform
41
- end
42
-
43
- #
44
- # Get the location of this element.
45
- #
46
- # @return [Point]
47
- #
48
- # @example
49
- #
50
- # e = @@driver.find_element_by_image './test/functional/data/test_element_image.png'
51
- # assert_equal [39, 1014], [e.location.x, e.location.y]
52
- #
53
- def location
54
- Point.new @x, @y
55
- end
56
-
57
- #
58
- # Get the size of this element
59
- #
60
- # @return [Dimension]
61
- #
62
- # @example
63
- #
64
- # e = @@driver.find_element_by_image './test/functional/data/test_element_image.png'
65
- # assert_equal [326, 62], [e.size.width, e.size.height]
66
- #
67
- def size
68
- Dimension.new @width, @height
69
- end
70
-
71
- #
72
- # Get the dimensions and coordinates of this element.
73
- #
74
- # @return [Rectangle]
75
- #
76
- # @example
77
- #
78
- # e = @@driver.find_element_by_image './test/functional/data/test_element_image.png'
79
- # assert_equal([39, 1014, 326, 62], [e.rect.x, e.rect.y, e.rect.width, e.rect.height])
80
- #
81
- def rect
82
- Rectangle.new @x, @y, @width, @height
83
- end
84
-
85
- def displayed?
86
- true
87
- end
88
-
89
- #-------------------------------- sugar --------------------------------
90
-
91
- def first(full_image:, partial_image:, match_threshold: nil, visualize: false)
92
- @bridge.find_element_by_image(full_image: full_image,
93
- partial_image: partial_image,
94
- match_threshold: match_threshold,
95
- visualize: visualize)
96
- end
97
-
98
- def all(full_image:, partial_image:, match_threshold: nil, visualize: false)
99
- @bridge.find_elements_by_image(full_image: full_image,
100
- partial_image: partial_image,
101
- match_threshold: match_threshold,
102
- visualize: visualize)
103
- end
104
- end
105
- end
106
- end
@@ -1,27 +0,0 @@
1
- module Appium
2
- module Core
3
- module Ios
4
- module SearchContext
5
- # @!method uiautomation_find
6
- # find_element/s can be used with a [UIAutomation command](https://developer.apple.com/library/ios/documentation/ToolsLanguages/Reference/UIAWindowClassReference/UIAWindow/UIAWindow.html#//apple_ref/doc/uid/TP40009930).
7
- #
8
- # @example
9
- # find_elements :uiautomation, 'elements()
10
- #
11
- #
12
- # @!method ios_predicate_string_find
13
- # find_element/s can be used with a [Predicates](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/AdditionalChapters/Introduction.html)
14
- #
15
- # @example
16
- # find_elements :predicate, "isWDVisible == 1"
17
- # find_elements :predicate, 'wdName == "Buttons"'
18
- # find_elements :predicate, 'wdValue == "SearchBar" AND isWDDivisible == 1'
19
- #
20
- def self.extend
21
- ::Appium::Core::Base::SearchContext.add_finders(uiautomation: '-ios uiautomation')
22
- ::Appium::Core::Base::SearchContext.add_finders(predicate: '-ios predicate string')
23
- end
24
- end # class << self
25
- end # module Ios
26
- end # module Core
27
- end # module Appium
@@ -1,40 +0,0 @@
1
- module Appium
2
- module Core
3
- module Ios
4
- module Xcuitest
5
- module SearchContext
6
- # @!method ios_class_chain_find
7
- # Only for XCUITest(WebDriverAgent)
8
- # find_element/s can be used with a [class chain]( https://github.com/facebook/WebDriverAgent/wiki/Queries)
9
- #
10
- # @example
11
- #
12
- # # select the third child button of the first child window element
13
- # find_elements :class_chain, 'XCUIElementTypeWindow/XCUIElementTypeButton[3]'
14
- #
15
- # # select all the children windows
16
- # find_elements :class_chain, 'XCUIElementTypeWindow'
17
- #
18
- # # select the second last child of the second child window
19
- # find_elements :class_chain, 'XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]'
20
- #
21
- # # matching predicate. <code>`</code> is the mark.
22
- # find_elements :class_chain, 'XCUIElementTypeWindow[`visible = 1][`name = "bla"`]'
23
- #
24
- # # containing predicate. `$` is the mark.
25
- # # Require appium-xcuitest-driver 2.54.0+
26
- # # PR: https://github.com/facebook/WebDriverAgent/pull/707/files
27
- # find_elements :class_chain, 'XCUIElementTypeWindow[$name = \"bla$$$bla\"$]'
28
- # e = find_element :class_chain, "**/XCUIElementTypeWindow[$name == 'Buttons'$]"
29
- # e.tag_name #=> "XCUIElementTypeWindow"
30
- # e = find_element :class_chain, "**/XCUIElementTypeStaticText[$name == 'Buttons'$]"
31
- # e.tag_name #=> "XCUIElementTypeStaticText"
32
- #
33
- def self.extend
34
- ::Appium::Core::Base::SearchContext.add_finders(class_chain: '-ios class chain')
35
- end
36
- end
37
- end # class << self
38
- end # module Ios
39
- end # module Core
40
- end # module Appium