calabash-cucumber 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,5 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.add_dependency( "cucumber" )
20
20
  s.add_dependency( "rspec", ["~> 2.7.0"] )
21
21
  s.add_dependency( "json" )
22
+ s.add_dependency( "slowhandcuke" )
22
23
  s.add_dependency( "net-http-persistent" )
23
24
  end
@@ -26,7 +26,7 @@ end
26
26
 
27
27
  Then /^I (press|touch) button number (\d+)$/ do |_,index|
28
28
  index = index.to_i
29
- raise "Index should be positive (was: #{index})" if (index<=0)
29
+ screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
30
30
  touch("button index:#{index-1}")
31
31
  sleep(STEP_PAUSE)
32
32
  end
@@ -44,7 +44,7 @@ end
44
44
  ##TODO note in tables views: this means visible cell index!
45
45
  Then /^I (press|touch) list item number (\d+)$/ do |_,index|
46
46
  index = index.to_i
47
- raise "Index should be positive (was: #{index})" if (index<=0)
47
+ screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
48
48
  touch("tableViewCell index:#{index-1}")
49
49
  sleep(STEP_PAUSE)
50
50
  end
@@ -79,7 +79,7 @@ end
79
79
 
80
80
  Then /^I enter "([^\"]*)" into input field number (\d+)$/ do |text, index|
81
81
  index = index.to_i
82
- raise "Index should be positive (was: #{index})" if (index<=0)
82
+ screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
83
83
  set_text("textField index:#{index-1}",text)
84
84
  sleep(STEP_PAUSE)
85
85
  end
@@ -90,7 +90,7 @@ end
90
90
 
91
91
  Then /^I clear input field number (\d+)$/ do |index|
92
92
  index = index.to_i
93
- raise "Index should be positive (was: #{index})" if (index<=0)
93
+ screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
94
94
  set_text("textField index:#{index-1}","")
95
95
  sleep(STEP_PAUSE)
96
96
  end
@@ -181,7 +181,7 @@ end
181
181
 
182
182
  Then /^I swipe on cell number (\d+)$/ do |index|
183
183
  index = index.to_i
184
- raise "Index should be positive (was: #{index})" if (index<=0)
184
+ screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
185
185
  cell_swipe({:query => "tableViewCell index:#{index-1}"})
186
186
  sleep(STEP_PAUSE)
187
187
  end
@@ -19,10 +19,16 @@ module Operations
19
19
  map(uiquery, :query, *args)
20
20
  end
21
21
 
22
+ def screenshot_and_raise(msg)
23
+ screenshot
24
+ sleep 5
25
+ raise(msg)
26
+ end
27
+
22
28
  def touch(uiquery,options={})
23
29
  options[:query] = uiquery
24
30
  views_touched = playback("touch",options)
25
- raise "could not find view to touch: '#{uiquery}', args: #{args}" if views_touched.empty?
31
+ screenshot_and_raise "could not find view to touch: '#{uiquery}', args: #{args}" if views_touched.empty?
26
32
  views_touched
27
33
  end
28
34
 
@@ -40,7 +46,7 @@ module Operations
40
46
 
41
47
  def set_text(uiquery, txt)
42
48
  text_fields_modified = map(uiquery, :setText, txt)
43
- raise "could not find text field #{uiquery}" if text_fields_modified.empty?
49
+ screenshot_and_raise "could not find text field #{uiquery}" if text_fields_modified.empty?
44
50
  text_fields_modified
45
51
  end
46
52
 
@@ -59,13 +65,13 @@ module Operations
59
65
 
60
66
  def scroll(uiquery,direction)
61
67
  views_touched=map(uiquery, :scroll, direction)
62
- raise "could not find view to scroll: '#{uiquery}', args: #{direction}" if views_touched.empty?
68
+ screenshot_and_raise "could not find view to scroll: '#{uiquery}', args: #{direction}" if views_touched.empty?
63
69
  views_touched
64
70
  end
65
71
 
66
72
  def scroll_to_row(uiquery,number)
67
73
  views_touched=map(uiquery, :scrollToRow, number)
68
- raise "could not find view to scroll: '#{uiquery}', args: #{number}" if views_touched.empty?
74
+ screenshot_and_raise "could not find view to scroll: '#{uiquery}', args: #{number}" if views_touched.empty?
69
75
  views_touched
70
76
  end
71
77
 
@@ -112,13 +118,13 @@ module Operations
112
118
  end
113
119
 
114
120
  if rotate_cmd.nil?
115
- throw "Does not support rotating #{dir} when home button is pointing #{@current_rotation}"
121
+ screenshot_and_raise "Does not support rotating #{dir} when home button is pointing #{@current_rotation}"
116
122
  end
117
123
  playback("rotate_#{rotate_cmd}")
118
124
  end
119
125
 
120
126
  def background(secs)
121
- raise "Not implemented yet"
127
+ screenshot_and_raise "Not implemented yet"
122
128
  end
123
129
 
124
130
  def element_exists(uiquery)
@@ -165,7 +171,7 @@ module Operations
165
171
  elsif (File.exists?("#{DATA_PATH}/resources/#{recording}"))
166
172
  data = File.read("#{DATA_PATH}/resources/#{recording}")
167
173
  else
168
- raise "Playback not found: #{recording} (searched for #{recording} in #{Dir.pwd}, #{rec_dir}, #{DATA_PATH}/resources"
174
+ screenshot_and_raise "Playback not found: #{recording} (searched for #{recording} in #{Dir.pwd}, #{rec_dir}, #{DATA_PATH}/resources"
169
175
  end
170
176
  data
171
177
  end
@@ -183,7 +189,7 @@ module Operations
183
189
 
184
190
  res = JSON.parse( res )
185
191
  if res['outcome'] != 'SUCCESS'
186
- raise "playback failed because: #{res['reason']}\n#{res['details']}"
192
+ screenshot_and_raise "playback failed because: #{res['reason']}\n#{res['details']}"
187
193
  end
188
194
  res['results']
189
195
  end
@@ -247,7 +253,7 @@ module Operations
247
253
  {:query => query, :operation => operation_map})
248
254
  res = JSON.parse(res)
249
255
  if res['outcome'] != 'SUCCESS'
250
- raise "map #{query}, #{method_name} failed because: #{res['reason']}\n#{res['details']}"
256
+ screenshot_and_raise "map #{query}, #{method_name} failed because: #{res['reason']}\n#{res['details']}"
251
257
  end
252
258
 
253
259
  res['results']
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = "0.9.5"
3
+ VERSION = "0.9.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-26 00:00:00.000000000 Z
12
+ date: 2012-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
16
- requirement: &70174157981160 !ruby/object:Gem::Requirement
16
+ requirement: &70312339656540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70174157981160
24
+ version_requirements: *70312339656540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70174157980020 !ruby/object:Gem::Requirement
27
+ requirement: &70312339655440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.7.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70174157980020
35
+ version_requirements: *70312339655440
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &70174157978700 !ruby/object:Gem::Requirement
38
+ requirement: &70312339654480 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,21 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70174157978700
46
+ version_requirements: *70312339654480
47
+ - !ruby/object:Gem::Dependency
48
+ name: slowhandcuke
49
+ requirement: &70312339644820 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70312339644820
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: net-http-persistent
49
- requirement: &70174157977480 !ruby/object:Gem::Requirement
60
+ requirement: &70312339644160 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,7 +65,7 @@ dependencies:
54
65
  version: '0'
55
66
  type: :runtime
56
67
  prerelease: false
57
- version_requirements: *70174157977480
68
+ version_requirements: *70312339644160
58
69
  description: calabash-cucumber drives tests for native iOS apps. You must link your
59
70
  app with calabash-ios-server framework to execute tests.
60
71
  email: