appium_lib_core 1.3.1 → 1.3.2

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: c04b7c34dd2c6871b41e81187a83b88ff5d88d1d
4
- data.tar.gz: 2cb5ab6893ac740b4302364110a8b4fdf67afcbd
3
+ metadata.gz: 66f7820de22c2ba7df015f3cd5ae4302eb7f4ec7
4
+ data.tar.gz: 4e83154812d2f588e26e768f696361e253d936e7
5
5
  SHA512:
6
- metadata.gz: e246e7f8d8c553bf034a90fc9a11678c50e4a171c77cc1ea9cb1a74bc4600a7e176908f70c30edd5c93d3c12519794aa2ff6135d8844215d82b489a9460a5f35
7
- data.tar.gz: 49060b3ba5fd7bc18ada2e6f01f4e3e5e9021759d6d4f9ed208f54ce01a9173298b329d04306db627d8745b73c41ae071a70441c52092dc4d9f121d4bc24fde7
6
+ metadata.gz: ee637f5d7f9dfcd71415bcb4c166f9f191e0bfd1dc0751c8728a0df902fa53ceab41a397d56f7ddf8d64acf47c42afd4aef7a33286eeae33a6e125bc698d7ff5
7
+ data.tar.gz: 7299245629242b4822dcba89c712859ec0fae140143c3e8d6e7910b5f5f43d6455fef16a0ab8f3417676a2a218cee99acb93cb1435ab0d1f552652df2bd4db00
@@ -26,3 +26,5 @@ Lint/NestedMethodDefinition:
26
26
  Enabled: false
27
27
  Naming/AccessorMethodName:
28
28
  Enabled: false
29
+ Style/SymbolArray:
30
+ Enabled: false
@@ -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.2] - 2018-02-18
12
+ ### Enhancements
13
+ - Add Android emulator commands
14
+ - `send_sms`, `gsm_call`, `gsm_signal`, `gsm_voice`, `set_network_speed`, `set_power_capacity`, `set_power_ac`
15
+ - Add toggles
16
+ - `toggle_location_services`, `toggle_wifi`, `toggle_data`
17
+
18
+ ### Bug fixes
19
+
20
+ ### Deprecations
21
+
11
22
  ## [1.3.1] - 2018-02-14
12
23
  ### Enhancements
13
24
  - add some app management commands [#58](https://github.com/appium/ruby_lib_core/pull/58)
@@ -1,3 +1,5 @@
1
+ require_relative 'device/emulator'
2
+
1
3
  module Appium
2
4
  module Android
3
5
  module Device
@@ -175,6 +177,7 @@ module Appium
175
177
  end
176
178
 
177
179
  add_screen_recording
180
+ Emulator.emulator_commands
178
181
  end
179
182
 
180
183
  private
@@ -0,0 +1,168 @@
1
+ module Appium
2
+ module Android
3
+ module Device
4
+ module Emulator
5
+ GSM_CALL_ACTIONS = [:call, :accept, :cancel, :hold].freeze
6
+
7
+ GSM_VOICE_STATES = [:on, :off, :denied, :searching, :roaming, :home, :unregistered].freeze
8
+
9
+ GSM_SIGNALS = { none_or_unknown: 0, poor: 1, moderate: 2, good: 3, great: 4 }.freeze
10
+
11
+ # :gsm // GSM/CSD (up: 14.4, down: 14.4).
12
+ # :scsd // HSCSD (up: 14.4, down: 57.6).
13
+ # :gprs // GPRS (up: 28.8, down: 57.6).
14
+ # :edge // EDGE/EGPRS (up: 473.6, down: 473.6).
15
+ # :umts // UMTS/3G (up: 384.0, down: 384.0).
16
+ # :hsdpa // HSDPA (up: 5760.0, down: 13,980.0).
17
+ # :lte // LTE (up: 58,000, down: 173,000).
18
+ # :evdo // EVDO (up: 75,000, down: 280,000).
19
+ # :full // No limit, the default (up: 0.0, down: 0.0).
20
+ NET_SPEED = [:gsm, :scsd, :gprs, :edge, :umts, :hsdpa, :lte, :evdo, :full].freeze
21
+
22
+ POWER_AC_STATE = [:on, :off].freeze
23
+
24
+ # @!method send_sms(phone_number:, message:)
25
+ # Emulate send SMS event on the connected emulator.
26
+ #
27
+ # @param [String] phone_number: The phone number of message sender
28
+ # @param [String] message: The message to send
29
+ #
30
+ # @example
31
+ #
32
+ # @driver.send_sms phone_number: '00000000000', message: 'test message'
33
+ #
34
+
35
+ # @!method gsm_call(phone_number:, action:)
36
+ # Emulate GSM call event on the connected emulator.
37
+ #
38
+ # @param [String] phone_number: The phone number of message sender
39
+ # @param [Hash] action: One of available GSM call actions. Available action is GSM_CALL_ACTION.
40
+ #
41
+ # @example
42
+ #
43
+ # @driver.gsm_call phone_number: '00000000000', action: :call
44
+ #
45
+
46
+ # @!method gsm_signal(signal_strength)
47
+ # Emulate GSM signal strength change event on the connected emulator.
48
+ #
49
+ # @param [Hash] signal_strength One of available GSM signal strength. Available action is GSM_SIGNAL.
50
+ #
51
+ # @example
52
+ #
53
+ # @driver.gsm_signal :good
54
+ #
55
+
56
+ # @!method gsm_voice(state)
57
+ # Emulate GSM voice event on the connected emulator.
58
+ #
59
+ # @param [Hash] state One of available GSM voice state. Available action is GSM_VOICE_STATE.
60
+ #
61
+ # @example
62
+ #
63
+ # @driver.gsm_voice :on
64
+ #
65
+
66
+ # @!method set_network_speed(netspeed)
67
+ # Emulate network speed change event on the connected emulator.
68
+ #
69
+ # @param [Hash] netspeed One of available Network Speed values. Available action is NET_SPEED.
70
+ #
71
+ # @example
72
+ #
73
+ # @driver.set_network_speed :gsm
74
+ #
75
+
76
+ # @!method set_power_capacity(percent)
77
+ # Emulate power capacity change on the connected emulator.
78
+ #
79
+ # @param [Integer] percent Percentage value in range [0, 100].
80
+ #
81
+ # @example
82
+ #
83
+ # @driver.set_power_capacity 10
84
+ #
85
+
86
+ # @!method set_power_ac(state)
87
+ # Emulate power state change on the connected emulator.
88
+ #
89
+ # @param [Hash] state One of available power AC state. Available action is POWER_AC_STATE.
90
+ #
91
+ # @example
92
+ #
93
+ # @driver.set_power_ac :on
94
+ #
95
+
96
+ ####
97
+ ## self.emulator_commands
98
+ ####
99
+
100
+ def self.emulator_commands
101
+ Appium::Core::Device.add_endpoint_method(:send_sms) do
102
+ def send_sms(phone_number:, message:)
103
+ execute(:send_sms, {}, { phoneNumber: phone_number, message: message })
104
+ end
105
+ end
106
+
107
+ Appium::Core::Device.add_endpoint_method(:gsm_call) do
108
+ def gsm_call(phone_number:, action:)
109
+ unless GSM_CALL_ACTIONS.member? action.to_sym
110
+ raise "action: should be member of #{GSM_CALL_ACTIONS}. Not #{action}."
111
+ end
112
+
113
+ execute(:gsm_call, {}, { phoneNumber: phone_number, action: action })
114
+ end
115
+ end
116
+
117
+ Appium::Core::Device.add_endpoint_method(:gsm_signal) do
118
+ def gsm_signal(signal_strength)
119
+ raise "#{signal_strength} should be member of #{GSM_SIGNALS} " if GSM_SIGNALS[signal_strength.to_sym].nil?
120
+
121
+ execute(:gsm_signal, {}, { signalStrengh: GSM_SIGNALS[signal_strength] })
122
+ end
123
+ end
124
+
125
+ Appium::Core::Device.add_endpoint_method(:gsm_voice) do
126
+ def gsm_voice(state)
127
+ unless GSM_VOICE_STATES.member? state.to_sym
128
+ raise "The state should be member of #{GSM_VOICE_STATES}. Not #{state}."
129
+ end
130
+
131
+ execute(:gsm_voice, {}, { state: state })
132
+ end
133
+ end
134
+
135
+ Appium::Core::Device.add_endpoint_method(:set_network_speed) do
136
+ def set_network_speed(netspeed)
137
+ unless NET_SPEED.member? netspeed.to_sym
138
+ raise "The netspeed should be member of #{NET_SPEED}. Not #{netspeed}."
139
+ end
140
+
141
+ execute(:set_network_speed, {}, { netspeed: netspeed })
142
+ end
143
+ end
144
+
145
+ Appium::Core::Device.add_endpoint_method(:set_power_capacity) do
146
+ def set_power_capacity(percent)
147
+ unless (0..100).member? percent
148
+ raise "The percent should be between 0 and 100. Not #{percent}."
149
+ end
150
+
151
+ execute(:set_power_capacity, {}, { percent: percent })
152
+ end
153
+ end
154
+
155
+ Appium::Core::Device.add_endpoint_method(:set_power_ac) do
156
+ def set_power_ac(state)
157
+ unless POWER_AC_STATE.member? state.to_sym
158
+ raise "The state should be member of #{POWER_AC_STATE}. Not #{state}."
159
+ end
160
+
161
+ execute(:set_power_ac, {}, { state: state })
162
+ end
163
+ end
164
+ end # def self.emulator_commands
165
+ end # module Emulator
166
+ end # module Device
167
+ end # module Android
168
+ end # module Appium
@@ -24,7 +24,11 @@ module Appium
24
24
  get_display_density: [:get, 'session/:session_id/appium/device/display_density'.freeze],
25
25
  is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown'.freeze],
26
26
  get_network_connection: [:get, 'session/:session_id/network_connection'.freeze], # defined also in OSS
27
- get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'.freeze]
27
+ get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'.freeze],
28
+ toggle_wifi: [:post, 'session/:session_id/appium/device/toggle_wifi'.freeze],
29
+ toggle_data: [:post, 'session/:session_id/appium/device/toggle_data'.freeze],
30
+ toggle_location_services: [:post, 'session/:session_id/appium/device/toggle_location_services'.freeze]
31
+
28
32
  # iOS
29
33
  }.freeze
30
34
 
@@ -64,7 +68,16 @@ module Appium
64
68
  start_activity: [:post, 'session/:session_id/appium/device/start_activity'.freeze],
65
69
  end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'.freeze],
66
70
  set_network_connection: [:post, 'session/:session_id/network_connection'.freeze], # defined also in OSS
67
- get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'.freeze]
71
+ get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'.freeze],
72
+
73
+ # only emulator
74
+ send_sms: [:post, 'session/:session_id/appium/device/send_sms'.freeze],
75
+ gsm_call: [:post, 'session/:session_id/appium/device/gsm_call'.freeze],
76
+ gsm_signal: [:post, 'session/:session_id/appium/device/gsm_signal'.freeze],
77
+ gsm_voice: [:post, 'session/:session_id/appium/device/gsm_voice'.freeze],
78
+ set_network_speed: [:post, 'session/:session_id/appium/device/network_speed'.freeze],
79
+ set_power_capacity: [:post, 'session/:session_id/appium/device/power_capacity'.freeze],
80
+ set_power_ac: [:post, 'session/:session_id/appium/device/power_ac'.freeze]
68
81
  }.freeze
69
82
 
70
83
  COMMAND_IOS = {
@@ -138,6 +138,33 @@ module Appium
138
138
  # @driver.device_time
139
139
  #
140
140
 
141
+ # @!method toggle_location_services
142
+ # Switch the state of the location service
143
+ # @return [String]
144
+ #
145
+ # @example
146
+ #
147
+ # @driver.toggle_location_services
148
+ #
149
+
150
+ # @!method toggle_wifi
151
+ # Switch the state of the wifi service
152
+ # @return [String]
153
+ #
154
+ # @example
155
+ #
156
+ # @driver.toggle_wifi
157
+ #
158
+
159
+ # @!method toggle_data
160
+ # Switch the state of data service
161
+ # @return [String]
162
+ #
163
+ # @example
164
+ #
165
+ # @driver.toggle_data
166
+ #
167
+
141
168
  ####
142
169
  ## With arguments
143
170
  ####
@@ -1,6 +1,6 @@
1
1
  module Appium
2
2
  module Core
3
- VERSION = '1.3.1'.freeze unless defined? ::Appium::Core::VERSION
4
- DATE = '2018-02-14'.freeze unless defined? ::Appium::Core::DATE
3
+ VERSION = '1.3.2'.freeze unless defined? ::Appium::Core::VERSION
4
+ DATE = '2018-02-18'.freeze unless defined? ::Appium::Core::DATE
5
5
  end
6
6
  end
@@ -1,3 +1,10 @@
1
+ #### v1.3.2 2018-02-18
2
+
3
+ - [28e04a7](https://github.com/appium/ruby_lib_core/commit/28e04a743905cfee5b3be1487ffe5f852a387ba4) Release 1.3.2
4
+ - [703ec81](https://github.com/appium/ruby_lib_core/commit/703ec81c3add83f9ab0e2b84648bc0db16829bc2) add toggles (#61)
5
+ - [1f93d58](https://github.com/appium/ruby_lib_core/commit/1f93d58666caa66f9d13aca9618d6a5d333631e7) Add some emulator commands (#60)
6
+
7
+
1
8
  #### v1.3.1 2018-02-14
2
9
 
3
10
  - [d107749](https://github.com/appium/ruby_lib_core/commit/d107749782e3eae49aeb9c17411a120eecb5a242) Release 1.3.1
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.1
4
+ version: 1.3.2
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-02-14 00:00:00.000000000 Z
11
+ date: 2018-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -194,6 +194,7 @@ files:
194
194
  - lib/appium_lib_core.rb
195
195
  - lib/appium_lib_core/android.rb
196
196
  - lib/appium_lib_core/android/device.rb
197
+ - lib/appium_lib_core/android/device/emulator.rb
197
198
  - lib/appium_lib_core/android/espresso/bridge.rb
198
199
  - lib/appium_lib_core/android/search_context.rb
199
200
  - lib/appium_lib_core/android/uiautomator1/bridge.rb