calabash-cucumber 0.20.3 → 0.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d80bc583ef0ea5ae3fb6548acd4d5ced7f15b2c
4
- data.tar.gz: 61431194a8a83d91b41674c2d5ec6f83076b92fa
3
+ metadata.gz: f28de120ca199bf85fbeff075567483c62b682d8
4
+ data.tar.gz: b908f62ee4c05054cfbb92009e90820f0e6f71cb
5
5
  SHA512:
6
- metadata.gz: 1b9e3bbb6993f444dfd6a9e83e8e4de9d9c2b48080a820c71032967755366eb984de455bac2bfce9fe18a823050a482c8cdf937c56e1e8ae6cfc592b8047fcc8
7
- data.tar.gz: c25c2390ba6e3b3542bfa5e5a1c5cad9dfc6ad73fea899405f2aacc8b25d09b817a3f92dee5a1285cd8a67044ee7b189730bb67c20fc8c9c439c115c6bb1a0af
6
+ metadata.gz: fabc11fc1246e47f59a6e8e6c790d7746af27a4eb844af49d7162c2d5420ca449fd7c7d37df355c6d8b51916b0b4a280087028b8101a0152d421f0fc92714df3
7
+ data.tar.gz: a99481e54fbe0b03f9a113f17e792e64ed56c490d6d3a0d9d43f5b663468fa468ac94791fd382d4b996768085b782ca2ad6f6349b8562731e728d1f325d4e3ba
Binary file
@@ -24,6 +24,28 @@ module Calabash
24
24
  @world = world
25
25
  end
26
26
 
27
+ # @!visibility private
28
+ def to_s
29
+ if client.running?
30
+ version = client.server_version["bundle_short_version"]
31
+ else
32
+ version = "not connected!"
33
+ end
34
+ "#<DeviceAgent API: #{version}>"
35
+ end
36
+
37
+ # @!visibility private
38
+ def inspect
39
+ to_s
40
+ end
41
+
42
+ # @!visibility private
43
+ # https://github.com/awesome-print/awesome_print/pull/253
44
+ # Awesome print patch for BasicObject
45
+ def ai(_)
46
+ to_s
47
+ end
48
+
27
49
  # Query the UI for elements.
28
50
  #
29
51
  # @example
@@ -115,6 +137,11 @@ module Calabash
115
137
  client.query(uiquery)
116
138
  end
117
139
 
140
+ # Perform a clear text on the active view
141
+ def clear_text
142
+ client.clear_text
143
+ end
144
+
118
145
  # Query for the center of a view.
119
146
  #
120
147
  # @see #query
@@ -19,6 +19,8 @@ module Calabash
19
19
 
20
20
  # @!visibility private
21
21
  def http(options, data=nil)
22
+ _private_dismiss_springboard_alerts
23
+
22
24
  options[:uri] = url_for(options[:path])
23
25
  options[:method] = options[:method] || :get
24
26
  if data
@@ -30,6 +32,9 @@ module Calabash
30
32
  end
31
33
  res = make_http_request(options)
32
34
  res.force_encoding("UTF-8") if res.respond_to?(:force_encoding)
35
+
36
+ _private_dismiss_springboard_alerts
37
+
33
38
  res
34
39
  end
35
40
 
@@ -101,6 +106,18 @@ module Calabash
101
106
  http
102
107
  end
103
108
 
109
+ private
110
+
111
+ # @!visibility private
112
+ #
113
+ # Do not call this method.
114
+ def _private_dismiss_springboard_alerts
115
+ require "calabash-cucumber/launcher"
116
+ launcher = Calabash::Cucumber::Launcher.launcher_if_used
117
+ if launcher && launcher.automator && launcher.automator.name == :device_agent
118
+ launcher.automator.client.send(:_dismiss_springboard_alerts)
119
+ end
120
+ end
104
121
  end
105
122
  end
106
123
  end
@@ -188,12 +188,61 @@ module Calabash
188
188
  text
189
189
  end
190
190
 
191
+ # @!visibility private
192
+ # Returns the keyboard type as a symbol from the specified query
193
+ #
194
+ # UIKeyboardTypeDefault => :default
195
+ # UIKeyboardTypeASCIICapable => :ascii_capable
196
+ # UIKeyboardTypeNumbersAndPunctuation => :numbers_and_punctuation
197
+ # UIKeyboardTypeURL => :url
198
+ # UIKeyboardTypeNumberPad => :number_pad
199
+ # UIKeyboardTypePhonePad => :phone_pad
200
+ # UIKeyboardTypeNamePhonePad => :name_phone_pad
201
+ # UIKeyboardTypeEmailAddress => :email
202
+ # UIKeyboardTypeDecimalPad => :decimal
203
+ # UIKeyboardTypeTwitter => :twitter
204
+ # UIKeyboardTypeWebSearch => :web_search
205
+ #
206
+ # @raise [RuntimeError] if there is no visible keyboard
207
+ def keyboard_type(query = "* isFirstResponder:1")
208
+ if !keyboard_visible?
209
+ screenshot_and_raise "There must be a visible keyboard"
210
+ end
211
+
212
+ query_result = _query_wrapper(query, :keyboardType).first
213
+ keyboard_type = KEYBOARD_TYPES[query_result]
214
+
215
+ if !keyboard_type
216
+ RunLoop.log_debug("Found query_result:#{query_result}, but expected
217
+ to match key in #{KEYBOARD_TYPES}")
218
+ keyboard_type = :unknown
219
+ end
220
+
221
+ keyboard_type
222
+ end
223
+
191
224
  # @visibility private
192
225
  # TODO Remove in 0.21.0
193
226
  alias_method :_text_from_first_responder, :text_from_first_responder
194
227
 
195
228
  private
196
229
 
230
+ # @!visbility private
231
+ KEYBOARD_TYPES = {
232
+ 0 => :default,
233
+ 1 => :ascii_capable,
234
+ 2 => :numbers_and_punctuation,
235
+ 3 => :url,
236
+ 4 => :number_pad,
237
+ 5 => :phone_pad,
238
+ 6 => :name_phone_pad,
239
+ 7 => :email,
240
+ 8 => :decimal,
241
+ 9 => :twitter,
242
+ 10 => :web_search
243
+ }
244
+
245
+
197
246
  # @!visibility private
198
247
  KEYBOARD_QUERY = "view:'UIKBKeyplaneView'"
199
248
 
@@ -55,12 +55,6 @@ module Calabash
55
55
  #
56
56
  # @todo Calabash LPOperations should return 'views touched' in JSON format
57
57
  def self.map(query, method_name, *method_args)
58
- require "calabash-cucumber/launcher"
59
- launcher = Calabash::Cucumber::Launcher.launcher_if_used
60
- if launcher && launcher.automator && launcher.automator.name == :device_agent
61
- launcher.automator.client.send(:_dismiss_springboard_alerts)
62
- end
63
-
64
58
  self.raw_map(query, method_name, *method_args)['results']
65
59
  end
66
60
 
@@ -3,10 +3,10 @@ module Calabash
3
3
 
4
4
  # @!visibility public
5
5
  # The Calabash iOS gem version.
6
- VERSION = "0.20.3"
6
+ VERSION = "0.20.4"
7
7
 
8
8
  # @!visibility public
9
9
  # The minimum required version of the Calabash embedded server.
10
- MIN_SERVER_VERSION = "0.20.3"
10
+ MIN_SERVER_VERSION = "0.20.4"
11
11
  end
12
12
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.3
4
+ version: 0.20.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-14 00:00:00.000000000 Z
11
+ date: 2017-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -132,7 +132,7 @@ dependencies:
132
132
  requirements:
133
133
  - - ">="
134
134
  - !ruby/object:Gem::Version
135
- version: 2.2.2
135
+ version: 2.2.4
136
136
  - - "<"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.0'
@@ -142,7 +142,7 @@ dependencies:
142
142
  requirements:
143
143
  - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 2.2.2
145
+ version: 2.2.4
146
146
  - - "<"
147
147
  - !ruby/object:Gem::Version
148
148
  version: '3.0'
@@ -483,7 +483,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
483
483
  version: '0'
484
484
  requirements: []
485
485
  rubyforge_project:
486
- rubygems_version: 2.5.1
486
+ rubygems_version: 2.6.8
487
487
  signing_key:
488
488
  specification_version: 4
489
489
  summary: Client for calabash-ios-server for automated functional testing on iOS