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.
@@ -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', {:photo => {:allow => true}})
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
- unless ENV['CALABASH_NO_DEPRECATION'] == '1'
70
- warn "WARNING: set_text will be deprecated.\n * to enter text using the native keyboard use 'keyboard_enter_text'\n * to clear a text field or text view use 'clear_text'"
71
- warn 'https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS-Ruby-API'
72
- end
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
- if !recording_name.end_with? ".base64"
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["OS"] || ENV["OS"]
42
- device = options["DEVICE"] || ENV["DEVICE"] || "iphone"
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("_recording.plist", 'wb') do |f|
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("/usr/bin/plutil -convert binary1 -o _recording_binary.plist _recording.plist")
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("rm _recording.plist _recording_binary.plist")
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 = "left_home_down"
81
+ rotate_cmd = 'left_home_down'
82
82
  elsif current_orientation == :right
83
- rotate_cmd = "left_home_right"
83
+ rotate_cmd = 'left_home_right'
84
84
  elsif current_orientation == :left
85
- rotate_cmd = "left_home_left"
85
+ rotate_cmd = 'left_home_left'
86
86
  elsif current_orientation == :up
87
- rotate_cmd = "left_home_up"
87
+ rotate_cmd = 'left_home_up'
88
88
  end
89
89
  when :right then
90
90
  if current_orientation == :down
91
- rotate_cmd = "right_home_down"
91
+ rotate_cmd = 'right_home_down'
92
92
  elsif current_orientation == :left
93
- rotate_cmd = "right_home_left"
93
+ rotate_cmd = 'right_home_left'
94
94
  elsif current_orientation == :right
95
- rotate_cmd = "right_home_right"
95
+ rotate_cmd = 'right_home_right'
96
96
  elsif current_orientation == :up
97
- rotate_cmd = "right_home_up"
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 if !force_down
15
+ return res unless force_down
16
16
  return rotate_home_button_to :down
17
17
  end
18
18
 
19
- return res if !res.eql?('unknown')
20
- return res if !force_down
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 "Sending UIA command"
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 "Sending UIA command"
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
- #deprecated, poor method signature
229
- #use uia("uia-js...",options)
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 "Result"
254
+ puts 'Result'
248
255
  p s
249
256
  end
250
257
  if s['status'] == 'success'
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = '0.9.163.pre11'
4
- FRAMEWORK_VERSION = '0.9.163.pre10'
3
+ VERSION = '0.9.163'
4
+ FRAMEWORK_VERSION = '0.9.163'
5
5
  end
6
6
  end
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.pre11
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-05 00:00:00.000000000 Z
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.pre8
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.pre8
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.25
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.25
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: 1.3.1
386
+ version: '0'
386
387
  requirements: []
387
388
  rubyforge_project:
388
389
  rubygems_version: 2.0.3