appium_lib 9.12.0 → 9.12.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,3 @@
1
- require_relative 'ws_logcat'
2
-
3
1
  module Appium
4
2
  module Android
5
3
  module Command
@@ -31,7 +29,7 @@ module Appium
31
29
  @driver.execute_script 'mobile: startLogsBroadcast'
32
30
 
33
31
  socket_url = "ws://#{URI.parse(server_url).host}:#{@core.port}/ws/session/#{@driver.session_id}/appium/device/logcat"
34
- @logcat_client = Command::WsLogcat.new(url: socket_url, output_file: logcat_file)
32
+ @logcat_client = ::Appium::Common::Command::WsLogcat.new(url: socket_url, output_file: logcat_file)
35
33
  end
36
34
 
37
35
  # Stop Android logcat broadcast websocket
@@ -16,6 +16,7 @@ require_relative 'common/multi_touch'
16
16
  require_relative 'common/touch_actions'
17
17
  require_relative 'common/http_client'
18
18
  require_relative 'common/device'
19
+ require_relative 'common/command'
19
20
 
20
21
  # ios
21
22
  require_relative 'ios/ios'
@@ -0,0 +1,9 @@
1
+ require_relative 'command/ws_logcat'
2
+
3
+ module Appium
4
+ module Common
5
+ module Command
6
+ # parent
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Appium
2
- module Android
2
+ module Common
3
3
  module Command
4
4
  class WsLogcat < ::Appium::Core::WebSocket
5
5
  def initialize(url:, output_file: 'logcat.log')
@@ -16,12 +16,20 @@ module Appium
16
16
  #
17
17
  # If only a number is provided then it's treated as the timeout value.
18
18
  #
19
- # @param [Hash] opts Options
19
+ # @param [Hash|Numeric] opts Options. If the value is _Numeric_, the value is set as `{ timeout: value }`
20
20
  # @option opts [Numeric] :timeout Seconds to wait before timing out. Set default by `appium_wait_timeout` (30).
21
21
  # @option opts [Numeric] :interval Seconds to sleep between polls. Set default by `appium_wait_interval` (0.5).
22
22
  # @option opts [String] :message Exception message if timed out.
23
23
  # @option opts [Array, Exception] :ignore Exceptions to ignore while polling (default: Exception)
24
+ #
25
+ # @example
26
+ #
27
+ # wait_true(timeout: 20, interval: 0.2, message: 'custom message') { button_exact('Back') }.click
28
+ # wait_true(20) { button_exact('Back') }.click
29
+ #
24
30
  def wait_true(opts = {})
31
+ opts = opts.is_a?(Numeric) ? { timeout: opts } : opts
32
+
25
33
  if opts.is_a? Hash
26
34
  opts.empty? ? @core.wait_true { yield } : @core.wait_true(opts) { yield }
27
35
  else
@@ -37,12 +45,20 @@ module Appium
37
45
  #
38
46
  # If only a number is provided then it's treated as the timeout value.
39
47
  #
40
- # @param [Hash] opts Options
48
+ # @param [Hash|Numeric] opts Options. If the value is _Numeric_, the value is set as `{ timeout: value }`
41
49
  # @option opts [Numeric] :timeout Seconds to wait before timing out. Set default by `appium_wait_timeout` (30).
42
50
  # @option opts [Numeric] :interval Seconds to sleep between polls. Set default by `appium_wait_interval` (0.5).
43
51
  # @option opts [String] :message Exception message if timed out.
44
52
  # @option opts [Array, Exception] :ignore Exceptions to ignore while polling (default: Exception)
53
+ #
54
+ # @example
55
+ #
56
+ # wait(timeout: 20, interval: 0.2, message: 'custom message') { button_exact('Back') }.click
57
+ # wait(20) { button_exact('Back') }.click
58
+ #
45
59
  def wait(opts = {})
60
+ opts = opts.is_a?(Numeric) ? { timeout: opts } : opts
61
+
46
62
  if opts.is_a? Hash
47
63
  opts.empty? ? @core.wait { yield } : @core.wait(opts) { yield }
48
64
  else
@@ -14,6 +14,7 @@ module Appium
14
14
  target.extend Appium::Ios::Xcuitest::Gesture
15
15
  target.extend Appium::Ios::Xcuitest::MultiAppHandler
16
16
  target.extend Appium::Ios::Xcuitest::Element
17
+ target.extend Appium::Ios::Xcuitest::Command
17
18
  end
18
19
  end
19
20
  end
@@ -7,6 +7,32 @@ module Appium
7
7
  module Ios
8
8
  module Xcuitest
9
9
  module Command
10
+ # Starts iOS syslog broadcast websocket
11
+ #
12
+ # @param [String] syslog_file A file path to write messages from a syslog WebSocket client
13
+ #
14
+ # @example
15
+ #
16
+ # start_logs_broadcast 'outputfile.log' #=> #<Appium::Android::Command::WsLogcat:...>
17
+ #
18
+ def start_logs_broadcast(syslog_file = 'syslog.log')
19
+ @driver.execute_script 'mobile: startLogsBroadcast'
20
+
21
+ socket_url = "ws://#{URI.parse(server_url).host}:#{@core.port}/ws/session/#{@driver.session_id}/appium/device/syslog"
22
+ @logcat_client = ::Appium::Common::Command::WsLogcat.new(url: socket_url, output_file: syslog_file)
23
+ end
24
+
25
+ # Stop iOS syslog broadcast websocket
26
+ #
27
+ # @example
28
+ #
29
+ # stop_logs_broadcast #=> nil
30
+ #
31
+ def stop_logs_broadcast
32
+ @logcat_client.close
33
+
34
+ @driver.execute_script 'mobile: stopLogsBroadcast'
35
+ end
10
36
  end
11
37
  end
12
38
  end
@@ -1,5 +1,5 @@
1
1
  module Appium
2
2
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
3
- VERSION = '9.12.0'.freeze unless defined? ::Appium::VERSION
4
- DATE = '2018-04-25'.freeze unless defined? ::Appium::DATE
3
+ VERSION = '9.12.1'.freeze unless defined? ::Appium::VERSION
4
+ DATE = '2018-05-06'.freeze unless defined? ::Appium::DATE
5
5
  end
@@ -1,3 +1,9 @@
1
+ #### v9.12.0 2018-04-25
2
+
3
+ - [7a5a12c](https://github.com/appium/ruby_lib/commit/7a5a12ce78ce0a8154ea55ff7f44ecd10ba5b771) [Release 9 12 0 (#775)](https://github.com/appium/ruby_lib/issues/775)
4
+ - [7dcb4fa](https://github.com/appium/ruby_lib/commit/7dcb4fa287e61c813ab8f522e5a4d397a95f5039) [remove hot fix actions (#773)](https://github.com/appium/ruby_lib/issues/773)
5
+
6
+
1
7
  #### v9.11.1 2018-04-22
2
8
 
3
9
  - [778aaf4](https://github.com/appium/ruby_lib/commit/778aaf4dfd5879759fd296f770aef59a6eca685e) [Release 9 11 1 (#772)](https://github.com/appium/ruby_lib/issues/772)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.12.0
4
+ version: 9.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-25 00:00:00.000000000 Z
11
+ date: 2018-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appium_lib_core
@@ -222,7 +222,6 @@ files:
222
222
  - lib/appium_lib.rb
223
223
  - lib/appium_lib/android/android.rb
224
224
  - lib/appium_lib/android/common/command/command.rb
225
- - lib/appium_lib/android/common/command/ws_logcat.rb
226
225
  - lib/appium_lib/android/common/helper.rb
227
226
  - lib/appium_lib/android/element/alert.rb
228
227
  - lib/appium_lib/android/element/button.rb
@@ -237,6 +236,8 @@ files:
237
236
  - lib/appium_lib/android/uiautomator2/element/button.rb
238
237
  - lib/appium_lib/android/uiautomator2/helper.rb
239
238
  - lib/appium_lib/appium.rb
239
+ - lib/appium_lib/common/command.rb
240
+ - lib/appium_lib/common/command/ws_logcat.rb
240
241
  - lib/appium_lib/common/device.rb
241
242
  - lib/appium_lib/common/helper.rb
242
243
  - lib/appium_lib/common/http_client.rb