calabash-cucumber 0.19.0.pre2 → 0.19.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/calabash-ios +0 -2
- data/bin/calabash-ios-helpers.rb +7 -12
- data/bin/calabash-ios-sim.rb +14 -55
- data/doc/calabash-ios-help.txt +23 -65
- data/dylibs/libCalabashDyn.dylib +0 -0
- data/dylibs/libCalabashDynSim.dylib +0 -0
- data/lib/calabash-cucumber/actions/instruments_actions.rb +3 -3
- data/lib/calabash-cucumber/console_helpers.rb +388 -0
- data/lib/calabash-cucumber/core.rb +32 -35
- data/lib/calabash-cucumber/date_picker.rb +3 -2
- data/lib/calabash-cucumber/environment.rb +1 -1
- data/lib/calabash-cucumber/http/http.rb +1 -0
- data/lib/calabash-cucumber/launcher.rb +21 -1
- data/lib/calabash-cucumber/map.rb +24 -12
- data/lib/calabash-cucumber/status_bar_helpers.rb +2 -2
- data/lib/calabash-cucumber/version.rb +1 -1
- data/scripts/.irbrc +87 -0
- data/staticlib/calabash.framework.zip +0 -0
- data/staticlib/libFrankCalabash.a +0 -0
- metadata +33 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 227255a957e46df2f354db1352c0e7bcdbb26062
|
4
|
+
data.tar.gz: 7f56b0929540d9019a1a34640917cdad68d979b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f35bcecf41a3166830e70dd7cb5132ecd6d6b2246a807d7bae9519000ebd8a74d4608ea161937e6e91e97902baee3be249829d24a37d15b1955da11610449417
|
7
|
+
data.tar.gz: d498b59943d3a096c9eae4660cd25cb0386c9ea96e3e6b7311347275dd68ad1a753ff41a854d60b078d6ac5ddab43e439ceabf316c300f4f2bdcf074b5d1a0ea
|
data/bin/calabash-ios
CHANGED
data/bin/calabash-ios-helpers.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
UPDATE_TARGETS = ['hooks']
|
5
|
-
|
6
4
|
def msg(title, &block)
|
7
5
|
puts "\n" + "-"*10 + title + "-"*10
|
8
6
|
block.call
|
9
7
|
puts "-"*10 + "-------" + "-"*10 + "\n"
|
10
8
|
end
|
11
9
|
|
12
|
-
|
13
10
|
def print_usage
|
14
11
|
puts <<EOF
|
15
12
|
Usage: calabash-ios <command> [<args>]
|
@@ -20,26 +17,24 @@ def print_usage
|
|
20
17
|
generate a features folder structure.
|
21
18
|
console
|
22
19
|
starts an interactive console to interact with your app via Calabash
|
23
|
-
setup [<path>]
|
24
|
-
setup your XCode project for calabash-ios (EXPERIMENTAL)
|
25
20
|
download
|
26
21
|
install latest compatible version of calabash.framework
|
27
|
-
|
28
|
-
|
29
|
-
sim locale <lang> [<region>]
|
30
|
-
change locale and regional settings in all iOS Simulators
|
31
|
-
sim location {on|off} <bundleid>
|
32
|
-
set allow location on/off for current project or bundleid
|
22
|
+
sim locale [language code] [locale code]
|
23
|
+
change locale and regional settings for an iOS Simulator
|
33
24
|
sim reset
|
34
25
|
reset content and settings in all iOS Simulators
|
35
26
|
sim acc
|
36
27
|
enable accessibility in all iOS Simulators
|
28
|
+
check [{<path to .ipa>|<path to .app>}]
|
29
|
+
check whether an app or ipa is linked with calabash.framework (EXPERIMENTAL)
|
30
|
+
setup [<path>]
|
31
|
+
setup your Xcode project for calabash-ios (EXPERIMENTAL)
|
37
32
|
EOF
|
38
33
|
end
|
39
34
|
|
40
35
|
def print_help
|
41
36
|
file = File.join(File.dirname(__FILE__), '..', 'doc', 'calabash-ios-help.txt')
|
42
|
-
|
37
|
+
puts File.read(file)
|
43
38
|
end
|
44
39
|
|
45
40
|
def ensure_correct_path(args)
|
data/bin/calabash-ios-sim.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require "
|
2
|
-
require 'run_loop'
|
1
|
+
require "run_loop"
|
3
2
|
|
4
3
|
def quit_sim
|
5
4
|
RunLoop::SimControl.new.quit_sim
|
@@ -13,49 +12,6 @@ def calabash_sim_accessibility
|
|
13
12
|
RunLoop::SimControl.new.enable_accessibility_on_sims
|
14
13
|
end
|
15
14
|
|
16
|
-
def calabash_sim_location(args)
|
17
|
-
|
18
|
-
if args.length == 0
|
19
|
-
print_usage
|
20
|
-
exit 0
|
21
|
-
end
|
22
|
-
on_off = args.shift
|
23
|
-
if args.length == 0
|
24
|
-
print_usage
|
25
|
-
exit 0
|
26
|
-
end
|
27
|
-
bundle_id = args.shift
|
28
|
-
|
29
|
-
|
30
|
-
dirs = Dir.glob(File.join(File.expand_path("~/Library"), "Application Support", "iPhone Simulator", "*.*", "Library", "Caches", "locationd"))
|
31
|
-
dirs.each do |sim_dir|
|
32
|
-
existing_path = "#{sim_dir}/clients.plist"
|
33
|
-
if File.exist?(existing_path)
|
34
|
-
plist_path = existing_path
|
35
|
-
else
|
36
|
-
plist_path = File.expand_path("#{@script_dir}/data/clients.plist")
|
37
|
-
end
|
38
|
-
|
39
|
-
plist = CFPropertyList::List.new(:file => plist_path)
|
40
|
-
hash = CFPropertyList.native_types(plist.value)
|
41
|
-
|
42
|
-
app_hash = hash[bundle_id]
|
43
|
-
if not app_hash
|
44
|
-
app_hash = hash[bundle_id] = {}
|
45
|
-
end
|
46
|
-
app_hash["BundleId"] = bundle_id
|
47
|
-
app_hash["Authorized"] = on_off == "on" ? true : false
|
48
|
-
app_hash["LocationTimeStarted"] = 0
|
49
|
-
|
50
|
-
##Plist edit the template
|
51
|
-
res_plist = CFPropertyList::List.new
|
52
|
-
res_plist.value = CFPropertyList.guess(hash)
|
53
|
-
res_plist.save(existing_path, CFPropertyList::List::FORMAT_BINARY)
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
15
|
def calabash_sim_locale(args)
|
60
16
|
|
61
17
|
if args.length != 2
|
@@ -87,19 +43,18 @@ This operation will quit and reset the simulator.
|
|
87
43
|
language = args[0]
|
88
44
|
locale = args[1]
|
89
45
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
target = device_target || default_target
|
46
|
+
xcode = RunLoop::Xcode.new
|
47
|
+
instruments = RunLoop::Instruments.new
|
48
|
+
simctl = RunLoop::Simctl.new
|
94
49
|
|
95
|
-
device = RunLoop::Device.
|
50
|
+
device = RunLoop::Device.detect_device({}, xcode, simctl, instruments)
|
96
51
|
|
97
52
|
if device.nil?
|
98
|
-
if
|
53
|
+
if RunLoop::Environment.device_target
|
99
54
|
puts %Q{
|
100
55
|
Could not find simulator matching:
|
101
56
|
|
102
|
-
DEVICE_TARGET=#{device_target}
|
57
|
+
DEVICE_TARGET=#{RunLoop::Environment.device_target}
|
103
58
|
|
104
59
|
Check the output of:
|
105
60
|
|
@@ -109,8 +64,12 @@ for a list of available simulators.
|
|
109
64
|
}
|
110
65
|
else
|
111
66
|
puts %Q{
|
112
|
-
Could not find the default simulator
|
113
|
-
|
67
|
+
Could not find the default simulator:
|
68
|
+
|
69
|
+
#{RunLoop::Core.default_simulator}
|
70
|
+
|
71
|
+
1. Your Xcode version might not be compatible with run-loop #{RunLoop::VERSION}.
|
72
|
+
2. You might need to install additional simulators in Xcode.
|
114
73
|
}
|
115
74
|
end
|
116
75
|
|
@@ -121,7 +80,7 @@ the right version of run_loop installed for your Xcode version.
|
|
121
80
|
puts %Q{
|
122
81
|
This tool is for simulators only.
|
123
82
|
|
124
|
-
#{
|
83
|
+
#{device} is a physical device.
|
125
84
|
}
|
126
85
|
return false
|
127
86
|
end
|
data/doc/calabash-ios-help.txt
CHANGED
@@ -1,77 +1,35 @@
|
|
1
1
|
Usage: calabash-ios <command-name> [parameters]
|
2
|
-
<command-name> can be one of
|
3
|
-
help
|
4
|
-
gen
|
5
|
-
setup (EXPERIMENTAL) [opt path]?
|
6
|
-
download [opt path]?
|
7
|
-
check (EXPERIMENTAL) [opt path to .ipa/.app]?
|
8
|
-
sim locale [lang] [regional]?
|
9
|
-
sim reset
|
10
|
-
sim acc
|
11
|
-
sim location {on|off} <bundleid>
|
12
2
|
|
13
3
|
Commands:
|
14
|
-
gen creates a skeleton features dir. This is usually used once when
|
15
|
-
setting up calabash to ensure that the features folder contains
|
16
|
-
the right step definitions and environment to run with cucumber.
|
17
|
-
console
|
18
|
-
starts an interactive console to interact with your app via Calabash.
|
19
|
-
Supports setting environment var CALABASH_IRBRC for custom .irbrc file.
|
20
|
-
|
21
|
-
setup [path]? (EXPERIMENTAL) Automates setting up your iOS Xcode project
|
22
|
-
with calabash-ios-server. It is your responsibility to ensure
|
23
|
-
that your production build does not link with calabash.framework.
|
24
|
-
setup will try to ensure this, but you should check manually.
|
25
|
-
|
26
|
-
setup will download calabash.framework and modify you Xcode project
|
27
|
-
file. The parameter [path] is optional (default is the current dir).
|
28
|
-
If specified [path] should be the path to your iOS Xcode project
|
29
|
-
(i.e., the folder which contains projectname.xcodeproj).
|
30
4
|
|
31
|
-
|
32
|
-
|
33
|
-
- add the calabash.framework to your Frameworks folder
|
34
|
-
- add $(SRCROOT) to framework search path
|
35
|
-
- link with calabash.framework in duped target
|
36
|
-
- link with Apple's CFNetwork.framework in duped target
|
37
|
-
- setup special linker options to ensure calabash is loaded
|
5
|
+
version
|
6
|
+
Print the version of the Calabash iOS gem.
|
38
7
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
download [opt_path]?
|
45
|
-
copies current compatible version of calabash.framework to your project.
|
46
|
-
It should be run from a directory containing an Xcode project,
|
47
|
-
or optionally opt_path should be supplied and pointing to a
|
48
|
-
directory containing an Xcode project.
|
49
|
-
Will copy in the latest version that matches the
|
50
|
-
currently installed calabash-cucumber gem.
|
51
|
-
To update Calabash for your project run
|
8
|
+
gen
|
9
|
+
Creates a skeleton features dir. This is usually used once when
|
10
|
+
setting up calabash to ensure that the features folder contains
|
11
|
+
the right step definitions and environment to run with cucumber.
|
52
12
|
|
53
|
-
|
54
|
-
|
13
|
+
console
|
14
|
+
Starts an interactive console to interact with your app via Calabash.
|
15
|
+
If there is a .irbrc in your local directory, the IRB will load that file.
|
16
|
+
To share an .irbrc across projects, use the CALABASH_IRBRC environment
|
17
|
+
variable.
|
55
18
|
|
56
|
-
|
57
|
-
|
19
|
+
download
|
20
|
+
Copies current compatible version of calabash.framework to your project.
|
21
|
+
It should be run from a directory containing an Xcode project,
|
58
22
|
|
59
|
-
check
|
60
|
-
|
61
|
-
if called without parameter [.app or .ipa] then pwd should be
|
62
|
-
a directory containing an xcodeproj. In this case we'll check
|
63
|
-
the default Xcode simulator build path for a Debug and Calabash
|
64
|
-
build configurations. We check that Debug doesn't link with
|
65
|
-
calabash.framework but Calabash does.
|
23
|
+
check { path/to/My.app | path/to/My.ipa }
|
24
|
+
Check whether an app or ipa is linked with calabash.framework
|
66
25
|
|
67
|
-
sim locale
|
68
|
-
|
69
|
-
|
70
|
-
da_DK, en_US.
|
26
|
+
sim locale [lang code] [locale code]
|
27
|
+
Changes the regional settings. For usage information, run:
|
28
|
+
$ calabash-ios sim locale
|
71
29
|
|
72
|
-
sim
|
73
|
-
|
30
|
+
sim reset
|
31
|
+
Reset the Content & Settings of all iOS Simulators
|
74
32
|
|
75
|
-
|
76
|
-
|
33
|
+
setup [path]? (EXPERIMENTAL)
|
34
|
+
https://github.com/calabash/calabash-ios/wiki/calabash-ios-setup
|
77
35
|
|
data/dylibs/libCalabashDyn.dylib
CHANGED
Binary file
|
Binary file
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'calabash-cucumber/uia'
|
2
2
|
require 'calabash-cucumber/connection_helpers'
|
3
3
|
require 'calabash-cucumber/query_helpers'
|
4
|
-
require 'calabash-cucumber/map'
|
5
4
|
|
6
5
|
# @!visibility private
|
7
6
|
class Calabash::Cucumber::InstrumentsActions
|
8
7
|
include Calabash::Cucumber::UIA
|
9
8
|
include Calabash::Cucumber::ConnectionHelpers
|
10
9
|
include Calabash::Cucumber::QueryHelpers
|
11
|
-
|
10
|
+
|
11
|
+
require "calabash-cucumber/map"
|
12
12
|
|
13
13
|
# @!visibility private
|
14
14
|
def touch(options)
|
@@ -100,7 +100,7 @@ class Calabash::Cucumber::InstrumentsActions
|
|
100
100
|
|
101
101
|
# @!visibility private
|
102
102
|
def find_and_normalize(ui_query)
|
103
|
-
raw_result = raw_map(ui_query, :query)
|
103
|
+
raw_result = Calabash::Cucumber::Map.raw_map(ui_query, :query)
|
104
104
|
orientation = raw_result['status_bar_orientation']
|
105
105
|
res = raw_result['results']
|
106
106
|
|
@@ -0,0 +1,388 @@
|
|
1
|
+
module Calabash
|
2
|
+
module Cucumber
|
3
|
+
# A collection of methods that help you use console.
|
4
|
+
module ConsoleHelpers
|
5
|
+
|
6
|
+
# Print a representation of the current view hierarchy.
|
7
|
+
def tree
|
8
|
+
hash = http_fetch_view_hierarchy
|
9
|
+
dump_json_data(hash)
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
# Print the visible element ids.
|
14
|
+
def ids
|
15
|
+
accessibility_marks(:id)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Print the visible element labels.
|
19
|
+
def labels
|
20
|
+
accessibility_marks(:label)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Print the visible element texts.
|
24
|
+
def text
|
25
|
+
text_marks
|
26
|
+
end
|
27
|
+
|
28
|
+
# List the visible element with all marks.
|
29
|
+
def marks
|
30
|
+
opts = {:print => false, :return => true }
|
31
|
+
res = accessibility_marks(:id, opts).each { |elm|elm << :id }
|
32
|
+
res.concat(accessibility_marks(:label, opts).each { |elm| elm << :label })
|
33
|
+
res.concat(text_marks(opts).each { |elm| elm << :text })
|
34
|
+
max_width = 0
|
35
|
+
res.each { |elm|
|
36
|
+
len = elm[0].length
|
37
|
+
max_width = len if len > max_width
|
38
|
+
}
|
39
|
+
|
40
|
+
counter = -1
|
41
|
+
res.sort.each { |elm|
|
42
|
+
printf("%4s %-6s => %#{max_width}s => %s\n",
|
43
|
+
"[#{counter = counter + 1}]",
|
44
|
+
elm[2], elm[0], elm[1])
|
45
|
+
}
|
46
|
+
true
|
47
|
+
end
|
48
|
+
|
49
|
+
# @!visibility private
|
50
|
+
#
|
51
|
+
# Users should not call this!!!
|
52
|
+
#
|
53
|
+
# Needs to be called in the .irbrc to ensure good `copy` behavior.
|
54
|
+
def self.start_readline_history!
|
55
|
+
require "irb"
|
56
|
+
file_name = IRB.conf[:HISTORY_FILE]
|
57
|
+
|
58
|
+
if File.exist?(file_name)
|
59
|
+
contents = File.read(file_name)
|
60
|
+
history = ConsoleHelpers.encode_utf8_or_raise(contents)
|
61
|
+
@@start_readline_history = history.split($-0)
|
62
|
+
else
|
63
|
+
@@start_readline_history = []
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Copy all the commands entered in the current console session into the OS
|
68
|
+
# Clipboard.
|
69
|
+
def copy
|
70
|
+
ConsoleHelpers.copy
|
71
|
+
end
|
72
|
+
|
73
|
+
# Clear the clipboard
|
74
|
+
def clear_clipboard
|
75
|
+
ConsoleHelpers.clear_clipboard!
|
76
|
+
end
|
77
|
+
|
78
|
+
# Clear the console history.
|
79
|
+
def clear
|
80
|
+
ConsoleHelpers.clear
|
81
|
+
end
|
82
|
+
|
83
|
+
# Print a message to the console.
|
84
|
+
def puts_message_of_the_day
|
85
|
+
messages = [
|
86
|
+
"Let's get this done!",
|
87
|
+
"Ready to rumble.",
|
88
|
+
"Enjoy.",
|
89
|
+
"Remember to breathe.",
|
90
|
+
"Take a deep breath.",
|
91
|
+
"Isn't it time for a break?",
|
92
|
+
"Can I get you a coffee?",
|
93
|
+
"What is a calabash anyway?",
|
94
|
+
"Smile! You are on camera!",
|
95
|
+
"Let op! Wild Rooster!",
|
96
|
+
"Don't touch that button!",
|
97
|
+
"I'm gonna take this to 11.",
|
98
|
+
"Console. Engaged.",
|
99
|
+
"Your wish is my command.",
|
100
|
+
"This console session was created just for you.",
|
101
|
+
"Den som jager to harer, får ingen.",
|
102
|
+
"Uti, non abuti.",
|
103
|
+
"Non Satis Scire",
|
104
|
+
"Nullius in verba",
|
105
|
+
"Det ka æn jå væer ei jált"
|
106
|
+
]
|
107
|
+
puts RunLoop::Color.green("Calabash says, \"#{messages.shuffle.first}\"")
|
108
|
+
end
|
109
|
+
|
110
|
+
# Turn on debug logging.
|
111
|
+
def verbose
|
112
|
+
if RunLoop::Environment.debug?
|
113
|
+
puts RunLoop::Color.cyan("Debug logging is already turned on.")
|
114
|
+
else
|
115
|
+
ENV["DEBUG"] = "1"
|
116
|
+
puts RunLoop::Color.cyan("Turned on debug logging.")
|
117
|
+
end
|
118
|
+
|
119
|
+
true
|
120
|
+
end
|
121
|
+
|
122
|
+
# Turn off debug logging.
|
123
|
+
def quiet
|
124
|
+
if RunLoop::Environment.debug?
|
125
|
+
ENV["DEBUG"] = "0"
|
126
|
+
puts RunLoop::Color.cyan("Turned off debug logging.")
|
127
|
+
else
|
128
|
+
puts RunLoop::Color.cyan("Debug logging is already turned off.")
|
129
|
+
end
|
130
|
+
|
131
|
+
true
|
132
|
+
end
|
133
|
+
|
134
|
+
# @!visibility private
|
135
|
+
def puts_console_details
|
136
|
+
puts ""
|
137
|
+
puts RunLoop::Color.magenta("######################### Useful Methods ##########################")
|
138
|
+
puts RunLoop::Color.cyan(" ids => List all the visible accessibility ids.")
|
139
|
+
puts RunLoop::Color.cyan(" labels => List all the visible accessibility labels.")
|
140
|
+
puts RunLoop::Color.cyan(" text => List all the visible texts.")
|
141
|
+
puts RunLoop::Color.cyan(" marks => List all the visible marks.")
|
142
|
+
puts RunLoop::Color.cyan(" tree => The app's visible view hierarchy.")
|
143
|
+
puts RunLoop::Color.cyan(" flash => flash(<query>); Disco effect for views matching <query>")
|
144
|
+
puts RunLoop::Color.cyan(" verbose => Turn debug logging on.")
|
145
|
+
puts RunLoop::Color.cyan(" quiet => Turn debug logging off.")
|
146
|
+
puts RunLoop::Color.cyan(" copy => Copy console commands to clipboard.")
|
147
|
+
puts RunLoop::Color.cyan(" clear => Clear the console.")
|
148
|
+
puts ""
|
149
|
+
end
|
150
|
+
|
151
|
+
private
|
152
|
+
|
153
|
+
# List the visible element with given mark(s).
|
154
|
+
# @param {Array} marks
|
155
|
+
# @param {Integer} max_width
|
156
|
+
def print_marks(marks, max_width)
|
157
|
+
counter = -1
|
158
|
+
marks.sort.each { |elm|
|
159
|
+
printf("%4s %#{max_width + 2}s => %s\n", "[#{counter = counter + 1}]", elm[0], elm[1])
|
160
|
+
}
|
161
|
+
end
|
162
|
+
|
163
|
+
# @!visibility private
|
164
|
+
# List the visible element with accessibility marks.
|
165
|
+
def accessibility_marks(kind, opts={})
|
166
|
+
merged_opts = {:print => true, :return => false}.merge(opts)
|
167
|
+
|
168
|
+
kinds = [:id, :label]
|
169
|
+
raise ArgumentError,
|
170
|
+
"'#{kind}' is not one of '#{kinds}'" unless kinds.include?(kind)
|
171
|
+
|
172
|
+
results = Array.new
|
173
|
+
max_width = 0
|
174
|
+
|
175
|
+
query("*").each { |view|
|
176
|
+
aid = view[kind.to_s]
|
177
|
+
unless aid.nil? or aid.eql?("")
|
178
|
+
cls = view["class"]
|
179
|
+
len = cls.length
|
180
|
+
max_width = len if len > max_width
|
181
|
+
results << [cls, aid]
|
182
|
+
end
|
183
|
+
}
|
184
|
+
|
185
|
+
if merged_opts[:print]
|
186
|
+
print_marks(results, max_width)
|
187
|
+
end
|
188
|
+
|
189
|
+
if merged_opts[:return]
|
190
|
+
results
|
191
|
+
else
|
192
|
+
true
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# @!visibility private
|
197
|
+
# List the visible element with text marks.
|
198
|
+
def text_marks(opts={})
|
199
|
+
merged_opts = {:print => true, :return => false}.merge(opts)
|
200
|
+
|
201
|
+
indexes = Array.new
|
202
|
+
idx = 0
|
203
|
+
all_texts = query("*", :text)
|
204
|
+
all_texts.each { |view|
|
205
|
+
indexes << idx unless view.eql?("*****") or view.eql?("")
|
206
|
+
idx = idx + 1
|
207
|
+
}
|
208
|
+
|
209
|
+
results = Array.new
|
210
|
+
|
211
|
+
all_views = query("*")
|
212
|
+
max_width = 0
|
213
|
+
indexes.each { |index|
|
214
|
+
view = all_views[index]
|
215
|
+
cls = view["class"]
|
216
|
+
text = all_texts[index]
|
217
|
+
len = cls.length
|
218
|
+
max_width = len if len > max_width
|
219
|
+
results << [cls, text]
|
220
|
+
}
|
221
|
+
|
222
|
+
if merged_opts[:print]
|
223
|
+
print_marks(results, max_width)
|
224
|
+
end
|
225
|
+
|
226
|
+
if merged_opts[:return]
|
227
|
+
results
|
228
|
+
else
|
229
|
+
true
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
def http_fetch_view_hierarchy
|
234
|
+
require "json"
|
235
|
+
response_body = http({:method => :get, :path => "dump"})
|
236
|
+
|
237
|
+
if response_body.nil? || response_body == ""
|
238
|
+
raise ResponseError,
|
239
|
+
"Server replied with an empty response. Your app has probably crashed"
|
240
|
+
end
|
241
|
+
|
242
|
+
begin
|
243
|
+
hash = JSON.parse(response_body)
|
244
|
+
rescue TypeError, JSON::ParserError => e
|
245
|
+
raise ResponseError, %Q{Could not parse server response:
|
246
|
+
|
247
|
+
#{e}
|
248
|
+
|
249
|
+
There was a problem parsing your app's view hierarchy.
|
250
|
+
|
251
|
+
Please report this issue.
|
252
|
+
}
|
253
|
+
end
|
254
|
+
|
255
|
+
hash
|
256
|
+
end
|
257
|
+
|
258
|
+
def dump_json_data(json_data)
|
259
|
+
json_data["children"].each {|child| write_child(child)}
|
260
|
+
end
|
261
|
+
|
262
|
+
def write_child(data, indentation=0)
|
263
|
+
render(data, indentation)
|
264
|
+
data["children"].each do |child|
|
265
|
+
write_child(child, indentation+1)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
def render(data, indentation)
|
270
|
+
if visible?(data)
|
271
|
+
type = data["type"]
|
272
|
+
|
273
|
+
str_type = if data["type"] == "dom"
|
274
|
+
"#{RunLoop::Color.cyan("[")}#{type}:#{RunLoop::Color.cyan("#{data["nodeName"]}]")} "
|
275
|
+
else
|
276
|
+
RunLoop::Color.cyan("[#{type}] ")
|
277
|
+
end
|
278
|
+
|
279
|
+
str_id = data["id"] ? "[id:#{RunLoop::Color.blue(data["id"])}] " : ""
|
280
|
+
str_label = data["label"] ? "[label:#{RunLoop::Color.green(data["label"])}] " : ""
|
281
|
+
str_text = data["value"] ? "[text:#{RunLoop::Color.magenta(data["value"])}] " : ""
|
282
|
+
output("#{str_type}#{str_id}#{str_label}#{str_text}", indentation)
|
283
|
+
output("\n", indentation)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
def visible?(data)
|
288
|
+
(data["visible"] == 1) || data["children"].map{|child| visible?(child)}.any?
|
289
|
+
end
|
290
|
+
|
291
|
+
def output(string, indentation)
|
292
|
+
(indentation*2).times {print " "}
|
293
|
+
print "#{string}"
|
294
|
+
end
|
295
|
+
|
296
|
+
# @!visibility private
|
297
|
+
def self.copy
|
298
|
+
require "clipboard"
|
299
|
+
history = ConsoleHelpers.current_console_history
|
300
|
+
commands = ConsoleHelpers.filter_commands(history)
|
301
|
+
string = commands.join($-0)
|
302
|
+
Clipboard.copy(string)
|
303
|
+
true
|
304
|
+
end
|
305
|
+
|
306
|
+
# @!visibility private
|
307
|
+
def self.clear_clipboard!
|
308
|
+
require "clipboard"
|
309
|
+
@@start_readline_history = ConsoleHelpers.readline_history
|
310
|
+
Clipboard.clear
|
311
|
+
true
|
312
|
+
end
|
313
|
+
|
314
|
+
# @!visibility private
|
315
|
+
def self.clear
|
316
|
+
if RunLoop::Environment.windows_env?
|
317
|
+
ConsoleHelpers.system_clear("cls")
|
318
|
+
else
|
319
|
+
ConsoleHelpers.system_clear("clear")
|
320
|
+
end
|
321
|
+
true
|
322
|
+
end
|
323
|
+
|
324
|
+
# @!visibility private
|
325
|
+
def self.system_clear(command)
|
326
|
+
system(command)
|
327
|
+
end
|
328
|
+
|
329
|
+
# @!visibility private
|
330
|
+
def self.current_console_history
|
331
|
+
readline_history = ConsoleHelpers.readline_history
|
332
|
+
length = readline_history.length - @@start_readline_history.length
|
333
|
+
|
334
|
+
readline_history.last(length)
|
335
|
+
end
|
336
|
+
|
337
|
+
# @!visibility private
|
338
|
+
FILTER_REGEX = Regexp.union(/\s*tree(\(|\z)/,
|
339
|
+
/\s*flash(\(|\z)/,
|
340
|
+
/\s*ids(\(|\z)/,
|
341
|
+
/\s*labels(\(|\z)/,
|
342
|
+
/\s*text(\(|\z)/,
|
343
|
+
/\s*marks(\(|\z)/,
|
344
|
+
/\s*verbose(\(|\z)/,
|
345
|
+
/\s*quiet(\(|\z)/,
|
346
|
+
/\s*clear(\(|\z)/,
|
347
|
+
/\s*clear_clipboard(\(|\z)/,
|
348
|
+
/\s*copy(\(|\z)/,
|
349
|
+
/\s*start_test_server_in_background(\(|\z)/,
|
350
|
+
/\s*exit(\(|\z)/)
|
351
|
+
|
352
|
+
# @!visibility private
|
353
|
+
def self.filter_commands(commands)
|
354
|
+
commands.reject {|command| command =~ FILTER_REGEX}
|
355
|
+
end
|
356
|
+
|
357
|
+
# @!visibility private
|
358
|
+
def self.readline_history
|
359
|
+
require "readline"
|
360
|
+
Readline::HISTORY.to_a
|
361
|
+
end
|
362
|
+
|
363
|
+
# @!visibility private
|
364
|
+
def self.encode_utf8_or_raise(string)
|
365
|
+
return "" if !string
|
366
|
+
|
367
|
+
utf8 = string.force_encoding("UTF-8").chomp
|
368
|
+
|
369
|
+
return utf8 if utf8.valid_encoding?
|
370
|
+
|
371
|
+
encoded = utf8.encode("UTF-8", "UTF-8",
|
372
|
+
invalid: :replace, undef: :replace, replace: "")
|
373
|
+
|
374
|
+
return encoded if encoded.valid_encoding?
|
375
|
+
|
376
|
+
raise RuntimeError, %Q{
|
377
|
+
Could not force UTF-8 encoding on this string:
|
378
|
+
|
379
|
+
#{string}
|
380
|
+
|
381
|
+
Please file an issue with a stacktrace and the text of this error.
|
382
|
+
|
383
|
+
https://github.com/calabash/calabash-ios/issues
|
384
|
+
}
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end
|
@@ -17,18 +17,22 @@ module Calabash
|
|
17
17
|
# A collection of methods that provide the core calabash behaviors.
|
18
18
|
module Core
|
19
19
|
|
20
|
+
require "calabash-cucumber/map"
|
20
21
|
include Calabash::Cucumber::EnvironmentHelpers
|
21
22
|
include Calabash::Cucumber::ConnectionHelpers
|
22
23
|
include Calabash::Cucumber::QueryHelpers
|
23
24
|
include Calabash::Cucumber::FailureHelpers
|
24
|
-
include Calabash::Cucumber::Map
|
25
25
|
include Calabash::Cucumber::UIA
|
26
26
|
include Calabash::Cucumber::StatusBarHelpers
|
27
27
|
include Calabash::Cucumber::RotationHelpers
|
28
28
|
|
29
29
|
# @!visibility private
|
30
|
-
# @deprecated Use Cucumber's step method
|
30
|
+
# @deprecated Use Cucumber's step method.
|
31
|
+
#
|
32
|
+
# Using `step` is not considered a best practice.
|
33
|
+
#
|
31
34
|
# Used in older cucumber versions that didn't have the `step` method.
|
35
|
+
#
|
32
36
|
# Shouldn't be used anymore.
|
33
37
|
def macro(txt)
|
34
38
|
if self.respond_to? :step
|
@@ -139,7 +143,7 @@ module Calabash
|
|
139
143
|
# @param [Array] args optional var-args list describing a chain of method selectors.
|
140
144
|
# Full details {http://developer.xamarin.com/guides/testcloud/calabash/calabash-query-syntax/ Query Syntax}.
|
141
145
|
def query(uiquery, *args)
|
142
|
-
map(uiquery, :query, *args)
|
146
|
+
Map.map(uiquery, :query, *args)
|
143
147
|
end
|
144
148
|
|
145
149
|
# Shorthand alias for `query`.
|
@@ -160,7 +164,7 @@ module Calabash
|
|
160
164
|
def flash(uiquery, *args)
|
161
165
|
# todo deprecate the *args argument in the flash method
|
162
166
|
# todo :flash operation should return views as JSON objects
|
163
|
-
map(uiquery, :flash, *args).compact
|
167
|
+
Map.map(uiquery, :flash, *args).compact
|
164
168
|
end
|
165
169
|
|
166
170
|
# Returns the version of the running calabash server.
|
@@ -410,9 +414,9 @@ module Calabash
|
|
410
414
|
raise ArgumentError, "Expected '#{direction} to be one of #{allowed_directions}"
|
411
415
|
end
|
412
416
|
|
413
|
-
views_touched=map(uiquery, :scroll, dir_symbol)
|
417
|
+
views_touched = Map.map(uiquery, :scroll, dir_symbol)
|
414
418
|
msg = "could not find view to scroll: '#{uiquery}', args: #{dir_symbol}"
|
415
|
-
assert_map_results(views_touched, msg)
|
419
|
+
Map.assert_map_results(views_touched, msg)
|
416
420
|
views_touched
|
417
421
|
end
|
418
422
|
|
@@ -425,9 +429,9 @@ module Calabash
|
|
425
429
|
#
|
426
430
|
# @param {String} uiquery query describing view scroll (should be UIScrollView or a web view).
|
427
431
|
def scroll_to_row(uiquery, number)
|
428
|
-
views_touched=map(uiquery, :scrollToRow, number)
|
432
|
+
views_touched = Map.map(uiquery, :scrollToRow, number)
|
429
433
|
msg = "unable to scroll: '#{uiquery}' to: #{number}"
|
430
|
-
assert_map_results(views_touched, msg)
|
434
|
+
Map.assert_map_results(views_touched, msg)
|
431
435
|
views_touched
|
432
436
|
end
|
433
437
|
|
@@ -468,9 +472,9 @@ module Calabash
|
|
468
472
|
if options.has_key?(:animate)
|
469
473
|
args << options[:animate]
|
470
474
|
end
|
471
|
-
views_touched=map(uiquery, :scrollToRow, row.to_i, sec.to_i, *args)
|
475
|
+
views_touched = Map.map(uiquery, :scrollToRow, row.to_i, sec.to_i, *args)
|
472
476
|
msg = "unable to scroll: '#{uiquery}' to '#{options}'"
|
473
|
-
assert_map_results(views_touched, msg)
|
477
|
+
Map.assert_map_results(views_touched, msg)
|
474
478
|
views_touched
|
475
479
|
end
|
476
480
|
|
@@ -517,9 +521,9 @@ module Calabash
|
|
517
521
|
args << options[:animate]
|
518
522
|
end
|
519
523
|
|
520
|
-
views_touched=map(uiquery, :scrollToRowWithMark, mark, *args)
|
524
|
+
views_touched = Map.map(uiquery, :scrollToRowWithMark, mark, *args)
|
521
525
|
msg = options[:failed_message] || "Unable to scroll: '#{uiquery}' to: #{options}"
|
522
|
-
assert_map_results(views_touched, msg)
|
526
|
+
Map.assert_map_results(views_touched, msg)
|
523
527
|
views_touched
|
524
528
|
end
|
525
529
|
|
@@ -574,7 +578,9 @@ module Calabash
|
|
574
578
|
|
575
579
|
animate = opts[:animate]
|
576
580
|
|
577
|
-
views_touched=map(uiquery, :collectionViewScroll,
|
581
|
+
views_touched = Map.map(uiquery, :collectionViewScroll,
|
582
|
+
item.to_i, section.to_i,
|
583
|
+
scroll_position, animate)
|
578
584
|
|
579
585
|
if opts[:failed_message]
|
580
586
|
msg = opts[:failed_message]
|
@@ -582,7 +588,7 @@ module Calabash
|
|
582
588
|
msg = "unable to scroll: '#{uiquery}' to item '#{item}' in section '#{section}'"
|
583
589
|
end
|
584
590
|
|
585
|
-
assert_map_results(views_touched, msg)
|
591
|
+
Map.assert_map_results(views_touched, msg)
|
586
592
|
views_touched
|
587
593
|
end
|
588
594
|
|
@@ -640,9 +646,11 @@ module Calabash
|
|
640
646
|
args << scroll_position
|
641
647
|
args << opts[:animate]
|
642
648
|
|
643
|
-
views_touched=map(uiquery, :collectionViewScrollToItemWithMark,
|
649
|
+
views_touched = Map.map(uiquery, :collectionViewScrollToItemWithMark,
|
650
|
+
mark, *args)
|
651
|
+
|
644
652
|
msg = opts[:failed_message] || "Unable to scroll: '#{uiquery}' to cell with mark: '#{mark}' with #{opts}"
|
645
|
-
assert_map_results(views_touched, msg)
|
653
|
+
Map.assert_map_results(views_touched, msg)
|
646
654
|
views_touched
|
647
655
|
end
|
648
656
|
|
@@ -758,17 +766,6 @@ details => '#{result["details"]}'
|
|
758
766
|
Geocoder.search(place)
|
759
767
|
end
|
760
768
|
|
761
|
-
# @!visibility private
|
762
|
-
def move_wheel(opts={})
|
763
|
-
q = opts[:query] || 'pickerView'
|
764
|
-
wheel = opts[:wheel] || 0
|
765
|
-
dir = opts[:dir] || :down
|
766
|
-
|
767
|
-
raise 'Wheel index must be non negative' if wheel < 0
|
768
|
-
raise "Only up and down supported :dir (#{dir})" unless [:up, :down].include?(dir)
|
769
|
-
raise NotImplementedError
|
770
|
-
end
|
771
|
-
|
772
769
|
# @!visibility private
|
773
770
|
def picker(opts={:query => 'pickerView', :action => :texts})
|
774
771
|
raise 'Not implemented' unless opts[:action] == :texts
|
@@ -830,10 +827,10 @@ details => '#{result["details"]}'
|
|
830
827
|
value_str = value.to_s
|
831
828
|
|
832
829
|
args = [merged_options[:animate], merged_options[:notify_targets]]
|
833
|
-
views_touched = map(uiquery, :changeSlider, value_str, *args)
|
830
|
+
views_touched = Map.map(uiquery, :changeSlider, value_str, *args)
|
834
831
|
|
835
832
|
msg = "Could not set value of slider to '#{value}' using query '#{uiquery}'"
|
836
|
-
assert_map_results(views_touched, msg)
|
833
|
+
Map.assert_map_results(views_touched, msg)
|
837
834
|
views_touched
|
838
835
|
end
|
839
836
|
|
@@ -849,7 +846,7 @@ details => '#{result["details"]}'
|
|
849
846
|
# trailing ":"
|
850
847
|
#
|
851
848
|
# @param [String] selector the selector to perform on the app delegate
|
852
|
-
# @param [Object]
|
849
|
+
# @param [Object] arguments the arguments to pass to the selector
|
853
850
|
# @return [Object] the result of performing the selector with the argument
|
854
851
|
def backdoor(selector, *arguments)
|
855
852
|
parameters = {
|
@@ -1075,10 +1072,10 @@ arguments => '#{arguments}'
|
|
1075
1072
|
#
|
1076
1073
|
# @return [Array<String>] The text fields that were modified.
|
1077
1074
|
def set_text(uiquery, txt)
|
1078
|
-
text_fields_modified = map(uiquery, :setText, txt)
|
1075
|
+
text_fields_modified = Map.map(uiquery, :setText, txt)
|
1079
1076
|
|
1080
1077
|
msg = "query '#{uiquery}' returned no matching views that respond to 'setText'"
|
1081
|
-
assert_map_results(text_fields_modified, msg)
|
1078
|
+
Map.assert_map_results(text_fields_modified, msg)
|
1082
1079
|
text_fields_modified
|
1083
1080
|
end
|
1084
1081
|
|
@@ -1095,9 +1092,9 @@ arguments => '#{arguments}'
|
|
1095
1092
|
#
|
1096
1093
|
# @return [Array<String>] The text fields that were modified.
|
1097
1094
|
def clear_text(uiquery)
|
1098
|
-
views_modified = map(uiquery, :setText, '')
|
1095
|
+
views_modified = Map.map(uiquery, :setText, '')
|
1099
1096
|
msg = "query '#{uiquery}' returned no matching views that respond to 'setText'"
|
1100
|
-
assert_map_results(views_modified, msg)
|
1097
|
+
Map.assert_map_results(views_modified, msg)
|
1101
1098
|
views_modified
|
1102
1099
|
end
|
1103
1100
|
|
@@ -1222,7 +1219,7 @@ arguments => '#{arguments}'
|
|
1222
1219
|
views_touched = launcher.actions.send(action, options)
|
1223
1220
|
unless uiquery.nil?
|
1224
1221
|
msg = "#{action} could not find view: '#{uiquery}', args: #{options}"
|
1225
|
-
assert_map_results(views_touched, msg)
|
1222
|
+
Map.assert_map_results(views_touched, msg)
|
1226
1223
|
end
|
1227
1224
|
views_touched
|
1228
1225
|
end
|
@@ -281,9 +281,10 @@ module Calabash
|
|
281
281
|
args = args_for_change_date_on_picker options
|
282
282
|
query_str = query_string_for_picker picker_id
|
283
283
|
|
284
|
-
views_touched = map(query_str, :changeDatePickerDate, target_str,
|
284
|
+
views_touched = Map.map(query_str, :changeDatePickerDate, target_str,
|
285
|
+
fmt_str, *args)
|
285
286
|
msg = "could not change date on picker to '#{target_dt}' using query '#{query_str}' with options '#{options}'"
|
286
|
-
assert_map_results(views_touched,msg)
|
287
|
+
Map.assert_map_results(views_touched,msg)
|
287
288
|
views_touched
|
288
289
|
end
|
289
290
|
end
|
@@ -292,10 +292,11 @@ Resetting physical devices is not supported.
|
|
292
292
|
|
293
293
|
options = launch_options.clone
|
294
294
|
|
295
|
-
# Reusing
|
295
|
+
# Reusing Simctl, Instruments, and Xcode can speed up launches.
|
296
296
|
options[:simctl] = simctl || Calabash::Cucumber::Environment.simctl
|
297
297
|
options[:instruments] = instruments || Calabash::Cucumber::Environment.instruments
|
298
298
|
options[:xcode] = xcode || Calabash::Cucumber::Environment.xcode
|
299
|
+
options[:inject_dylib] = detect_inject_dylib_option(launch_options)
|
299
300
|
|
300
301
|
self.launch_args = options
|
301
302
|
|
@@ -507,6 +508,25 @@ true. Please remove this method call from your hooks.
|
|
507
508
|
# The version of the embedded LPServer
|
508
509
|
# @return RunLoop::Version
|
509
510
|
attr_reader :server_version
|
511
|
+
|
512
|
+
# @!visibility private
|
513
|
+
#
|
514
|
+
# @param [Hash] options the launch options passed by the user
|
515
|
+
def detect_inject_dylib_option(options)
|
516
|
+
return nil if !options[:inject_dylib]
|
517
|
+
|
518
|
+
value = options[:inject_dylib]
|
519
|
+
|
520
|
+
# Test for boolean true.
|
521
|
+
if [true].include?(value)
|
522
|
+
# Injection is only supported on simulators, so this cool for now.
|
523
|
+
# Depend on run-loop to raise an error.
|
524
|
+
Calabash::Cucumber::Dylibs.path_to_sim_dylib
|
525
|
+
else
|
526
|
+
# User supplied a path
|
527
|
+
value
|
528
|
+
end
|
529
|
+
end
|
510
530
|
end
|
511
531
|
end
|
512
532
|
end
|
@@ -1,10 +1,15 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
1
|
module Calabash
|
4
2
|
module Cucumber
|
5
3
|
|
6
4
|
# @!visibility private
|
7
|
-
|
5
|
+
class Map
|
6
|
+
|
7
|
+
require "json"
|
8
|
+
require "calabash-cucumber/http_helpers"
|
9
|
+
require "calabash-cucumber/failure_helpers"
|
10
|
+
|
11
|
+
include Calabash::Cucumber::HTTPHelpers
|
12
|
+
include Calabash::Cucumber::FailureHelpers
|
8
13
|
|
9
14
|
# Returns an array of views matched by the `query` or the result of
|
10
15
|
# performing the Objective-C sequence defined by the `method_name` and
|
@@ -49,8 +54,8 @@ module Calabash
|
|
49
54
|
# Well behaved LPOperations should return the view as JSON objects.
|
50
55
|
#
|
51
56
|
# @todo Calabash LPOperations should return 'views touched' in JSON format
|
52
|
-
def map(query, method_name, *method_args)
|
53
|
-
raw_map(query, method_name, *method_args)['results']
|
57
|
+
def self.map(query, method_name, *method_args)
|
58
|
+
self.raw_map(query, method_name, *method_args)['results']
|
54
59
|
end
|
55
60
|
|
56
61
|
# Returns a JSON object the represents the result of performing an http
|
@@ -70,17 +75,24 @@ module Calabash
|
|
70
75
|
# the `method_name` with arguments defined in
|
71
76
|
# `method_args` on all views matched by the `query`
|
72
77
|
#
|
73
|
-
# @see
|
74
|
-
def raw_map(query, method_name, *method_args)
|
78
|
+
# @see map for examples.
|
79
|
+
def self.raw_map(query, method_name, *method_args)
|
75
80
|
operation_map = {
|
76
81
|
:method_name => method_name,
|
77
82
|
:arguments => method_args
|
78
83
|
}
|
79
|
-
|
80
|
-
|
84
|
+
|
85
|
+
res = Map.new.http({:method => :post, :path => 'map'},
|
86
|
+
{:query => query, :operation => operation_map})
|
81
87
|
res = JSON.parse(res)
|
82
88
|
if res['outcome'] != 'SUCCESS'
|
83
|
-
|
89
|
+
message = %Q[
|
90
|
+
map #{query}, #{method_name} failed for:
|
91
|
+
|
92
|
+
reason: #{res["reason"]}
|
93
|
+
details: #{res["details"]}
|
94
|
+
]
|
95
|
+
Map.new.screenshot_and_raise(message)
|
84
96
|
end
|
85
97
|
|
86
98
|
res
|
@@ -121,10 +133,10 @@ module Calabash
|
|
121
133
|
# Here a <tt>[ nil ]</tt> should be considered invalid because the
|
122
134
|
# the operation could not be performed because there is not row that
|
123
135
|
# matches `mark`
|
124
|
-
def assert_map_results(map_results, msg)
|
136
|
+
def self.assert_map_results(map_results, msg)
|
125
137
|
compact = map_results.compact
|
126
138
|
if compact.empty? or compact.member? '<VOID>' or compact.member? '*****'
|
127
|
-
screenshot_and_raise msg
|
139
|
+
Map.new.screenshot_and_raise msg
|
128
140
|
end
|
129
141
|
end
|
130
142
|
end
|
@@ -21,7 +21,7 @@ module Calabash
|
|
21
21
|
# @return [Symbol] Returns the device orientation as one of
|
22
22
|
# `{:down, :up, :left, :right}`.
|
23
23
|
def device_orientation(force_down=false)
|
24
|
-
res = map(nil, :orientation, :device).first
|
24
|
+
res = Map.map(nil, :orientation, :device).first
|
25
25
|
|
26
26
|
if ['face up', 'face down'].include?(res)
|
27
27
|
if force_down
|
@@ -47,7 +47,7 @@ module Calabash
|
|
47
47
|
# @return [String] Returns the device orientation as one of
|
48
48
|
# `{'down' | 'up' | 'left' | 'right'}`.
|
49
49
|
def status_bar_orientation
|
50
|
-
map(nil, :orientation, :status_bar).first
|
50
|
+
Map.map(nil, :orientation, :status_bar).first
|
51
51
|
end
|
52
52
|
|
53
53
|
# Is the device in the portrait orientation?
|
data/scripts/.irbrc
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require "irb/completion"
|
2
|
+
require "irb/ext/save-history"
|
3
|
+
require "benchmark"
|
4
|
+
|
5
|
+
begin
|
6
|
+
require "awesome_print"
|
7
|
+
rescue LoadError => e
|
8
|
+
puts %Q[
|
9
|
+
Caught a LoadError: could not load 'awesome_print'",
|
10
|
+
|
11
|
+
#{e}
|
12
|
+
|
13
|
+
Use bundler (recommended) or uninstall awesome_print.
|
14
|
+
|
15
|
+
# Use bundler (recommended)
|
16
|
+
$ bundle update
|
17
|
+
$ bundle exec calabash-ios console
|
18
|
+
|
19
|
+
# Uninstall awesome_print and reinstall calabash-cucumber
|
20
|
+
$ gem update --system
|
21
|
+
$ gem uninstall -Vax --force --no-abort-on-dependent awesome_print
|
22
|
+
$ gem install calabash-cucumber
|
23
|
+
|
24
|
+
]
|
25
|
+
exit(1)
|
26
|
+
end
|
27
|
+
|
28
|
+
AwesomePrint.irb!
|
29
|
+
|
30
|
+
ARGV.concat ["--readline", "--prompt-mode", "simple"]
|
31
|
+
|
32
|
+
IRB.conf[:SAVE_HISTORY] = 100
|
33
|
+
IRB.conf[:HISTORY_FILE] = ".irb-history"
|
34
|
+
|
35
|
+
begin
|
36
|
+
require "pry"
|
37
|
+
Pry.config.history.should_save = false
|
38
|
+
Pry.config.history.should_load = false
|
39
|
+
require "pry-nav"
|
40
|
+
rescue LoadError => _
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def embed(x,y=nil,z=nil)
|
45
|
+
puts "Screenshot at #{x}"
|
46
|
+
end
|
47
|
+
|
48
|
+
require "calabash-cucumber"
|
49
|
+
|
50
|
+
IRB.conf[:AUTO_INDENT] = true
|
51
|
+
|
52
|
+
IRB.conf[:PROMPT][:CALABASH_IOS] = {
|
53
|
+
:PROMPT_I => "calabash-ios #{Calabash::Cucumber::VERSION}> ",
|
54
|
+
:PROMPT_N => "calabash-ios #{Calabash::Cucumber::VERSION}> ",
|
55
|
+
:PROMPT_S => nil,
|
56
|
+
:PROMPT_C => "> ",
|
57
|
+
:AUTO_INDENT => false,
|
58
|
+
:RETURN => "%s\n"
|
59
|
+
}
|
60
|
+
|
61
|
+
IRB.conf[:PROMPT_MODE] = :CALABASH_IOS
|
62
|
+
|
63
|
+
require "calabash-cucumber/operations"
|
64
|
+
extend Calabash::Cucumber::Operations
|
65
|
+
|
66
|
+
require "calabash-cucumber/console_helpers"
|
67
|
+
include Calabash::Cucumber::ConsoleHelpers
|
68
|
+
Calabash::Cucumber::ConsoleHelpers.start_readline_history!
|
69
|
+
|
70
|
+
def preferences
|
71
|
+
Calabash::Cucumber::Preferences.new
|
72
|
+
end
|
73
|
+
|
74
|
+
def disable_usage_tracking
|
75
|
+
preferences.usage_tracking = "none"
|
76
|
+
puts "Calabash will not collect usage information."
|
77
|
+
"none"
|
78
|
+
end
|
79
|
+
|
80
|
+
def enable_usage_tracking(level="system_info")
|
81
|
+
preferences.usage_tracking = level
|
82
|
+
puts "Calabash will collect statistics using the '#{level}' rule."
|
83
|
+
level
|
84
|
+
end
|
85
|
+
|
86
|
+
puts_console_details
|
87
|
+
puts_message_of_the_day
|
Binary file
|
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.19.0.
|
4
|
+
version: 0.19.0.pre3
|
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-04-
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -113,35 +113,41 @@ dependencies:
|
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '1.3'
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
|
-
name:
|
116
|
+
name: clipboard
|
117
117
|
requirement: !ruby/object:Gem::Requirement
|
118
118
|
requirements:
|
119
|
-
- -
|
119
|
+
- - "~>"
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version:
|
121
|
+
version: '1.0'
|
122
122
|
type: :runtime
|
123
123
|
prerelease: false
|
124
124
|
version_requirements: !ruby/object:Gem::Requirement
|
125
125
|
requirements:
|
126
|
-
- -
|
126
|
+
- - "~>"
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
128
|
+
version: '1.0'
|
129
129
|
- !ruby/object:Gem::Dependency
|
130
|
-
name:
|
130
|
+
name: run_loop
|
131
131
|
requirement: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
135
|
+
version: 2.1.1
|
136
|
+
- - "<"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.0'
|
136
139
|
type: :runtime
|
137
140
|
prerelease: false
|
138
141
|
version_requirements: !ruby/object:Gem::Requirement
|
139
142
|
requirements:
|
140
143
|
- - ">="
|
141
144
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
145
|
+
version: 2.1.1
|
146
|
+
- - "<"
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '3.0'
|
143
149
|
- !ruby/object:Gem::Dependency
|
144
|
-
name:
|
150
|
+
name: json
|
145
151
|
requirement: !ruby/object:Gem::Requirement
|
146
152
|
requirements:
|
147
153
|
- - ">="
|
@@ -336,6 +342,20 @@ dependencies:
|
|
336
342
|
- - ">="
|
337
343
|
- !ruby/object:Gem::Version
|
338
344
|
version: '0'
|
345
|
+
- !ruby/object:Gem::Dependency
|
346
|
+
name: oj
|
347
|
+
requirement: !ruby/object:Gem::Requirement
|
348
|
+
requirements:
|
349
|
+
- - "~>"
|
350
|
+
- !ruby/object:Gem::Version
|
351
|
+
version: '2.0'
|
352
|
+
type: :development
|
353
|
+
prerelease: false
|
354
|
+
version_requirements: !ruby/object:Gem::Requirement
|
355
|
+
requirements:
|
356
|
+
- - "~>"
|
357
|
+
- !ruby/object:Gem::Version
|
358
|
+
version: '2.0'
|
339
359
|
description: calabash-cucumber drives tests for native iOS apps. You must link your
|
340
360
|
app with calabash-ios-server framework to execute tests.
|
341
361
|
email:
|
@@ -371,6 +391,7 @@ files:
|
|
371
391
|
- lib/calabash-cucumber/calabash_steps.rb
|
372
392
|
- lib/calabash-cucumber/connection.rb
|
373
393
|
- lib/calabash-cucumber/connection_helpers.rb
|
394
|
+
- lib/calabash-cucumber/console_helpers.rb
|
374
395
|
- lib/calabash-cucumber/core.rb
|
375
396
|
- lib/calabash-cucumber/cucumber.rb
|
376
397
|
- lib/calabash-cucumber/date_picker.rb
|
@@ -401,6 +422,7 @@ files:
|
|
401
422
|
- lib/calabash-cucumber/wait_helpers.rb
|
402
423
|
- lib/calabash/formatters/html.rb
|
403
424
|
- lib/frank-calabash.rb
|
425
|
+
- scripts/.irbrc
|
404
426
|
- scripts/calabash.xcconfig.erb
|
405
427
|
- scripts/data/clients.plist
|
406
428
|
- scripts/data/com.apple.Accessibility-5.1.plist
|