calabash-cucumber 0.9.80.pre.5 → 0.9.80

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- calabash-cucumber (0.9.80.pre.4)
4
+ calabash-cucumber (0.9.80)
5
5
  CFPropertyList
6
6
  cucumber
7
7
  json
@@ -23,7 +23,7 @@ GEM
23
23
  geocoder (1.1.2)
24
24
  gherkin (2.11.1)
25
25
  json (>= 1.4.6)
26
- json (1.7.3)
26
+ json (1.7.4)
27
27
  location-one (0.0.5)
28
28
  geocoder (~> 1.1)
29
29
  json
@@ -100,6 +100,11 @@ module Calabash
100
100
  playback(file, options)
101
101
  end
102
102
 
103
+ #Current position of home button
104
+ def current_rotation
105
+ @current_rotation
106
+ end
107
+
103
108
  def rotate(dir)
104
109
  @current_rotation = @current_rotation || :down
105
110
  rotate_cmd = nil
@@ -141,9 +146,51 @@ module Calabash
141
146
  end
142
147
 
143
148
  def background(secs)
144
- http({:method => :post, :path => 'background'}, {:duration => secs})
149
+ set_user_pref("__calabash_action", {:action => :background, :duration => secs})
150
+ end
151
+
152
+ def prepare_dialog_action(opts={:dialog => nil, :answer => "Ok"})
153
+ if opts[:dialog].nil? || opts[:dialog].length < 1
154
+ raise ":dialog must be specified as a non-empty string (used as regexp to match dialog text)"
155
+ end
156
+ txt = opts[:answer] || 'Ok'
157
+ set_user_pref("__calabash_action", {:action => :dialog,
158
+ :text => opts[:dialog],
159
+ :answer => txt})
145
160
  end
146
161
 
162
+ def picker(opts={:query => "pickerView", :action => :texts})
163
+ raise "Not implemented" unless opts[:action] == :texts
164
+
165
+ q = opts[:query]
166
+
167
+ check_element_exists(q)
168
+
169
+ comps = query(q,:numberOfComponents).first
170
+ row_counts = []
171
+ texts = []
172
+ comps.times do |i|
173
+ row_counts[i] = query(q,:numberOfRowsInComponent=>i).first
174
+ texts[i] = []
175
+ end
176
+
177
+ row_counts.each_with_index do |row_count, comp|
178
+ row_count.times do |i|
179
+ #view = query(q,[{:viewForRow => 0}, {:forComponent => 0}],:accessibilityLabel).first
180
+ spec = [{:viewForRow => i}, {:forComponent => comp}]
181
+ view = query(q,spec).first
182
+ if view
183
+ txt = query(q,spec,:accessibilityLabel).first
184
+ else
185
+ txt = query(q, :delegate, [{:pickerView=>:view},
186
+ {:titleForRow=>i},
187
+ {:forComponent=>comp}]).first
188
+ end
189
+ texts[comp] << txt
190
+ end
191
+ end
192
+ texts
193
+ end
147
194
 
148
195
  def load_playback_data(recording, options={})
149
196
  os = options["OS"] || ENV["OS"] || "ios5"
@@ -267,16 +314,16 @@ module Calabash
267
314
  else
268
315
  req = Net::HTTP::Get.new url.path
269
316
  if data
270
- if URI.respond_to?:encode_www_form
317
+ if URI.respond_to? :encode_www_form
271
318
  url.query = URI.encode_www_form(data)
272
319
  else
273
320
  ##suport only "safe" ascii params for now
274
- url.query = enum.map do |k,v|
321
+ url.query = enum.map do |k, v|
275
322
  "#{k.to_s}=#{v.to_s}"
276
323
  end.join('&')
277
324
  end
278
325
  resp = Net::HTTP.get_response(url)
279
- if resp.is_a?Net::HTTPSuccess
326
+ if resp.is_a? Net::HTTPSuccess
280
327
  return resp.body
281
328
  else
282
329
  raise "HTTP-level Error #{resp}"
@@ -29,13 +29,16 @@ module Calabash
29
29
 
30
30
  def self.derived_data_dir_for_project
31
31
  dir = project_dir
32
-
32
+ xcode_workspace_name = ''
33
33
  info_plist = Dir.glob(DEFAULT_DERIVED_DATA_INFO).find { |plist_file|
34
34
  begin
35
35
  plist = CFPropertyList::List.new(:file => plist_file)
36
36
  hash = CFPropertyList.native_types(plist.value)
37
37
  ws_dir = File.dirname(hash['WorkspacePath']).downcase
38
38
  p_dir = dir.downcase
39
+ if (p_dir.include? ws_dir)
40
+ xcode_workspace_name = ws_dir.split('/').last
41
+ end
39
42
  ws_dir == p_dir
40
43
  rescue
41
44
  false
@@ -60,6 +63,13 @@ module Calabash
60
63
  File.basename(xc_proj).start_with?(xcode_proj_name)
61
64
  end
62
65
 
66
+ if (build_dirs.count == 0 && !xcode_workspace_name.empty?)
67
+ # check for directory named "workspace-{deriveddirectoryrandomcharacters}"
68
+ build_dirs = Dir.glob("#{DERIVED_DATA}/*").find_all do |xc_proj|
69
+ File.basename(xc_proj).downcase.start_with?(xcode_workspace_name)
70
+ end
71
+ end
72
+
63
73
  if (build_dirs.count == 0)
64
74
  msg = ["Unable to find your built app."]
65
75
  msg << "This means that Calabash can't automatically launch iOS simulator."
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = "0.9.80.pre.5"
4
- FRAMEWORK_VERSION = "0.9.80.pre.5"
3
+ VERSION = "0.9.80"
4
+ FRAMEWORK_VERSION = "0.9.80"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.80.pre.5
5
- prerelease: 7
4
+ version: 0.9.80
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Karl Krukow
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-29 00:00:00.000000000 Z
12
+ date: 2012-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -238,9 +238,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
238
238
  required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  none: false
240
240
  requirements:
241
- - - ! '>'
241
+ - - ! '>='
242
242
  - !ruby/object:Gem::Version
243
- version: 1.3.1
243
+ version: '0'
244
244
  requirements: []
245
245
  rubyforge_project:
246
246
  rubygems_version: 1.8.23