calabash-cucumber 0.11.5.pre3 → 0.11.5.pre5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d50dadedbe0fd3ab4421be5e585d026bd55c002
|
4
|
+
data.tar.gz: a8d3d2e54340109561018c73fb0fc0a7ede6669b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77f902a52e4d614a19795d456cf08dafad343031f4e7d4adbf1276564c07194f82b526cf85f088a9bd9fe7afe172c6471459f5b47036c6db7e8426bb689e7b39
|
7
|
+
data.tar.gz: aca1228b4be8f4ec21b4809ca300fe6b1ea123f5dd5cbcb24f8cb9c8bc621381d7c9c6f8a7add5310f8ef556923c43d5046c8481abb0bc1e3425387fad833412
|
@@ -311,7 +311,7 @@ module Calabash
|
|
311
311
|
|
312
312
|
if uia_available?
|
313
313
|
if chr.length == 1
|
314
|
-
|
314
|
+
uia_type_string_raw chr
|
315
315
|
else
|
316
316
|
code = UIA_SUPPORTED_CHARS[chr]
|
317
317
|
|
@@ -325,10 +325,8 @@ module Calabash
|
|
325
325
|
# keyboard and not a key
|
326
326
|
if code.eql?(UIA_SUPPORTED_CHARS['Delete'])
|
327
327
|
uia("uia.keyboard().elements().firstWithName('Delete').tap()")
|
328
|
-
elsif code.eql?(UIA_SUPPORTED_CHARS['Return'])
|
329
|
-
tap_keyboard_action_key
|
330
328
|
else
|
331
|
-
|
329
|
+
uia_type_string_raw(code)
|
332
330
|
end
|
333
331
|
end
|
334
332
|
# noinspection RubyStringKeysInHashInspection
|
@@ -379,6 +377,56 @@ module Calabash
|
|
379
377
|
end
|
380
378
|
end
|
381
379
|
|
380
|
+
# @!visibility private
|
381
|
+
#
|
382
|
+
# Enters text into view identified by a query
|
383
|
+
#
|
384
|
+
# @note
|
385
|
+
# *IMPORTANT* enter_text defaults to calling 'setValue' in UIAutomation
|
386
|
+
# on the text field. This is fast, but in some cases might result in slightly
|
387
|
+
# different behaviour than using `keyboard_enter_text`.
|
388
|
+
# To force use of `keyboard_enter_text` in `enter_text` use
|
389
|
+
# option :use_keyboard
|
390
|
+
#
|
391
|
+
# @param [String] uiquery the element to enter text into
|
392
|
+
# @param [String] text the text to enter
|
393
|
+
# @param [Hash] options controls details of text entry
|
394
|
+
# @option options [Boolean] :use_keyboard (false) use the iOS keyboard
|
395
|
+
# to enter each character separately
|
396
|
+
# @option options [Boolean] :wait (true) call wait_for_element_exists with uiquery
|
397
|
+
# @option options [Hash] :wait_options ({}) if :wait pass this as options to wait_for_element_exists
|
398
|
+
def enter_text(uiquery, text, options = {})
|
399
|
+
default_opts = {:use_keyboard => false, :wait => true, :wait_options => {}}
|
400
|
+
options = default_opts.merge(options)
|
401
|
+
wait_for_element_exists(uiquery, options[:wait_options]) if options[:wait]
|
402
|
+
touch(uiquery, options)
|
403
|
+
wait_for_keyboard
|
404
|
+
if options[:use_keyboard]
|
405
|
+
keyboard_enter_text(text)
|
406
|
+
else
|
407
|
+
fast_enter_text(text)
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
# @!visibility private
|
412
|
+
#
|
413
|
+
# Enters text into current text input field
|
414
|
+
#
|
415
|
+
# @note
|
416
|
+
# *IMPORTANT* fast_enter_text defaults to calling 'setValue' in UIAutomation
|
417
|
+
# on the text field. This is fast, but in some cases might result in slightly
|
418
|
+
# different behaviour than using `keyboard_enter_text`.
|
419
|
+
# @param [String] text the text to enter
|
420
|
+
def fast_enter_text(text)
|
421
|
+
_ensure_can_enter_text
|
422
|
+
if uia_available?
|
423
|
+
uia_set_responder_value(text)
|
424
|
+
else
|
425
|
+
keyboard_enter_text(text)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
|
382
430
|
# Touches the keyboard action key.
|
383
431
|
#
|
384
432
|
# The action key depends on the keyboard. Some examples include:
|
@@ -395,16 +443,7 @@ module Calabash
|
|
395
443
|
#
|
396
444
|
# @raise [RuntimeError] if the text cannot be typed.
|
397
445
|
def tap_keyboard_action_key
|
398
|
-
|
399
|
-
run_loop = Calabash::Cucumber::Launcher.launcher.run_loop
|
400
|
-
if run_loop[:uia_strategy] == :host
|
401
|
-
uia_type_string "\\\\n", '', false
|
402
|
-
else
|
403
|
-
uia_type_string '\n', '', false
|
404
|
-
end
|
405
|
-
else
|
406
|
-
keyboard_enter_char 'Return'
|
407
|
-
end
|
446
|
+
keyboard_enter_char 'Return'
|
408
447
|
end
|
409
448
|
|
410
449
|
# @deprecated 0.10.0 replaced with `tap_keyboard_action_key`
|
@@ -15,7 +15,7 @@ module Calabash
|
|
15
15
|
# @param {String} str string to escape
|
16
16
|
# @return {String} escaped version of `str`
|
17
17
|
def escape_string(str)
|
18
|
-
escape_quotes(escape_backslashes(str))
|
18
|
+
escape_newlines(escape_quotes(escape_backslashes(str)))
|
19
19
|
end
|
20
20
|
|
21
21
|
# call this method to properly escape blackslashes (\) in Calabash methods
|
@@ -37,6 +37,24 @@ module Calabash
|
|
37
37
|
str.gsub(backslash, backslash*4)
|
38
38
|
end
|
39
39
|
|
40
|
+
# call this method to properly escape newlines (\n) in Calabash methods
|
41
|
+
# (queries and uia actions).
|
42
|
+
# This helper frees you from manual escaping.
|
43
|
+
# Note entering a 'newline' character only works in iOS UITextViews
|
44
|
+
# @note
|
45
|
+
# In ruby it is important to remember that "\n" is a *single character* string containing
|
46
|
+
# a new-line.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# quoted = escape_newlines("Karl's \n annoying problem")
|
50
|
+
# # => "Karl's \\n annoying problem"
|
51
|
+
# @param {String} str string to escape
|
52
|
+
# @return {String} escaped version of `str`
|
53
|
+
def escape_newlines(str)
|
54
|
+
nl = "\n"
|
55
|
+
str.gsub(nl, "\\n")
|
56
|
+
end
|
57
|
+
|
40
58
|
# call this method to properly escape single quotes in Calabash queries
|
41
59
|
# Calabash iOS has some annoying rules for text containing single quotes.
|
42
60
|
# This helper frees you from manual escaping.
|
@@ -144,13 +144,22 @@ module Calabash
|
|
144
144
|
# @param {Array} args_arr array describing the query, e.g., `[:button, {marked:'foo'}]`
|
145
145
|
# @param {Array} opts optional arguments specifying a chained sequence of method calls (see example)
|
146
146
|
def uia_call(args_arr, *opts)
|
147
|
-
uia_call_method(:queryEl, args_arr, *opts)
|
147
|
+
uia_call_method(:queryEl, [args_arr], *opts)
|
148
148
|
end
|
149
149
|
|
150
150
|
# Similar to `uia_call` but searches all windows
|
151
151
|
# @see #uia_call
|
152
152
|
def uia_call_windows(args_arr, *opts)
|
153
|
-
uia_call_method(:queryElWindows, args_arr, *opts)
|
153
|
+
uia_call_method(:queryElWindows, [args_arr], *opts)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Advanced method used for fast keyboard entry by calling the setValue method
|
157
|
+
# on the input with current keyboard focus.
|
158
|
+
# This is an alternative to calling `keyboard_enter_text`
|
159
|
+
#
|
160
|
+
# @param {String} value the value to set
|
161
|
+
def uia_set_responder_value(value)
|
162
|
+
uia_call_method(:elementWithKeyboardFocus, [], setValue: value)
|
154
163
|
end
|
155
164
|
|
156
165
|
# @!visibility private
|
@@ -228,6 +237,16 @@ module Calabash
|
|
228
237
|
uia_handle_command(:swipeOffset, offset, options)
|
229
238
|
end
|
230
239
|
|
240
|
+
# @!visibility private
|
241
|
+
def uia_drag_inside(dir, queryparts, options={})
|
242
|
+
uia_call_method(:swipe, [dir, queryparts, options])
|
243
|
+
end
|
244
|
+
|
245
|
+
# @!visibility private
|
246
|
+
def uia_drag_inside_mark(dir, mark, options={})
|
247
|
+
uia_call_method(:swipeMark, [dir, "\"#{mark}\"", options])
|
248
|
+
end
|
249
|
+
|
231
250
|
# @!visibility private
|
232
251
|
def uia_pinch(*queryparts)
|
233
252
|
uia_handle_command(:pinch, queryparts)
|
@@ -288,6 +307,10 @@ module Calabash
|
|
288
307
|
end
|
289
308
|
end
|
290
309
|
|
310
|
+
def uia_type_string_raw(str)
|
311
|
+
uia("uia.keyboard().typeString('#{str}')")
|
312
|
+
end
|
313
|
+
|
291
314
|
# @!visibility private
|
292
315
|
def uia_enter
|
293
316
|
uia_handle_command(:enter)
|
@@ -319,9 +342,9 @@ module Calabash
|
|
319
342
|
# @!visibility private
|
320
343
|
def uia_call_method(cmd, args_arr, *opts)
|
321
344
|
if opts.empty?
|
322
|
-
return uia_handle_command(cmd, args_arr)
|
345
|
+
return uia_handle_command(cmd, *args_arr)
|
323
346
|
end
|
324
|
-
js_cmd = uia_serialize_command(cmd, args_arr)
|
347
|
+
js_cmd = uia_serialize_command(cmd, *args_arr)
|
325
348
|
|
326
349
|
js_args = []
|
327
350
|
opts.each do |invocation|
|
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.11.5.
|
4
|
+
version: 0.11.5.pre5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Krukow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 1.1.1.
|
173
|
+
version: 1.1.1.pre9
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - ~>
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 1.1.1.
|
180
|
+
version: 1.1.1.pre9
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rake
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,16 +224,16 @@ dependencies:
|
|
224
224
|
name: redcarpet
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- -
|
227
|
+
- - '='
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version:
|
229
|
+
version: 3.2.0
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- -
|
234
|
+
- - '='
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: 3.2.0
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: pry
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|