calabash-cucumber 0.9.63 → 0.9.65
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -3
- data/calabash-cucumber.gemspec +1 -1
- data/features/step_definitions/calabash_steps.rb +374 -0
- data/lib/calabash-cucumber/calabash_steps.rb +1 -374
- data/lib/calabash-cucumber/version.rb +1 -1
- metadata +50 -18
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
calabash-cucumber (0.9.
|
4
|
+
calabash-cucumber (0.9.65)
|
5
5
|
CFPropertyList
|
6
6
|
cucumber
|
7
7
|
json
|
8
8
|
net-http-persistent
|
9
|
-
sim_launcher
|
9
|
+
sim_launcher (= 0.4.1.pre2)
|
10
10
|
slowhandcuke
|
11
11
|
|
12
12
|
GEM
|
@@ -32,7 +32,7 @@ GEM
|
|
32
32
|
rack-protection (1.2.0)
|
33
33
|
rack
|
34
34
|
rake (0.9.2.2)
|
35
|
-
sim_launcher (0.
|
35
|
+
sim_launcher (0.4.1.pre2)
|
36
36
|
sinatra
|
37
37
|
sinatra (1.3.2)
|
38
38
|
rack (~> 1.3, >= 1.3.6)
|
data/calabash-cucumber.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_dependency( "cucumber" )
|
20
20
|
s.add_dependency( "json" )
|
21
21
|
s.add_dependency( "CFPropertyList" )
|
22
|
-
s.add_dependency( "sim_launcher" )
|
22
|
+
s.add_dependency( "sim_launcher", "0.3.8")
|
23
23
|
s.add_dependency( "slowhandcuke" )
|
24
24
|
s.add_dependency( "net-http-persistent" )
|
25
25
|
|
@@ -0,0 +1,374 @@
|
|
1
|
+
WAIT_TIMEOUT = ENV['WAIT_TIMEOUT'] || 30
|
2
|
+
STEP_PAUSE = (ENV['STEP_PAUSE'] || 0.5).to_f
|
3
|
+
|
4
|
+
Given /^(my|the) app is running$/ do |_|
|
5
|
+
#no-op exists for backwards compatibility
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
# -- Touch --#
|
10
|
+
Then /^I (?:press|touch) on screen (\d+) from the left and (\d+) from the top$/ do |x, y|
|
11
|
+
touch(nil, {:offset => {:x => x.to_i, :y => y.to_i}})
|
12
|
+
sleep(STEP_PAUSE)
|
13
|
+
end
|
14
|
+
|
15
|
+
Then /^I (?:press|touch) "([^\"]*)"$/ do |name|
|
16
|
+
touch("view marked:'#{name}'")
|
17
|
+
sleep(STEP_PAUSE)
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /^I (?:press|touch) (\d+)% right and (\d+)% down from "([^\"]*)" $/ do |x,y,name|
|
21
|
+
raise "This step is not yet implemented on iOS"
|
22
|
+
end
|
23
|
+
|
24
|
+
Then /^I (?:press|touch) button number (\d+)$/ do |index|
|
25
|
+
index = index.to_i
|
26
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
27
|
+
touch("button index:#{index-1}")
|
28
|
+
sleep(STEP_PAUSE)
|
29
|
+
end
|
30
|
+
|
31
|
+
Then /^I (?:press|touch) the "([^\"]*)" button$/ do |name|
|
32
|
+
touch("button marked:'#{name}'")
|
33
|
+
sleep(STEP_PAUSE)
|
34
|
+
end
|
35
|
+
|
36
|
+
Then /^I (?:press|touch) the "([^\"]*)" (?:input|text) field$/ do |name|
|
37
|
+
touch("textField placeholder:'#{name}'")
|
38
|
+
sleep(STEP_PAUSE)
|
39
|
+
end
|
40
|
+
|
41
|
+
#Note in tables views: this means visible cell index!
|
42
|
+
Then /^I (?:press|touch) list item number (\d+)$/ do |index|
|
43
|
+
index = index.to_i
|
44
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
45
|
+
touch("tableViewCell index:#{index-1}")
|
46
|
+
sleep(STEP_PAUSE)
|
47
|
+
end
|
48
|
+
|
49
|
+
Then /^I toggle the switch$/ do
|
50
|
+
touch("switch")
|
51
|
+
sleep(STEP_PAUSE)
|
52
|
+
end
|
53
|
+
|
54
|
+
Then /^I toggle the "([^\"]*)" switch$/ do |name|
|
55
|
+
touch("switch marked:'#{name}'")
|
56
|
+
sleep(STEP_PAUSE)
|
57
|
+
end
|
58
|
+
|
59
|
+
Then /^I touch (?:the)? user location$/ do
|
60
|
+
touch("view:'MKUserLocationView'")
|
61
|
+
sleep(STEP_PAUSE)
|
62
|
+
end
|
63
|
+
|
64
|
+
Then /^I (?:touch|press) (?:done|search)$/ do
|
65
|
+
done
|
66
|
+
sleep(STEP_PAUSE)
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
## -- Entering text -- ##
|
71
|
+
Then /^I enter "([^\"]*)" into the "([^\"]*)" (?:text|input) field$/ do |text_to_type, field_name|
|
72
|
+
set_text("textField placeholder:'#{field_name}'", text_to_type)
|
73
|
+
sleep(STEP_PAUSE)
|
74
|
+
end
|
75
|
+
|
76
|
+
# alias
|
77
|
+
Then /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |text_field, text_to_type|
|
78
|
+
macro %Q|I enter "#{text_to_type}" into the "#{text_field}" text field|
|
79
|
+
end
|
80
|
+
|
81
|
+
Then /^I use the native keyboard to enter "([^\"]*)" into the "([^\"]*)" (?:text|input) field$/ do |text_to_type, field_name|
|
82
|
+
raise "Native keyboard entering is not yet implemented on iOS"
|
83
|
+
end
|
84
|
+
|
85
|
+
Then /^I fill in text fields as follows:$/ do |table|
|
86
|
+
table.hashes.each do |row|
|
87
|
+
macro %Q|I enter "#{row['text']}" into the "#{row['field']}" text field|
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
Then /^I enter "([^\"]*)" into (?:input|text) field number (\d+)$/ do |text, index|
|
92
|
+
index = index.to_i
|
93
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
94
|
+
set_text("textField index:#{index-1}",text)
|
95
|
+
end
|
96
|
+
|
97
|
+
Then /^I use the native keyboard to enter "([^\"]*)" into (?:input|text) field number (\d+)$/ do |text, index|
|
98
|
+
raise "Native keyboard entering is not yet implemented on iOS"
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
When /^I clear "([^\"]*)"$/ do |name|
|
103
|
+
macro %Q|I enter "" into the "#{name}" text field|
|
104
|
+
end
|
105
|
+
|
106
|
+
Then /^I clear (?:input|text) field number (\d+)$/ do |index|
|
107
|
+
index = index.to_i
|
108
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
109
|
+
set_text("textField index:#{index-1}","")
|
110
|
+
end
|
111
|
+
|
112
|
+
# -- See -- #
|
113
|
+
Then /^I wait to see "([^\"]*)"$/ do |expected_mark|
|
114
|
+
wait_for(WAIT_TIMEOUT) { view_with_mark_exists( expected_mark ) }
|
115
|
+
end
|
116
|
+
|
117
|
+
Then /^I wait until I don't see "([^\"]*)"$/ do |expected_mark|
|
118
|
+
sleep 1## wait for previous screen to disappear
|
119
|
+
wait_for(WAIT_TIMEOUT) { not element_exists( "view marked:'#{expected_mark}'" )}
|
120
|
+
end
|
121
|
+
|
122
|
+
Then /^I wait to not see "([^\"]*)"$/ do |expected_mark|
|
123
|
+
macro %Q|I wait until I don't see "#{expected_mark}"|
|
124
|
+
end
|
125
|
+
|
126
|
+
Then /^I wait for "([^\"]*)" to appear$/ do |name|
|
127
|
+
macro %Q|I wait to see "#{name}"|
|
128
|
+
end
|
129
|
+
|
130
|
+
Then /^I wait for the "([^\"]*)" button to appear$/ do |name|
|
131
|
+
wait_for(WAIT_TIMEOUT) { element_exists( "button marked:'#{name}'" ) }
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
Then /^I wait to see a navigation bar titled "([^\"]*)"$/ do |expected_mark|
|
136
|
+
wait_for(WAIT_TIMEOUT) do
|
137
|
+
query('navigationItemView', :accessibilityLabel).include?(expected_mark)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
Then /^I wait for the "([^\"]*)" (?:input|text) field$/ do |placeholder|
|
142
|
+
wait_for(WAIT_TIMEOUT) { element_exists( "textField placeholder:'#{placeholder}'") }
|
143
|
+
end
|
144
|
+
|
145
|
+
Then /^I wait for (\d+) (?:input|text) field(?:s)?$/ do |count|
|
146
|
+
count = count.to_i
|
147
|
+
wait_for(WAIT_TIMEOUT) { query(:textField).count >= count }
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
Then /^I wait$/ do
|
152
|
+
sleep 2
|
153
|
+
end
|
154
|
+
|
155
|
+
Then /^I wait and wait$/ do
|
156
|
+
sleep 4
|
157
|
+
end
|
158
|
+
|
159
|
+
Then /^I wait and wait and wait...$/ do
|
160
|
+
sleep 10
|
161
|
+
end
|
162
|
+
|
163
|
+
When /^I wait for ([\d\.]+) second(?:s)?$/ do |num_seconds|
|
164
|
+
num_seconds = num_seconds.to_f
|
165
|
+
sleep num_seconds
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
Then /^I go back$/ do
|
170
|
+
touch("navigationItemButtonView first")
|
171
|
+
sleep(STEP_PAUSE)
|
172
|
+
end
|
173
|
+
|
174
|
+
Then /^(?:I\s)?take (?:picture|screenshot)$/ do
|
175
|
+
sleep(STEP_PAUSE)
|
176
|
+
screenshot
|
177
|
+
end
|
178
|
+
|
179
|
+
Then /^I swipe (left|right|up|down)$/ do |dir|
|
180
|
+
swipe(dir)
|
181
|
+
sleep(STEP_PAUSE)
|
182
|
+
end
|
183
|
+
|
184
|
+
Then /^I swipe (left|right|up|down) on number (\d+)$/ do |dir, index|
|
185
|
+
index = index.to_i
|
186
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
187
|
+
swipe(dir, {:query => "scrollView index:#{index-1}"})
|
188
|
+
sleep(STEP_PAUSE)
|
189
|
+
end
|
190
|
+
|
191
|
+
Then /^I swipe (left|right|up|down) on number (\d+) at x (\d+) and y (\d+)$/ do |dir, index, x, y|
|
192
|
+
index = index.to_i
|
193
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
194
|
+
swipe(dir, {:offset => {:x => x.to_i, :y => y.to_i}, :query => "scrollView index:#{index-1}"})
|
195
|
+
sleep(STEP_PAUSE)
|
196
|
+
end
|
197
|
+
|
198
|
+
Then /^I swipe (left|right|up|down) on "([^\"]*)"$/ do |dir, mark|
|
199
|
+
swipe(dir, {:query => "view marked:'#{mark}'"})
|
200
|
+
sleep(STEP_PAUSE)
|
201
|
+
end
|
202
|
+
|
203
|
+
Then /^I swipe on cell number (\d+)$/ do |index|
|
204
|
+
index = index.to_i
|
205
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
206
|
+
cell_swipe({:query => "tableViewCell index:#{index-1}"})
|
207
|
+
sleep(STEP_PAUSE)
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
##pinch##
|
212
|
+
Then /^I pinch to zoom (in|out)$/ do |in_out|
|
213
|
+
pinch(in_out)
|
214
|
+
sleep(STEP_PAUSE)
|
215
|
+
end
|
216
|
+
|
217
|
+
Then /^I pinch to zoom (in|out) on "([^\"]*)"$/ do |in_out, name|
|
218
|
+
pinch(in_out,{:query => "view marked:'#{name}'"})
|
219
|
+
sleep(STEP_PAUSE)
|
220
|
+
end
|
221
|
+
|
222
|
+
# Note "up/left/right" seems to be missing on the web page
|
223
|
+
Then /^I scroll (left|right|up|down)$/ do |dir|
|
224
|
+
scroll("scrollView index:0", dir)
|
225
|
+
sleep(STEP_PAUSE)
|
226
|
+
end
|
227
|
+
|
228
|
+
Then /^I scroll (left|right|up|down) on "([^\"]*)"$/ do |dir,name|
|
229
|
+
scroll("view marked:'#{name}'", dir)
|
230
|
+
sleep(STEP_PAUSE)
|
231
|
+
end
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
### Playback ###
|
236
|
+
Then /^I playback recording "([^\"]*)"$/ do |filename|
|
237
|
+
playback(filename)
|
238
|
+
sleep(STEP_PAUSE)
|
239
|
+
end
|
240
|
+
|
241
|
+
Then /^I playback recording "([^\"]*)" on "([^\"]*)"$/ do |filename, name|
|
242
|
+
playback(filename, {:query => "view marked:'#{name}'"})
|
243
|
+
sleep(STEP_PAUSE)
|
244
|
+
end
|
245
|
+
|
246
|
+
Then /^I playback recording "([^\"]*)" on "([^\"]*)" with offset (\d+),(\d+)$/ do |filename, name, x, y|
|
247
|
+
x = x.to_i
|
248
|
+
y = y.to_i
|
249
|
+
playback(filename, {:query => "view marked:'#{name}'", :offset => {:x => x, :y => y}})
|
250
|
+
sleep(STEP_PAUSE)
|
251
|
+
end
|
252
|
+
|
253
|
+
Then /^I reverse playback recording "([^\"]*)"$/ do |filename|
|
254
|
+
playback(filename, {:reverse => true})
|
255
|
+
sleep(STEP_PAUSE)
|
256
|
+
end
|
257
|
+
|
258
|
+
Then /^I reverse playback recording "([^\"]*)" on "([^\"]*)"$/ do |filename, name|
|
259
|
+
playback(filename, {:query => "view marked:'#{name}'",:reverse => true})
|
260
|
+
sleep(STEP_PAUSE)
|
261
|
+
end
|
262
|
+
|
263
|
+
Then /^I reverse playback recording "([^\"]*)" on "([^\"]*)" with offset (\d+),(\d+)$/ do |filename, name, x, y|
|
264
|
+
x = x.to_i
|
265
|
+
y = y.to_i
|
266
|
+
playback(filename, {:query => "view marked:'#{name}'", :offset => {:x => x, :y => y},:reverse => true})
|
267
|
+
sleep(STEP_PAUSE)
|
268
|
+
end
|
269
|
+
|
270
|
+
|
271
|
+
### Device orientation ###
|
272
|
+
Then /^I rotate device (left|right)$/ do |dir|
|
273
|
+
dir = dir.to_sym
|
274
|
+
rotate(dir)
|
275
|
+
sleep(5)#SERVO wait
|
276
|
+
end
|
277
|
+
|
278
|
+
Then /^I send app to background for (\d+) seconds$/ do |secs|
|
279
|
+
secs = secs.to_f
|
280
|
+
background(secs)
|
281
|
+
sleep(secs+10)
|
282
|
+
end
|
283
|
+
|
284
|
+
### Assertions ###
|
285
|
+
Then /^I should see "([^\"]*)"$/ do |expected_mark|
|
286
|
+
res = (element_exists( "view marked:'#{expected_mark}'" ) or
|
287
|
+
element_exists( "view text:'#{expected_mark}'"))
|
288
|
+
if not res
|
289
|
+
screenshot_and_raise "No element found with mark or text: #{expected_mark}"
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
Then /^I should not see "([^\"]*)"$/ do |expected_mark|
|
294
|
+
res = query("view marked:'#{expected_mark}'")
|
295
|
+
res.concat query("view text:'#{expected_mark}'")
|
296
|
+
unless res.empty?
|
297
|
+
screenshot_and_raise "Expected no element with text nor accessibilityLabel: #{expected_mark}, found #{res.join(", ")}"
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
Then /^I should see a "([^\"]*)" button$/ do |expected_mark|
|
302
|
+
check_element_exists("button marked:'#{expected_mark}'")
|
303
|
+
end
|
304
|
+
Then /^I should not see a "([^\"]*)" button$/ do |expected_mark|
|
305
|
+
check_element_does_not_exist("button marked:'#{expected_mark}'")
|
306
|
+
end
|
307
|
+
|
308
|
+
Then /^I don't see the text "([^\"]*)"$/ do |text|
|
309
|
+
macro %Q|I should not see "#{text}"|
|
310
|
+
end
|
311
|
+
Then /^I don't see the "([^\"]*)"$/ do |text|
|
312
|
+
macro %Q|I should not see "#{text}"|
|
313
|
+
end
|
314
|
+
|
315
|
+
Then /^I see the text "([^\"]*)"$/ do |text|
|
316
|
+
macro %Q|I should see "#{text}"|
|
317
|
+
end
|
318
|
+
Then /^I see the "([^\"]*)"$/ do |text|
|
319
|
+
macro %Q|I should see "#{text}"|
|
320
|
+
end
|
321
|
+
|
322
|
+
Then /^I (?:should)? see text starting with "([^\"]*)"$/ do |text|
|
323
|
+
res = query("view {text BEGINSWITH '#{text}'}").empty?
|
324
|
+
if res
|
325
|
+
screenshot_and_raise "No text found starting with: #{text}"
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
Then /^I (?:should)? see text containing "([^\"]*)"$/ do |text|
|
330
|
+
res = query("view {text LIKE '*#{text}*'}").empty?
|
331
|
+
if res
|
332
|
+
screenshot_and_raise "No text found containing: #{text}"
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
Then /^I (?:should)? see text ending with "([^\"]*)"$/ do |text|
|
337
|
+
res = query("view {text ENDSWITH '#{text}'}").empty?
|
338
|
+
if res
|
339
|
+
screenshot_and_raise "No text found ending with: #{text}"
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
Then /^I see (\d+) (?:input|text) field(?:s)?$/ do |count|
|
344
|
+
count = count.to_i
|
345
|
+
cnt = query(:textField).count
|
346
|
+
if cnt < count
|
347
|
+
screenshot_and_raise "Expected at least #{count} text/input fields, found #{cnt}"
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
Then /^I should see a "([^\"]*)" (?:input|text) field$/ do |expected_mark|
|
352
|
+
res = element_exists("textField placeholder:'#{expected_mark}'") or
|
353
|
+
element_exists("textField marked:'#{expected_mark}'")
|
354
|
+
unless res
|
355
|
+
screenshot_and_raise "Expected textfield with placeholder or accessibilityLabel: #{txt}"
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
Then /^I should not see a "([^\"]*)" (?:input|text) field$/ do |expected_mark|
|
360
|
+
res = query("textField placeholder:'#{expected_mark}'")
|
361
|
+
res.concat query("textField marked:'#{expected_mark}'")
|
362
|
+
unless res.empty?
|
363
|
+
screenshot_and_raise "Expected no textfield with placeholder nor accessibilityLabel: #{txt}, found #{res}"
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
|
368
|
+
Then /^I should see a map$/ do
|
369
|
+
check_element_exists("view:'MKMapView'")
|
370
|
+
end
|
371
|
+
|
372
|
+
Then /^I should see (?:the)? user location$/ do
|
373
|
+
check_element_exists("view:'MKUserLocationView'")
|
374
|
+
end
|
@@ -1,374 +1 @@
|
|
1
|
-
|
2
|
-
STEP_PAUSE = (ENV['STEP_PAUSE'] || 0.5).to_f
|
3
|
-
|
4
|
-
Given /^(my|the) app is running$/ do |_|
|
5
|
-
#no-op exists for backwards compatibility
|
6
|
-
end
|
7
|
-
|
8
|
-
|
9
|
-
# -- Touch --#
|
10
|
-
Then /^I (?:press|touch) on screen (\d+) from the left and (\d+) from the top$/ do |x, y|
|
11
|
-
touch(nil, {:offset => {:x => x.to_i, :y => y.to_i}})
|
12
|
-
sleep(STEP_PAUSE)
|
13
|
-
end
|
14
|
-
|
15
|
-
Then /^I (?:press|touch) "([^\"]*)"$/ do |name|
|
16
|
-
touch("view marked:'#{name}'")
|
17
|
-
sleep(STEP_PAUSE)
|
18
|
-
end
|
19
|
-
|
20
|
-
Then /^I (?:press|touch) (\d+)% right and (\d+)% down from "([^\"]*)" $/ do |x,y,name|
|
21
|
-
raise "This step is not yet implemented on iOS"
|
22
|
-
end
|
23
|
-
|
24
|
-
Then /^I (?:press|touch) button number (\d+)$/ do |index|
|
25
|
-
index = index.to_i
|
26
|
-
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
27
|
-
touch("button index:#{index-1}")
|
28
|
-
sleep(STEP_PAUSE)
|
29
|
-
end
|
30
|
-
|
31
|
-
Then /^I (?:press|touch) the "([^\"]*)" button$/ do |name|
|
32
|
-
touch("button marked:'#{name}'")
|
33
|
-
sleep(STEP_PAUSE)
|
34
|
-
end
|
35
|
-
|
36
|
-
Then /^I (?:press|touch) the "([^\"]*)" (?:input|text) field$/ do |name|
|
37
|
-
touch("textField placeholder:'#{name}'")
|
38
|
-
sleep(STEP_PAUSE)
|
39
|
-
end
|
40
|
-
|
41
|
-
#Note in tables views: this means visible cell index!
|
42
|
-
Then /^I (?:press|touch) list item number (\d+)$/ do |index|
|
43
|
-
index = index.to_i
|
44
|
-
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
45
|
-
touch("tableViewCell index:#{index-1}")
|
46
|
-
sleep(STEP_PAUSE)
|
47
|
-
end
|
48
|
-
|
49
|
-
Then /^I toggle the switch$/ do
|
50
|
-
touch("switch")
|
51
|
-
sleep(STEP_PAUSE)
|
52
|
-
end
|
53
|
-
|
54
|
-
Then /^I toggle the "([^\"]*)" switch$/ do |name|
|
55
|
-
touch("switch marked:'#{name}'")
|
56
|
-
sleep(STEP_PAUSE)
|
57
|
-
end
|
58
|
-
|
59
|
-
Then /^I touch (?:the)? user location$/ do
|
60
|
-
touch("view:'MKUserLocationView'")
|
61
|
-
sleep(STEP_PAUSE)
|
62
|
-
end
|
63
|
-
|
64
|
-
Then /^I (?:touch|press) (?:done|search)$/ do
|
65
|
-
done
|
66
|
-
sleep(STEP_PAUSE)
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
## -- Entering text -- ##
|
71
|
-
Then /^I enter "([^\"]*)" into the "([^\"]*)" (?:text|input) field$/ do |text_to_type, field_name|
|
72
|
-
set_text("textField placeholder:'#{field_name}'", text_to_type)
|
73
|
-
sleep(STEP_PAUSE)
|
74
|
-
end
|
75
|
-
|
76
|
-
# alias
|
77
|
-
Then /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |text_field, text_to_type|
|
78
|
-
macro %Q|I enter "#{text_to_type}" into the "#{text_field}" text field|
|
79
|
-
end
|
80
|
-
|
81
|
-
Then /^I use the native keyboard to enter "([^\"]*)" into the "([^\"]*)" (?:text|input) field$/ do |text_to_type, field_name|
|
82
|
-
raise "Native keyboard entering is not yet implemented on iOS"
|
83
|
-
end
|
84
|
-
|
85
|
-
Then /^I fill in text fields as follows:$/ do |table|
|
86
|
-
table.hashes.each do |row|
|
87
|
-
macro %Q|I enter "#{row['text']}" into the "#{row['field']}" text field|
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
Then /^I enter "([^\"]*)" into (?:input|text) field number (\d+)$/ do |text, index|
|
92
|
-
index = index.to_i
|
93
|
-
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
94
|
-
set_text("textField index:#{index-1}",text)
|
95
|
-
end
|
96
|
-
|
97
|
-
Then /^I use the native keyboard to enter "([^\"]*)" into (?:input|text) field number (\d+)$/ do |text, index|
|
98
|
-
raise "Native keyboard entering is not yet implemented on iOS"
|
99
|
-
end
|
100
|
-
|
101
|
-
|
102
|
-
When /^I clear "([^\"]*)"$/ do |name|
|
103
|
-
macro %Q|I enter "" into the "#{name}" text field|
|
104
|
-
end
|
105
|
-
|
106
|
-
Then /^I clear (?:input|text) field number (\d+)$/ do |index|
|
107
|
-
index = index.to_i
|
108
|
-
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
109
|
-
set_text("textField index:#{index-1}","")
|
110
|
-
end
|
111
|
-
|
112
|
-
# -- See -- #
|
113
|
-
Then /^I wait to see "([^\"]*)"$/ do |expected_mark|
|
114
|
-
wait_for(WAIT_TIMEOUT) { view_with_mark_exists( expected_mark ) }
|
115
|
-
end
|
116
|
-
|
117
|
-
Then /^I wait until I don't see "([^\"]*)"$/ do |expected_mark|
|
118
|
-
sleep 1## wait for previous screen to disappear
|
119
|
-
wait_for(WAIT_TIMEOUT) { not element_exists( "view marked:'#{expected_mark}'" )}
|
120
|
-
end
|
121
|
-
|
122
|
-
Then /^I wait to not see "([^\"]*)"$/ do |expected_mark|
|
123
|
-
macro %Q|I wait until I don't see "#{expected_mark}"|
|
124
|
-
end
|
125
|
-
|
126
|
-
Then /^I wait for "([^\"]*)" to appear$/ do |name|
|
127
|
-
macro %Q|I wait to see "#{name}"|
|
128
|
-
end
|
129
|
-
|
130
|
-
Then /^I wait for the "([^\"]*)" button to appear$/ do |name|
|
131
|
-
wait_for(WAIT_TIMEOUT) { element_exists( "button marked:'#{name}'" ) }
|
132
|
-
end
|
133
|
-
|
134
|
-
|
135
|
-
Then /^I wait to see a navigation bar titled "([^\"]*)"$/ do |expected_mark|
|
136
|
-
wait_for(WAIT_TIMEOUT) do
|
137
|
-
query('navigationItemView', :accessibilityLabel).include?(expected_mark)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
Then /^I wait for the "([^\"]*)" (?:input|text) field$/ do |placeholder|
|
142
|
-
wait_for(WAIT_TIMEOUT) { element_exists( "textField placeholder:'#{placeholder}'") }
|
143
|
-
end
|
144
|
-
|
145
|
-
Then /^I wait for (\d+) (?:input|text) field(?:s)?$/ do |count|
|
146
|
-
count = count.to_i
|
147
|
-
wait_for(WAIT_TIMEOUT) { query(:textField).count >= count }
|
148
|
-
end
|
149
|
-
|
150
|
-
|
151
|
-
Then /^I wait$/ do
|
152
|
-
sleep 2
|
153
|
-
end
|
154
|
-
|
155
|
-
Then /^I wait and wait$/ do
|
156
|
-
sleep 4
|
157
|
-
end
|
158
|
-
|
159
|
-
Then /^I wait and wait and wait...$/ do
|
160
|
-
sleep 10
|
161
|
-
end
|
162
|
-
|
163
|
-
When /^I wait for ([\d\.]+) second(?:s)?$/ do |num_seconds|
|
164
|
-
num_seconds = num_seconds.to_f
|
165
|
-
sleep num_seconds
|
166
|
-
end
|
167
|
-
|
168
|
-
|
169
|
-
Then /^I go back$/ do
|
170
|
-
touch("navigationItemButtonView first")
|
171
|
-
sleep(STEP_PAUSE)
|
172
|
-
end
|
173
|
-
|
174
|
-
Then /^(?:I\s)?take (?:picture|screenshot)$/ do
|
175
|
-
sleep(STEP_PAUSE)
|
176
|
-
screenshot
|
177
|
-
end
|
178
|
-
|
179
|
-
Then /^I swipe (left|right|up|down)$/ do |dir|
|
180
|
-
swipe(dir)
|
181
|
-
sleep(STEP_PAUSE)
|
182
|
-
end
|
183
|
-
|
184
|
-
Then /^I swipe (left|right|up|down) on number (\d+)$/ do |dir, index|
|
185
|
-
index = index.to_i
|
186
|
-
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
187
|
-
swipe(dir, {:query => "scrollView index:#{index-1}"})
|
188
|
-
sleep(STEP_PAUSE)
|
189
|
-
end
|
190
|
-
|
191
|
-
Then /^I swipe (left|right|up|down) on number (\d+) at x (\d+) and y (\d+)$/ do |dir, index, x, y|
|
192
|
-
index = index.to_i
|
193
|
-
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
194
|
-
swipe(dir, {:offset => {:x => x.to_i, :y => y.to_i}, :query => "scrollView index:#{index-1}"})
|
195
|
-
sleep(STEP_PAUSE)
|
196
|
-
end
|
197
|
-
|
198
|
-
Then /^I swipe (left|right|up|down) on "([^\"]*)"$/ do |dir, mark|
|
199
|
-
swipe(dir, {:query => "view marked:'#{mark}'"})
|
200
|
-
sleep(STEP_PAUSE)
|
201
|
-
end
|
202
|
-
|
203
|
-
Then /^I swipe on cell number (\d+)$/ do |index|
|
204
|
-
index = index.to_i
|
205
|
-
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
206
|
-
cell_swipe({:query => "tableViewCell index:#{index-1}"})
|
207
|
-
sleep(STEP_PAUSE)
|
208
|
-
end
|
209
|
-
|
210
|
-
|
211
|
-
##pinch##
|
212
|
-
Then /^I pinch to zoom (in|out)$/ do |in_out|
|
213
|
-
pinch(in_out)
|
214
|
-
sleep(STEP_PAUSE)
|
215
|
-
end
|
216
|
-
|
217
|
-
Then /^I pinch to zoom (in|out) on "([^\"]*)"$/ do |in_out, name|
|
218
|
-
pinch(in_out,{:query => "view marked:'#{name}'"})
|
219
|
-
sleep(STEP_PAUSE)
|
220
|
-
end
|
221
|
-
|
222
|
-
# Note "up/left/right" seems to be missing on the web page
|
223
|
-
Then /^I scroll (left|right|up|down)$/ do |dir|
|
224
|
-
scroll("scrollView index:0", dir)
|
225
|
-
sleep(STEP_PAUSE)
|
226
|
-
end
|
227
|
-
|
228
|
-
Then /^I scroll (left|right|up|down) on "([^\"]*)"$/ do |dir,name|
|
229
|
-
scroll("view marked:'#{name}'", dir)
|
230
|
-
sleep(STEP_PAUSE)
|
231
|
-
end
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
### Playback ###
|
236
|
-
Then /^I playback recording "([^\"]*)"$/ do |filename|
|
237
|
-
playback(filename)
|
238
|
-
sleep(STEP_PAUSE)
|
239
|
-
end
|
240
|
-
|
241
|
-
Then /^I playback recording "([^\"]*)" on "([^\"]*)"$/ do |filename, name|
|
242
|
-
playback(filename, {:query => "view marked:'#{name}'"})
|
243
|
-
sleep(STEP_PAUSE)
|
244
|
-
end
|
245
|
-
|
246
|
-
Then /^I playback recording "([^\"]*)" on "([^\"]*)" with offset (\d+),(\d+)$/ do |filename, name, x, y|
|
247
|
-
x = x.to_i
|
248
|
-
y = y.to_i
|
249
|
-
playback(filename, {:query => "view marked:'#{name}'", :offset => {:x => x, :y => y}})
|
250
|
-
sleep(STEP_PAUSE)
|
251
|
-
end
|
252
|
-
|
253
|
-
Then /^I reverse playback recording "([^\"]*)"$/ do |filename|
|
254
|
-
playback(filename, {:reverse => true})
|
255
|
-
sleep(STEP_PAUSE)
|
256
|
-
end
|
257
|
-
|
258
|
-
Then /^I reverse playback recording "([^\"]*)" on "([^\"]*)"$/ do |filename, name|
|
259
|
-
playback(filename, {:query => "view marked:'#{name}'",:reverse => true})
|
260
|
-
sleep(STEP_PAUSE)
|
261
|
-
end
|
262
|
-
|
263
|
-
Then /^I reverse playback recording "([^\"]*)" on "([^\"]*)" with offset (\d+),(\d+)$/ do |filename, name, x, y|
|
264
|
-
x = x.to_i
|
265
|
-
y = y.to_i
|
266
|
-
playback(filename, {:query => "view marked:'#{name}'", :offset => {:x => x, :y => y},:reverse => true})
|
267
|
-
sleep(STEP_PAUSE)
|
268
|
-
end
|
269
|
-
|
270
|
-
|
271
|
-
### Device orientation ###
|
272
|
-
Then /^I rotate device (left|right)$/ do |dir|
|
273
|
-
dir = dir.to_sym
|
274
|
-
rotate(dir)
|
275
|
-
sleep(5)#SERVO wait
|
276
|
-
end
|
277
|
-
|
278
|
-
Then /^I send app to background for (\d+) seconds$/ do |secs|
|
279
|
-
secs = secs.to_f
|
280
|
-
background(secs)
|
281
|
-
sleep(secs+10)
|
282
|
-
end
|
283
|
-
|
284
|
-
### Assertions ###
|
285
|
-
Then /^I should see "([^\"]*)"$/ do |expected_mark|
|
286
|
-
res = (element_exists( "view marked:'#{expected_mark}'" ) or
|
287
|
-
element_exists( "view text:'#{expected_mark}'"))
|
288
|
-
if not res
|
289
|
-
screenshot_and_raise "No element found with mark or text: #{expected_mark}"
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
Then /^I should not see "([^\"]*)"$/ do |expected_mark|
|
294
|
-
res = query("view marked:'#{expected_mark}'")
|
295
|
-
res.concat query("view text:'#{expected_mark}'")
|
296
|
-
unless res.empty?
|
297
|
-
screenshot_and_raise "Expected no element with text nor accessibilityLabel: #{expected_mark}, found #{res.join(", ")}"
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
Then /^I should see a "([^\"]*)" button$/ do |expected_mark|
|
302
|
-
check_element_exists("button marked:'#{expected_mark}'")
|
303
|
-
end
|
304
|
-
Then /^I should not see a "([^\"]*)" button$/ do |expected_mark|
|
305
|
-
check_element_does_not_exist("button marked:'#{expected_mark}'")
|
306
|
-
end
|
307
|
-
|
308
|
-
Then /^I don't see the text "([^\"]*)"$/ do |text|
|
309
|
-
macro %Q|I should not see "#{text}"|
|
310
|
-
end
|
311
|
-
Then /^I don't see the "([^\"]*)"$/ do |text|
|
312
|
-
macro %Q|I should not see "#{text}"|
|
313
|
-
end
|
314
|
-
|
315
|
-
Then /^I see the text "([^\"]*)"$/ do |text|
|
316
|
-
macro %Q|I should see "#{text}"|
|
317
|
-
end
|
318
|
-
Then /^I see the "([^\"]*)"$/ do |text|
|
319
|
-
macro %Q|I should see "#{text}"|
|
320
|
-
end
|
321
|
-
|
322
|
-
Then /^I (?:should)? see text starting with "([^\"]*)"$/ do |text|
|
323
|
-
res = query("view {text BEGINSWITH '#{text}'}").empty?
|
324
|
-
if res
|
325
|
-
screenshot_and_raise "No text found starting with: #{text}"
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
|
-
Then /^I (?:should)? see text containing "([^\"]*)"$/ do |text|
|
330
|
-
res = query("view {text LIKE '*#{text}*'}").empty?
|
331
|
-
if res
|
332
|
-
screenshot_and_raise "No text found containing: #{text}"
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
|
-
Then /^I (?:should)? see text ending with "([^\"]*)"$/ do |text|
|
337
|
-
res = query("view {text ENDSWITH '#{text}'}").empty?
|
338
|
-
if res
|
339
|
-
screenshot_and_raise "No text found ending with: #{text}"
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
Then /^I see (\d+) (?:input|text) field(?:s)?$/ do |count|
|
344
|
-
count = count.to_i
|
345
|
-
cnt = query(:textField).count
|
346
|
-
if cnt < count
|
347
|
-
screenshot_and_raise "Expected at least #{count} text/input fields, found #{cnt}"
|
348
|
-
end
|
349
|
-
end
|
350
|
-
|
351
|
-
Then /^I should see a "([^\"]*)" (?:input|text) field$/ do |expected_mark|
|
352
|
-
res = element_exists("textField placeholder:'#{expected_mark}'") or
|
353
|
-
element_exists("textField marked:'#{expected_mark}'")
|
354
|
-
unless res
|
355
|
-
screenshot_and_raise "Expected textfield with placeholder or accessibilityLabel: #{txt}"
|
356
|
-
end
|
357
|
-
end
|
358
|
-
|
359
|
-
Then /^I should not see a "([^\"]*)" (?:input|text) field$/ do |expected_mark|
|
360
|
-
res = query("textField placeholder:'#{expected_mark}'")
|
361
|
-
res.concat query("textField marked:'#{expected_mark}'")
|
362
|
-
unless res.empty?
|
363
|
-
screenshot_and_raise "Expected no textfield with placeholder nor accessibilityLabel: #{txt}, found #{res}"
|
364
|
-
end
|
365
|
-
end
|
366
|
-
|
367
|
-
|
368
|
-
Then /^I should see a map$/ do
|
369
|
-
check_element_exists("view:'MKMapView'")
|
370
|
-
end
|
371
|
-
|
372
|
-
Then /^I should see (?:the)? user location$/ do
|
373
|
-
check_element_exists("view:'MKUserLocationView'")
|
374
|
-
end
|
1
|
+
require File.join(File.dirname(__FILE__),'..','..','features','step_definitions',"calabash_steps")
|
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.
|
4
|
+
version: 0.9.65
|
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-06-
|
12
|
+
date: 2012-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: json
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: CFPropertyList
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,21 +53,31 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: sim_launcher
|
49
|
-
requirement: &70095560792800 !ruby/object:Gem::Requirement
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
57
|
none: false
|
51
58
|
requirements:
|
52
59
|
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: sim_launcher
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - '='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.3.8
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - '='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.3.8
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: slowhandcuke
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: net-http-persistent
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,7 +101,12 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :runtime
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
description: calabash-cucumber drives tests for native iOS apps. You must link your
|
81
111
|
app with calabash-ios-server framework to execute tests.
|
82
112
|
email:
|
@@ -109,6 +139,7 @@ files:
|
|
109
139
|
- features-skeleton/support/env.rb
|
110
140
|
- features-skeleton/support/hooks.rb
|
111
141
|
- features-skeleton/support/launch.rb
|
142
|
+
- features/step_definitions/calabash_steps.rb
|
112
143
|
- lib/calabash-cucumber.rb
|
113
144
|
- lib/calabash-cucumber/calabash_steps.rb
|
114
145
|
- lib/calabash-cucumber/color_helper.rb
|
@@ -205,8 +236,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
236
|
version: '0'
|
206
237
|
requirements: []
|
207
238
|
rubyforge_project:
|
208
|
-
rubygems_version: 1.8.
|
239
|
+
rubygems_version: 1.8.23
|
209
240
|
signing_key:
|
210
241
|
specification_version: 3
|
211
242
|
summary: Client for calabash-ios-server for automated functional testing on iOS
|
212
|
-
test_files:
|
243
|
+
test_files:
|
244
|
+
- features/step_definitions/calabash_steps.rb
|