calabash-cucumber 0.9.163.pre11 → 0.9.163
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-setup.rb +2 -2
- data/calabash-cucumber.gemspec +2 -2
- data/features/step_definitions/calabash_steps.rb +7 -10
- data/lib/calabash-cucumber.rb +1 -2
- data/lib/calabash-cucumber/core.rb +31 -34
- data/lib/calabash-cucumber/device.rb +8 -5
- data/lib/calabash-cucumber/environment_helpers.rb +205 -0
- data/lib/calabash-cucumber/failure_helpers.rb +9 -6
- data/lib/calabash-cucumber/ios7_operations.rb +8 -11
- data/lib/calabash-cucumber/keyboard_helpers.rb +628 -67
- data/lib/calabash-cucumber/launch/simulator_helper.rb +4 -1
- data/lib/calabash-cucumber/launcher.rb +6 -3
- data/lib/calabash-cucumber/operations.rb +7 -4
- data/lib/calabash-cucumber/playback_helpers.rb +11 -8
- data/lib/calabash-cucumber/rotation_helpers.rb +8 -8
- data/lib/calabash-cucumber/status_bar_helpers.rb +15 -3
- data/lib/calabash-cucumber/uia.rb +13 -6
- data/lib/calabash-cucumber/version.rb +2 -2
- metadata +9 -8
@@ -78,6 +78,9 @@ module Calabash
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
# todo analyze `self.derived_data_dir_for_project` to see if it contains dead code
|
82
|
+
# todo assuming this is not dead code, the documentation around derived data for project needs to be updated
|
83
|
+
|
81
84
|
if (build_dirs.count == 0)
|
82
85
|
msg = ["Unable to find your built app."]
|
83
86
|
msg << "This means that Calabash can't automatically launch iOS simulator."
|
@@ -154,7 +157,7 @@ module Calabash
|
|
154
157
|
sim_dirs = Dir.glob(File.join(dd_dir, "Build", "Products", "*-iphonesimulator", "*.app"))
|
155
158
|
if sim_dirs.empty?
|
156
159
|
msg = ["Unable to auto detect APP_BUNDLE_PATH."]
|
157
|
-
msg << "Have you built your app for simulator
|
160
|
+
msg << "Have you built your app for simulator?"
|
158
161
|
msg << "Searched dir: #{dd_dir}/Build/Products"
|
159
162
|
msg << "Please build your app from Xcode"
|
160
163
|
msg << "You should build the -cal target."
|
@@ -46,6 +46,11 @@ class Calabash::Cucumber::Launcher
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def attach(max_retry=1, timeout=10)
|
49
|
+
if calabash_no_launch?
|
50
|
+
self.actions= Calabash::Cucumber::PlaybackActions.new
|
51
|
+
return
|
52
|
+
end
|
53
|
+
|
49
54
|
pids_str = `ps x -o pid,command | grep -v grep | grep "instruments" | awk '{printf "%s,", $1}'`
|
50
55
|
pids = pids_str.split(',').map { |pid| pid.to_i }
|
51
56
|
pid = pids.first
|
@@ -93,8 +98,6 @@ class Calabash::Cucumber::Launcher
|
|
93
98
|
@@launcher = self
|
94
99
|
end
|
95
100
|
|
96
|
-
|
97
|
-
|
98
101
|
def ios_major_version
|
99
102
|
return nil if device.nil? or device.ios_version.nil?
|
100
103
|
device.ios_major_version
|
@@ -129,7 +132,7 @@ class Calabash::Cucumber::Launcher
|
|
129
132
|
Dir["#{ENV['HOME']}/Library/Application Support/iPhone Simulator/#{sdk}*"]
|
130
133
|
end
|
131
134
|
|
132
|
-
# Call as update_privacy_settings('com.my.app', {:
|
135
|
+
# Call as update_privacy_settings('com.my.app', {:photos => {:allow => true}})
|
133
136
|
def update_privacy_settings(bundle_id, opts={})
|
134
137
|
if ENV['DEBUG']=='1'
|
135
138
|
puts "Update privacy settings #{bundle_id}, #{opts}"
|
@@ -66,10 +66,13 @@ module Calabash
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def set_text(uiquery, txt)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
msgs = ["'set_text' will be deprecated.",
|
70
|
+
"* to enter text using the native keyboard use 'keyboard_enter_text'",
|
71
|
+
"* to clear a text field or text view use 'clear_text'",
|
72
|
+
'https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS-Ruby-API']
|
73
|
+
msg = msgs.join("\n")
|
74
|
+
_deprecated('0.9.145', msg, :warn)
|
75
|
+
|
73
76
|
text_fields_modified = map(uiquery, :setText, txt)
|
74
77
|
screenshot_and_raise "could not find text field #{uiquery}" if text_fields_modified.empty?
|
75
78
|
text_fields_modified
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
module Calabash
|
2
3
|
module Cucumber
|
3
4
|
module PlaybackHelpers
|
@@ -5,7 +6,8 @@ module Calabash
|
|
5
6
|
DATA_PATH = File.expand_path(File.dirname(__FILE__))
|
6
7
|
|
7
8
|
def recording_name_for(recording_name, os, device)
|
8
|
-
|
9
|
+
#noinspection RubyControlFlowConversionInspection
|
10
|
+
if !recording_name.end_with? '.base64'
|
9
11
|
"#{recording_name}_#{os}_#{device}.base64"
|
10
12
|
else
|
11
13
|
recording_name
|
@@ -38,8 +40,8 @@ module Calabash
|
|
38
40
|
end
|
39
41
|
|
40
42
|
def load_playback_data(recording_name, options={})
|
41
|
-
os = options[
|
42
|
-
device = options[
|
43
|
+
os = options['OS'] || ENV['OS']
|
44
|
+
device = options['DEVICE'] || ENV['DEVICE'] || 'iphone'
|
43
45
|
|
44
46
|
unless os
|
45
47
|
if @calabash_launcher && @calabash_launcher.active?
|
@@ -98,6 +100,7 @@ EOF
|
|
98
100
|
recording = recording_name_for(recording_name, loop_os, device)
|
99
101
|
candidates << recording
|
100
102
|
data = load_recording(recording, rec_dir)
|
103
|
+
#noinspection RubyControlFlowConversionInspection
|
101
104
|
break if !data.nil?
|
102
105
|
end
|
103
106
|
end
|
@@ -113,7 +116,7 @@ EOF
|
|
113
116
|
post_data<< %Q|,"reverse":#{options[:reverse]}| if options[:reverse]
|
114
117
|
post_data<< %Q|,"uia_gesture":"#{options[:uia_gesture]}"| if options[:uia_gesture]
|
115
118
|
post_data<< %Q|,"prototype":"#{options[:prototype]}"| if options[:prototype]
|
116
|
-
post_data <<
|
119
|
+
post_data << '}'
|
117
120
|
|
118
121
|
res = http({:method => :post, :raw => true, :path => 'play'}, post_data)
|
119
122
|
|
@@ -132,7 +135,7 @@ EOF
|
|
132
135
|
post_data<< %Q|,"end":"#{escape_quotes(options[:end])}"| if options[:end]
|
133
136
|
post_data<< %Q|,"offset_start":#{options[:offset_start].to_json}| if options[:offset_start]
|
134
137
|
post_data<< %Q|,"offset_end":#{options[:offset_end].to_json}| if options[:offset_end]
|
135
|
-
post_data <<
|
138
|
+
post_data << '}'
|
136
139
|
|
137
140
|
res = http({:method => :post, :raw => true, :path => 'interpolate'}, post_data)
|
138
141
|
|
@@ -149,7 +152,7 @@ EOF
|
|
149
152
|
|
150
153
|
def record_end(file_name)
|
151
154
|
res = http({:method => :post, :path => 'record'}, {:action => :stop})
|
152
|
-
File.open(
|
155
|
+
File.open('_recording.plist', 'wb') do |f|
|
153
156
|
f.write res
|
154
157
|
end
|
155
158
|
|
@@ -178,9 +181,9 @@ EOF
|
|
178
181
|
end
|
179
182
|
|
180
183
|
file_name = "#{file_name}_#{os}_#{device}.base64"
|
181
|
-
system(
|
184
|
+
system('/usr/bin/plutil -convert binary1 -o _recording_binary.plist _recording.plist')
|
182
185
|
system("openssl base64 -in _recording_binary.plist -out '#{file_name}'")
|
183
|
-
system(
|
186
|
+
system('rm _recording.plist _recording_binary.plist')
|
184
187
|
|
185
188
|
rec_dir = ENV['PLAYBACK_DIR'] || "#{Dir.pwd}/features/playback"
|
186
189
|
unless File.directory?(rec_dir)
|
@@ -78,23 +78,23 @@ module Calabash
|
|
78
78
|
case dir
|
79
79
|
when :left then
|
80
80
|
if current_orientation == :down
|
81
|
-
rotate_cmd =
|
81
|
+
rotate_cmd = 'left_home_down'
|
82
82
|
elsif current_orientation == :right
|
83
|
-
rotate_cmd =
|
83
|
+
rotate_cmd = 'left_home_right'
|
84
84
|
elsif current_orientation == :left
|
85
|
-
rotate_cmd =
|
85
|
+
rotate_cmd = 'left_home_left'
|
86
86
|
elsif current_orientation == :up
|
87
|
-
rotate_cmd =
|
87
|
+
rotate_cmd = 'left_home_up'
|
88
88
|
end
|
89
89
|
when :right then
|
90
90
|
if current_orientation == :down
|
91
|
-
rotate_cmd =
|
91
|
+
rotate_cmd = 'right_home_down'
|
92
92
|
elsif current_orientation == :left
|
93
|
-
rotate_cmd =
|
93
|
+
rotate_cmd = 'right_home_left'
|
94
94
|
elsif current_orientation == :right
|
95
|
-
rotate_cmd =
|
95
|
+
rotate_cmd = 'right_home_right'
|
96
96
|
elsif current_orientation == :up
|
97
|
-
rotate_cmd =
|
97
|
+
rotate_cmd = 'right_home_up'
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -12,12 +12,12 @@ module Calabash
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
return res
|
15
|
+
return res unless force_down
|
16
16
|
return rotate_home_button_to :down
|
17
17
|
end
|
18
18
|
|
19
|
-
return res
|
20
|
-
return res
|
19
|
+
return res unless res.eql?('unknown')
|
20
|
+
return res unless force_down
|
21
21
|
rotate_home_button_to(:down)
|
22
22
|
end
|
23
23
|
|
@@ -25,6 +25,18 @@ module Calabash
|
|
25
25
|
map(nil, :orientation, :status_bar).first
|
26
26
|
end
|
27
27
|
|
28
|
+
# returns +true+ if orientation is portrait
|
29
|
+
def portrait?
|
30
|
+
o = status_bar_orientation
|
31
|
+
o.eql?('up') or o.eql?('down')
|
32
|
+
end
|
33
|
+
|
34
|
+
# returns +true+ if orientation is landscape
|
35
|
+
def landscape?
|
36
|
+
o = status_bar_orientation
|
37
|
+
o.eql?('right') or o.eql?('left')
|
38
|
+
end
|
39
|
+
|
28
40
|
end
|
29
41
|
end
|
30
42
|
end
|
@@ -182,7 +182,7 @@ module Calabash
|
|
182
182
|
end
|
183
183
|
command = "#{js_cmd}.#{js_args.join('.')}"
|
184
184
|
if ENV['DEBUG'] == '1'
|
185
|
-
puts
|
185
|
+
puts 'Sending UIA command'
|
186
186
|
puts command
|
187
187
|
end
|
188
188
|
|
@@ -193,7 +193,7 @@ module Calabash
|
|
193
193
|
def uia_handle_command(cmd, *query_args)
|
194
194
|
command = uia_serialize_command(cmd, *query_args)
|
195
195
|
if ENV['DEBUG'] == '1'
|
196
|
-
puts
|
196
|
+
puts 'Sending UIA command'
|
197
197
|
puts command
|
198
198
|
end
|
199
199
|
s = uia(command)
|
@@ -224,13 +224,20 @@ module Calabash
|
|
224
224
|
escape_quotes string
|
225
225
|
end
|
226
226
|
|
227
|
+
# <b>DEPRECATED:</b> Use <tt>uia("...javascript..", options)</tt> instead.
|
228
|
+
# deprecated because the method signature is poor
|
227
229
|
def send_uia_command(opts ={})
|
228
|
-
|
229
|
-
#
|
230
|
+
|
231
|
+
# TODO formally deprecate send_uia_command with _deprecated function
|
232
|
+
#cmd = opts[:command]
|
233
|
+
#new_opts = cmd.select{|x| x != :command}
|
234
|
+
#_deprecated('0.9.163',
|
235
|
+
# "use 'uia(#{cmd}, #{new_opts})' instead",
|
236
|
+
# :warn)
|
237
|
+
|
230
238
|
uia(opts[:command], opts)
|
231
239
|
end
|
232
240
|
|
233
|
-
|
234
241
|
private
|
235
242
|
def validate_hash_is_location!(options)
|
236
243
|
return if options[:latitude] and options[:longitude]
|
@@ -244,7 +251,7 @@ module Calabash
|
|
244
251
|
|
245
252
|
def uia_result(s)
|
246
253
|
if ENV['DEBUG'] == '1'
|
247
|
-
puts
|
254
|
+
puts 'Result'
|
248
255
|
p s
|
249
256
|
end
|
250
257
|
if s['status'] == 'success'
|
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.9.163
|
4
|
+
version: 0.9.163
|
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-01-
|
11
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ~>
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.1.0
|
159
|
+
version: 0.1.0
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - ~>
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.1.0
|
166
|
+
version: 0.1.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: awesome_print
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - ~>
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0.9.
|
187
|
+
version: 0.9.27
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ~>
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 0.9.
|
194
|
+
version: 0.9.27
|
195
195
|
description: calabash-cucumber drives tests for native iOS apps. You must link your
|
196
196
|
app with calabash-ios-server framework to execute tests.
|
197
197
|
email:
|
@@ -235,6 +235,7 @@ files:
|
|
235
235
|
- lib/calabash-cucumber/cucumber.rb
|
236
236
|
- lib/calabash-cucumber/date_picker.rb
|
237
237
|
- lib/calabash-cucumber/device.rb
|
238
|
+
- lib/calabash-cucumber/environment_helpers.rb
|
238
239
|
- lib/calabash-cucumber/failure_helpers.rb
|
239
240
|
- lib/calabash-cucumber/http_helpers.rb
|
240
241
|
- lib/calabash-cucumber/ibase.rb
|
@@ -380,9 +381,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
380
381
|
version: '0'
|
381
382
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
382
383
|
requirements:
|
383
|
-
- - '
|
384
|
+
- - '>='
|
384
385
|
- !ruby/object:Gem::Version
|
385
|
-
version:
|
386
|
+
version: '0'
|
386
387
|
requirements: []
|
387
388
|
rubyforge_project:
|
388
389
|
rubygems_version: 2.0.3
|