appium_lib_core 1.3.3 → 1.3.4

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: 5508c27e048a97c7cada6eaadf5508571ecc3922
4
- data.tar.gz: 1f11cc39e8b4ae69da7d148b7c412d3c6b82ee1e
3
+ metadata.gz: aaa0d993203afcfa428e6e478416365588854f88
4
+ data.tar.gz: f087a75d818f5b888d09d606d1f60660caee5ca4
5
5
  SHA512:
6
- metadata.gz: 6959fb85dff564a612fc218e64abfdc13bfa625f13fb1a20d0cc41cff7d74b4e60eb334cd81e2ddbc87e7fca8db8461bd319c348d51f7623a143695e00abc434
7
- data.tar.gz: b2237a2d4d6b017cbe4d1ea5f9fd9e8b5fcfecfe5634878364b1db8e31f1544cfd3f6d2e1400c136cbb807db809d53b19bef6a92c49691da168d35b77f3dbcbd
6
+ metadata.gz: 59d58196a9e24a24d51636f1c744ca75317b9101971602efc8f5a5d21dcd9111d5f20a85da93e9c04c0edb514217888b532709a0445e7fb5e6d1e2313626c892
7
+ data.tar.gz: 5f3d0e30943a11ea5df3258a8b68680f9571717c89f9d595a6ea82bd4b2555057112afaf372ff81785892558c7b29373c501049b5564600b4b55bd4af1991004
data/CHANGELOG.md CHANGED
@@ -8,6 +8,17 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  ### Deprecations
10
10
 
11
+ ## [1.3.4] - 2018-03-21
12
+ ### Enhancements
13
+ - Add `save_viewport_screenshot` which get screenshot except for status bar.
14
+ - https://github.com/search?q=org%3Aappium+viewportScreenshot&type=Code
15
+ - [iOS] Add `start_performance_record` and `get_performance_record`
16
+
17
+ ### Bug fixes
18
+ - Fix _create_session attempt to throw non-existent error type Appium::Core::Error::WebDriverError_ [#66](https://github.com/appium/ruby_lib_core/issues/66)
19
+
20
+ ### Deprecations
21
+
11
22
  ## [1.3.3] - 2018-03-03
12
23
  ### Enhancements
13
24
  - add `session_capabilities`: https://appium.io/docs/en/commands/session/get/
data/Rakefile CHANGED
@@ -51,7 +51,7 @@ end
51
51
 
52
52
  desc('Generate yardoc')
53
53
  YARD::Rake::YardocTask.new do |t|
54
- t.files = ['lib/**/*.rb']
54
+ t.files = %w(lib/**/*.rb)
55
55
  end
56
56
 
57
57
  desc('Execute RuboCop static code analysis')
@@ -22,7 +22,7 @@ module Appium
22
22
 
23
23
  if desired_capabilities.is_a?(Symbol)
24
24
  unless ::Selenium::WebDriver::Remote::Capabilities.respond_to?(desired_capabilities)
25
- raise Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
25
+ raise ::Selenium::WebDriver::Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
26
26
  end
27
27
  desired_capabilities = Remote::Capabilities.__send__(desired_capabilities)
28
28
  end
@@ -105,7 +105,7 @@ module Appium
105
105
  end
106
106
 
107
107
  unless @session_id
108
- raise Error::WebDriverError, 'no sessionId in returned payload'
108
+ raise ::Selenium::WebDriver::Error::WebDriverError, 'no sessionId in returned payload'
109
109
  end
110
110
 
111
111
  json_create(oss_status, value)
@@ -369,6 +369,15 @@ module Appium
369
369
  # @driver.pull_folder '/data/local/tmp' #=> Get the folder at that path
370
370
  #
371
371
 
372
+ # @since 1.3.4
373
+ # @!method save_viewport_screenshot
374
+ # Save screenshot except for status bar while `@driver.save_screenshot` save entire screen.
375
+ #
376
+ # @example
377
+ #
378
+ # @driver.save_viewport_screenshot 'path/to/save.png' #=> Get the File instance of viewport_screenshot
379
+ #
380
+
372
381
  # @!method update_settings(settings)
373
382
  # Update Appium Settings for current test session
374
383
  # @param [Hash] settings Settings to update, keys are settings, values to value to set each setting to
@@ -630,6 +639,18 @@ module Appium
630
639
  end
631
640
  end
632
641
 
642
+ add_endpoint_method(:save_viewport_screenshot) do
643
+ def save_viewport_screenshot(png_path)
644
+ extension = File.extname(png_path).downcase
645
+ if extension != '.png'
646
+ WebDriver.logger.warn 'name used for saved screenshot does not match file type. '\
647
+ 'It should end with .png extension'
648
+ end
649
+ viewport_screenshot_encode64 = execute_script('mobile: viewportScreenshot')
650
+ File.open(png_path, 'wb') { |f| f << viewport_screenshot_encode64.unpack('m')[0] }
651
+ end
652
+ end
653
+
633
654
  add_keyevent
634
655
  add_touch_actions
635
656
  add_ime_actions
@@ -190,14 +190,14 @@ module Appium
190
190
  # Ignore setting default wait if the target driver has no implementation
191
191
  def set_implicit_wait_by_default(wait)
192
192
  @driver.manage.timeouts.implicit_wait = wait
193
- rescue Selenium::WebDriver::Error::UnknownError => e
193
+ rescue ::Selenium::WebDriver::Error::UnknownError => e
194
194
  unless e.message.include?('The operation requested is not yet implemented')
195
195
  raise e.message, ::Appium::Core::Error::ServerError
196
196
  end
197
197
 
198
198
  Appium::Logger.debug(e.message)
199
199
  {}
200
- rescue Selenium::WebDriver::Error::WebDriverError => e
200
+ rescue ::Selenium::WebDriver::Error::WebDriverError => e
201
201
  # FIXME: Temporary rescue until Appium support W3C's implicit wait
202
202
  # https://github.com/jlipps/simple-wd-spec#set-timeouts
203
203
  unless e.message.include?('Parameters were incorrect. We wanted {"required":["type","ms"]} and you sent ["implicit"]')
@@ -59,6 +59,56 @@ module Appium
59
59
  # @driver.start_recording_screen video_type: 'h264', time_limit: '260'
60
60
  #
61
61
 
62
+ # @since 1.3.4
63
+ # @!method start_performance_record(timeout: 300000, profile_name: 'Activity Monitor')
64
+ #
65
+ # This is a blocking application.
66
+ # @param [Integer|String] timeout: The maximum count of milliseconds to record the profiling information.
67
+ # @param [String] profile_name: The name of existing performance profile to apply.
68
+ # Execute `instruments -s` to show the list of available profiles.
69
+ # Note, that not all profiles are supported on mobile devices.
70
+ # @param [Integer|String] pid: The ID of the process to measure the performance for.
71
+ # Set it to `current` in order to measure the performance of
72
+ # the process, which belongs to the currently active application.
73
+ # All processes running on the device are measured if
74
+ # pid is unset (the default setting). Setting process ID while
75
+ # device under test is Simulator might require `instruments` to be launched
76
+ # with sudo privileges, which is not supported and will throw a timeout exception.
77
+ # @return nil
78
+ #
79
+ # @example
80
+ #
81
+ # @driver.start_performance_record # default: (timeout: 300000, profile_name: 'Activity Monitor')
82
+ # @driver.start_performance_record(timeout: 300000, profile_name: 'Activity Monitor')
83
+ #
84
+
85
+ # @since 1.3.4
86
+ # @!method get_performance_record(save_file_path: './performance', profile_name: 'Activity Monitor', remote_path: nil, user: nil, pass: nil, method: 'PUT')
87
+ #
88
+ # This is a blocking application.
89
+ #
90
+ # @param [String] save_file_path: A path to save data as zipped .trace file
91
+ # @param [String] profile_name: The name of existing performance profile to apply.
92
+ # Execute `instruments -s` to show the list of available profiles.
93
+ # Note, that not all profiles are supported on mobile devices.
94
+ # @param [String] save_file_path: The name of existing performance profile to apply.
95
+ # Execute `instruments -s` to show the list of available profiles.
96
+ # Note, that not all profiles are supported on mobile devices.
97
+ # @param [String] remote_path: The path to the remote location, where the resulting zipped .trace file should be uploaded.
98
+ # The following protocols are supported: http/https, ftp.
99
+ # Null or empty string value (the default setting) means the content of resulting
100
+ # file should be zipped, encoded as Base64 and passed as the endpount response value.
101
+ # An exception will be thrown if the generated file is too big to
102
+ # fit into the available process memory.
103
+ # @param [String] user: The name of the user for the remote authentication. Only works if `remotePath` is provided.
104
+ # @param [String] pass: The password for the remote authentication. Only works if `remotePath` is provided.
105
+ # @param [String] method: The http multipart upload method name. Only works if `remotePath` is provided.
106
+ #
107
+ # @example
108
+ #
109
+ # @driver.get_performance_record
110
+ # @driver.get_performance_record(save_file_path: './performance', profile_name: 'Activity Monitor')
111
+
62
112
  # rubocop:enable Metrics/LineLength
63
113
 
64
114
  ####
@@ -91,11 +141,41 @@ module Appium
91
141
  end
92
142
  end
93
143
 
144
+ add_performance
94
145
  add_screen_recording
95
146
  end
96
147
 
97
148
  private
98
149
 
150
+ def add_performance
151
+ Appium::Core::Device.add_endpoint_method(:start_performance_record) do
152
+ def start_performance_record(timeout: 300_000, profile_name: 'Activity Monitor', pid: nil)
153
+ option = {}
154
+ option[:timeout] = timeout
155
+ option[:profileName] = profile_name
156
+ option[:pid] = pid if pid
157
+
158
+ execute_script 'mobile: startPerfRecord', option
159
+ end
160
+ end
161
+
162
+ Appium::Core::Device.add_endpoint_method(:get_performance_record) do
163
+ # rubocop:disable Metrics/ParameterLists
164
+ def get_performance_record(save_file_path: './performance', profile_name: 'Activity Monitor',
165
+ remote_path: nil, user: nil, pass: nil, method: 'PUT')
166
+ option = ::Appium::Core::Device::ScreenRecord.new(
167
+ remote_path: remote_path, user: user, pass: pass, method: method
168
+ ).upload_option
169
+
170
+ option[:profileName] = profile_name
171
+ result = execute_script 'mobile: stopPerfRecord', option
172
+
173
+ File.open("#{save_file_path}.zip", 'wb') { |f| f << result.unpack('m')[0] }
174
+ end
175
+ # rubocop:enable Metrics/ParameterLists
176
+ end
177
+ end
178
+
99
179
  def add_screen_recording
100
180
  Appium::Core::Device.add_endpoint_method(:start_recording_screen) do
101
181
  # rubocop:disable Metrics/ParameterLists
@@ -1,6 +1,6 @@
1
1
  module Appium
2
2
  module Core
3
- VERSION = '1.3.3'.freeze unless defined? ::Appium::Core::VERSION
4
- DATE = '2018-03-03'.freeze unless defined? ::Appium::Core::DATE
3
+ VERSION = '1.3.4'.freeze unless defined? ::Appium::Core::VERSION
4
+ DATE = '2018-03-21'.freeze unless defined? ::Appium::Core::DATE
5
5
  end
6
6
  end
data/release_notes.md CHANGED
@@ -1,3 +1,14 @@
1
+ #### v1.3.4 2018-03-21
2
+
3
+ - [053458e](https://github.com/appium/ruby_lib_core/commit/053458e8c766c2f83c7025251e1aeebb1a2da4d5) Release 1.3.4
4
+ - [0987ba3](https://github.com/appium/ruby_lib_core/commit/0987ba361f276c9cdbbf6d400201ec49316a09f6) Fix error initialisation (#67)
5
+ - [0064cee](https://github.com/appium/ruby_lib_core/commit/0064cee5a9077858f4903e325471405aefb51fbd) append pid
6
+ - [73185aa](https://github.com/appium/ruby_lib_core/commit/73185aa548e4118f19f23f46814dc2ed52f77b53) apply https://github.com/appium/appium-xcuitest-driver/pull/638
7
+ - [2b46bcf](https://github.com/appium/ruby_lib_core/commit/2b46bcf168dc6bd4524749beaa9aa5676b65a0cb) add getting performance in core as same as Android (#65)
8
+ - [d7335ee](https://github.com/appium/ruby_lib_core/commit/d7335ee5a2c18b8d1a61b125858b825d196c72d1) rename
9
+ - [443394d](https://github.com/appium/ruby_lib_core/commit/443394dc0de09929866f70aea983c77b556b924a) add viewportScreen (#63)
10
+
11
+
1
12
  #### v1.3.3 2018-03-03
2
13
 
3
14
  - [bf9a6a3](https://github.com/appium/ruby_lib_core/commit/bf9a6a357f7c318fd3aae489552964e6dc847a8e) Release 1.3.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: 1.3.3
4
+ version: 1.3.4
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-03-03 00:00:00.000000000 Z
11
+ date: 2018-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -205,6 +205,7 @@ files:
205
205
  - appium_lib_core.gemspec
206
206
  - bin/console
207
207
  - bin/setup
208
+ - docs/mobile_command.md
208
209
  - lib/appium_lib_core.rb
209
210
  - lib/appium_lib_core/android.rb
210
211
  - lib/appium_lib_core/android/device.rb