appium_lib_core 3.11.1 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/unittest.yml +2 -2
  3. data/.rubocop.yml +20 -10
  4. data/CHANGELOG.md +27 -268
  5. data/README.md +1 -1
  6. data/appium_lib_core.gemspec +3 -3
  7. data/ci-jobs/functional/ios_setup.yml +2 -0
  8. data/ci-jobs/functional/run_appium.yml +1 -1
  9. data/ci-jobs/functional_test.yml +2 -2
  10. data/lib/appium_lib_core.rb +5 -5
  11. data/lib/appium_lib_core/android/device.rb +5 -5
  12. data/lib/appium_lib_core/common/base.rb +1 -0
  13. data/lib/appium_lib_core/common/base/bridge.rb +10 -36
  14. data/lib/appium_lib_core/common/base/bridge/w3c.rb +1 -0
  15. data/lib/appium_lib_core/common/base/driver.rb +6 -4
  16. data/lib/appium_lib_core/common/base/http_default.rb +2 -1
  17. data/lib/appium_lib_core/common/base/rotable.rb +54 -0
  18. data/lib/appium_lib_core/common/base/screenshot.rb +1 -1
  19. data/lib/appium_lib_core/common/base/search_context.rb +2 -4
  20. data/lib/appium_lib_core/common/command/common.rb +0 -2
  21. data/lib/appium_lib_core/common/command/mjsonwp.rb +0 -2
  22. data/lib/appium_lib_core/common/command/w3c.rb +0 -2
  23. data/lib/appium_lib_core/common/device/app_management.rb +1 -1
  24. data/lib/appium_lib_core/common/device/orientation.rb +31 -0
  25. data/lib/appium_lib_core/common/touch_action/multi_touch.rb +2 -2
  26. data/lib/appium_lib_core/common/touch_action/touch_actions.rb +3 -3
  27. data/lib/appium_lib_core/common/wait.rb +2 -2
  28. data/lib/appium_lib_core/driver.rb +2 -0
  29. data/lib/appium_lib_core/ios/xcuitest/device.rb +2 -2
  30. data/lib/appium_lib_core/patch.rb +53 -0
  31. data/lib/appium_lib_core/version.rb +2 -2
  32. data/lib/appium_lib_core/windows/device.rb +2 -2
  33. data/release_notes.md +42 -0
  34. data/script/commands.rb +3 -3
  35. metadata +9 -7
@@ -53,7 +53,7 @@ module Appium
53
53
  return yield(object)
54
54
  rescue ::Errno::ECONNREFUSED => e
55
55
  raise e
56
- rescue *ignored => last_error # rubocop:disable Lint/HandleExceptions
56
+ rescue *ignored => last_error
57
57
  # swallowed
58
58
  end
59
59
  sleep interval
@@ -98,7 +98,7 @@ module Appium
98
98
  return result if result
99
99
  rescue ::Errno::ECONNREFUSED => e
100
100
  raise e
101
- rescue *ignored => last_error # rubocop:disable Lint/HandleExceptions
101
+ rescue *ignored => last_error
102
102
  # swallowed
103
103
  end
104
104
  sleep interval
@@ -525,6 +525,8 @@ module Appium
525
525
  ::Appium::Logger.debug('SafariDriver for macOS')
526
526
  when :gecko
527
527
  ::Appium::Logger.debug('Gecko Driver for macOS')
528
+ when :mac2
529
+ ::Appium::Logger.debug('macOS XCUITest')
528
530
  else
529
531
  # no Mac specific extentions
530
532
  ::Appium::Logger.debug('macOS Native')
@@ -23,7 +23,7 @@ module Appium
23
23
  module Device
24
24
  extend Forwardable
25
25
 
26
- # rubocop:disable Metrics/LineLength
26
+ # rubocop:disable Layout/LineLength
27
27
 
28
28
  # @!method hide_keyboard(close_key = nil, strategy = nil)
29
29
  # Hide the onscreen keyboard
@@ -171,7 +171,7 @@ module Appium
171
171
  # @driver.battery_info #=> { state: :full, level: 0.7 }
172
172
  #
173
173
 
174
- # rubocop:enable Metrics/LineLength
174
+ # rubocop:enable Layout/LineLength
175
175
 
176
176
  ####
177
177
  ## class << self
@@ -21,6 +21,9 @@ module Appium
21
21
  # To extend Appium related SearchContext into ::Selenium::WebDriver::Element
22
22
  include ::Appium::Core::Base::SearchContext
23
23
 
24
+ # TODO: Probably can remove own TakesScreenshot since Selenium 4
25
+ include ::Appium::Core::Base::TakesScreenshot
26
+
24
27
  # Returns the value of attributes like below. Read each platform to know more details.
25
28
  #
26
29
  # uiautomator2: https://github.com/appium/appium-uiautomator2-server/blob/203cc7e57ce477f3cff5d95b135d1b3450a6033a/app/src/main/java/io/appium/uiautomator2/utils/Attribute.java#L19
@@ -99,6 +102,56 @@ module Appium
99
102
  w = driver.window_size
100
103
  ::Selenium::WebDriver::Point.new "#{center_x} / #{w.width.to_f}", "#{center_y} / #{w.height.to_f}"
101
104
  end
105
+
106
+ # Return an element screenshot as base64
107
+ #
108
+ # @return String Base 64 encoded string
109
+ #
110
+ # @example
111
+ #
112
+ # element.screenshot #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
113
+ #
114
+ def screenshot
115
+ bridge.take_element_screenshot(self)
116
+ end
117
+
118
+ # Return an element screenshot in the given format
119
+ #
120
+ # @param [:base64, :png] format
121
+ # @return String screenshot
122
+ #
123
+ # @example
124
+ #
125
+ # element.screenshot_as :base64 #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
126
+ #
127
+ def screenshot_as(format)
128
+ case format
129
+ when :base64
130
+ bridge.take_element_screenshot(self)
131
+ when :png
132
+ bridge.take_element_screenshot(self).unpack('m')[0]
133
+ else
134
+ raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
135
+ end
136
+ end
137
+
138
+ # Save an element screenshot to the given path
139
+ #
140
+ # @param [String] png_path A path to save the screenshot
141
+ # @return [File] Path to the element screenshot.
142
+ #
143
+ # @example
144
+ #
145
+ # element.save_screenshot("fine_name.png")
146
+ #
147
+ def save_screenshot(png_path)
148
+ extension = File.extname(png_path).downcase
149
+ if extension != '.png'
150
+ ::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
151
+ 'It should end with .png extension'
152
+ end
153
+ File.open(png_path, 'wb') { |f| f << screenshot_as(:png) }
154
+ end
102
155
  end
103
156
  end # module Core
104
157
  end # module Appium
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '3.11.1' unless defined? ::Appium::Core::VERSION
18
- DATE = '2020-11-20' unless defined? ::Appium::Core::DATE
17
+ VERSION = '4.2.1' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-01-10' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -20,7 +20,7 @@ module Appium
20
20
  module Device
21
21
  extend Forwardable
22
22
 
23
- # rubocop:disable Metrics/LineLength
23
+ # rubocop:disable Layout/LineLength
24
24
 
25
25
  # @since Appium 1.18.0
26
26
  # @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil, time_limit: nil, fps: nil, preset: nil, video_filter: nil, capture_clicks: nil, capture_cursor: nil, audio_input: nil)
@@ -69,7 +69,7 @@ module Appium
69
69
  # @driver.start_recording_screen capture_cursor: true, capture_clicks: true, time_limit: '260'
70
70
  #
71
71
 
72
- # rubocop:enable Metrics/LineLength
72
+ # rubocop:enable Layout/LineLength
73
73
 
74
74
  ####
75
75
  ## class << self
@@ -1,3 +1,45 @@
1
+ #### v4.2.1 2021-01-10
2
+
3
+ - [23e944e](https://github.com/appium/ruby_lib_core/commit/23e944ed72c6ea861532f5acc1381af4441705e6) Release 4.2.1
4
+ - [1a416b1](https://github.com/appium/ruby_lib_core/commit/1a416b136beb2b9115d3eb6637b22817f0e55601) chore: move rotable for w3c (#300)
5
+ - [95821c6](https://github.com/appium/ruby_lib_core/commit/95821c6f1a4ebc785e2dc3e6e16c1705521237e8) ci: bump android app (#299)
6
+ - [4e1770e](https://github.com/appium/ruby_lib_core/commit/4e1770e3b9d6995b1d5430b9033097609edca1c8) chore(deps-dev): update rubocop requirement from = 1.7.0 to = 1.8.0 (#298)
7
+ - [b230512](https://github.com/appium/ruby_lib_core/commit/b230512c52875ea70545d3d2262c306640f87f7d) chore: fix rubocop
8
+
9
+
10
+ #### v4.2.0 2021-01-02
11
+
12
+ - [e55b2b6](https://github.com/appium/ruby_lib_core/commit/e55b2b6f7fe293091be0d3835075e66c74f3b9dd) Release 4.2.0
13
+ - [b0cd235](https://github.com/appium/ruby_lib_core/commit/b0cd235a7fb6e5a8957871650bf86962cf0e0368) feat: append screenshot in element module as well (#297)
14
+
15
+
16
+ #### v4.1.1 2020-12-25
17
+
18
+ - [3a4cf56](https://github.com/appium/ruby_lib_core/commit/3a4cf56c73a64fb10ca0b7fecc5800719838095c) Release 4.1.1
19
+ - [6b2d7dd](https://github.com/appium/ruby_lib_core/commit/6b2d7ddf027b5a9f49cbe9a7f5622eb345e2c076) fix: keyword argument in Ruby 3
20
+
21
+
22
+ #### v4.1.0 2020-12-25
23
+
24
+ - [89110a9](https://github.com/appium/ruby_lib_core/commit/89110a995b869471a134f8c45ebe8dfbaabfba63) Release 4.1.0
25
+ - [c833315](https://github.com/appium/ruby_lib_core/commit/c83331560738c0a656509516fc5f610855d5dfed) chore(deps-dev): update rubocop requirement from = 1.6.1 to = 1.7.0 (#294)
26
+ - [83d57aa](https://github.com/appium/ruby_lib_core/commit/83d57aa3ad7fd100c081ecc21ab0d5c5d40bf95f) feat: support Ruby 3 (#295)
27
+ - [e13c58f](https://github.com/appium/ruby_lib_core/commit/e13c58fe4355dcb2631f0a42248d991165f428f7) feat: bump rubocop (#293)
28
+
29
+
30
+ #### v4.0.0 2020-12-19
31
+
32
+ - [66e2306](https://github.com/appium/ruby_lib_core/commit/66e23069722d5ccd9ca10f5a1bdf2733cb249a2c) Release 4.0.0
33
+ - [4ba9098](https://github.com/appium/ruby_lib_core/commit/4ba9098188b51d3534e35b0fae9340de7100f516) feat: drop forcemjsonwp (#291)
34
+ - [5df301c](https://github.com/appium/ruby_lib_core/commit/5df301cb559eed1431cc790655dc89c22be54eb9) chore(deps-dev): update webmock requirement from ~> 3.10.0 to ~> 3.11.0 (#290)
35
+ - [76c0ff7](https://github.com/appium/ruby_lib_core/commit/76c0ff7fa540261c5793cde1f79dc14bf752fd35) feat: bump supported ruby version (#289)
36
+ - [ea5dd00](https://github.com/appium/ruby_lib_core/commit/ea5dd0008a56821750a5b256b912f252dd46b78d) test: add a few steps
37
+ - [9c56f30](https://github.com/appium/ruby_lib_core/commit/9c56f302d46b2ea5d970c79536260720a6bd25ec) docs: add full module path in example
38
+ - [f88ae2c](https://github.com/appium/ruby_lib_core/commit/f88ae2c0d6e02d40089298e8bf5ec19b2af012cd) chore: Add mac2 sample and log (#288)
39
+ - [39e4611](https://github.com/appium/ruby_lib_core/commit/39e4611adac83dee85c21893fc1f904bf828f21e) ci: bump iOS versions (#287)
40
+ - [d76ebdd](https://github.com/appium/ruby_lib_core/commit/d76ebddf0d0f664e49a616a1f94425eba887245e) docs: update badge
41
+
42
+
1
43
  #### v3.11.1 2020-11-20
2
44
 
3
45
  - [4fe582c](https://github.com/appium/ruby_lib_core/commit/4fe582c1318c2b5de83fcf87e36d1fedab8ed81a) Release 3.11.1
@@ -17,9 +17,9 @@ require './lib/appium_lib_core'
17
17
 
18
18
  module Script
19
19
  class CommandsChecker
20
- attr_reader :spec_commands
21
- attr_reader :implemented_mjsonwp_commands, :implemented_w3c_commands, :implemented_core_commands
22
- attr_reader :webdriver_oss_commands, :webdriver_w3c_commands
20
+ attr_reader :spec_commands,
21
+ :implemented_mjsonwp_commands, :implemented_w3c_commands, :implemented_core_commands,
22
+ :webdriver_oss_commands, :webdriver_w3c_commands
23
23
 
24
24
  # Set commands implemented in this core library.
25
25
  #
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.11.1
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-21 00:00:00.000000000 Z
11
+ date: 2021-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -120,28 +120,28 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: 3.10.0
123
+ version: 3.11.0
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: 3.10.0
130
+ version: 3.11.0
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: rubocop
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - '='
136
136
  - !ruby/object:Gem::Version
137
- version: 0.68.1
137
+ version: 1.8.0
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - '='
143
143
  - !ruby/object:Gem::Version
144
- version: 0.68.1
144
+ version: 1.8.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: appium_thor
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -268,6 +268,7 @@ files:
268
268
  - lib/appium_lib_core/common/base/driver.rb
269
269
  - lib/appium_lib_core/common/base/http_default.rb
270
270
  - lib/appium_lib_core/common/base/platform.rb
271
+ - lib/appium_lib_core/common/base/rotable.rb
271
272
  - lib/appium_lib_core/common/base/screenshot.rb
272
273
  - lib/appium_lib_core/common/base/search_context.rb
273
274
  - lib/appium_lib_core/common/command.rb
@@ -287,6 +288,7 @@ files:
287
288
  - lib/appium_lib_core/common/device/ime_actions.rb
288
289
  - lib/appium_lib_core/common/device/keyboard.rb
289
290
  - lib/appium_lib_core/common/device/keyevent.rb
291
+ - lib/appium_lib_core/common/device/orientation.rb
290
292
  - lib/appium_lib_core/common/device/screen_record.rb
291
293
  - lib/appium_lib_core/common/device/setting.rb
292
294
  - lib/appium_lib_core/common/device/touch_actions.rb
@@ -333,7 +335,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
333
335
  requirements:
334
336
  - - ">="
335
337
  - !ruby/object:Gem::Version
336
- version: '2.2'
338
+ version: '2.4'
337
339
  required_rubygems_version: !ruby/object:Gem::Requirement
338
340
  requirements:
339
341
  - - ">="