ilesspainfulclient-cucumber 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/.hgignore +1 -0
  2. data/.idea/.name +1 -0
  3. data/.idea/.rakeTasks +7 -0
  4. data/.idea/dictionaries/krukow.xml +9 -0
  5. data/.idea/encodings.xml +5 -0
  6. data/.idea/iLessPainfulClient.iml +17 -0
  7. data/.idea/jsLibraryMappings.xml +7 -0
  8. data/.idea/misc.xml +8 -0
  9. data/.idea/modules.xml +9 -0
  10. data/.idea/vcs.xml +7 -0
  11. data/.idea/workspace.xml +626 -0
  12. data/Gemfile +4 -0
  13. data/Gemfile.lock +39 -0
  14. data/LICENSE +13 -0
  15. data/NOTICE +6 -0
  16. data/Rakefile +2 -0
  17. data/bin/ilesspainful-skeleton +19 -0
  18. data/features-skeleton/my_first.feature +8 -0
  19. data/features-skeleton/step_definitions/launch_steps.rb +0 -0
  20. data/features-skeleton/support/env.rb +1 -0
  21. data/ilesspainfulclient.gemspec +24 -0
  22. data/lib/ilesspainfulclient-cucumber/color_helper.rb +13 -0
  23. data/lib/ilesspainfulclient-cucumber/cucumber.rb +9 -0
  24. data/lib/ilesspainfulclient-cucumber/lesspainful_steps.rb +569 -0
  25. data/lib/ilesspainfulclient-cucumber/operations.rb +254 -0
  26. data/lib/ilesspainfulclient-cucumber/resources/pinch_in_ipad.base64 +188 -0
  27. data/lib/ilesspainfulclient-cucumber/resources/pinch_in_iphone.base64 +234 -0
  28. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_down_to_left_ipad.base64 +3 -0
  29. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_down_to_left_iphone.base64 +2 -0
  30. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_down_to_right_ipad.base64 +5 -0
  31. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_down_to_right_iphone.base64 +2 -0
  32. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_down_to_up_ipad.base64 +3 -0
  33. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_left_to_down_ipad.base64 +3 -0
  34. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_left_to_down_iphone.base64 +2 -0
  35. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_right_to_down_ipad.base64 +3 -0
  36. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_right_to_down_iphone.base64 +2 -0
  37. data/lib/ilesspainfulclient-cucumber/resources/swipe_left_hard_iphone.base64 +15 -0
  38. data/lib/ilesspainfulclient-cucumber/resources/swipe_left_iphone.base64 +18 -0
  39. data/lib/ilesspainfulclient-cucumber/resources/swipe_right_hard_iphone.base64 +17 -0
  40. data/lib/ilesspainfulclient-cucumber/resources/swipe_right_iphone.base64 +13 -0
  41. data/lib/ilesspainfulclient-cucumber/version.rb +5 -0
  42. data/lib/ilesspainfulclient-cucumber.rb +0 -0
  43. metadata +132 -0
@@ -0,0 +1,569 @@
1
+ WAIT_TIMEOUT = ENV['WAIT_TIMEOUT'] || 60
2
+ STEP_PAUSE = ENV['STEP_PAUSE'].to_f || 0.3
3
+
4
+ require 'rspec/expectations'
5
+
6
+ Given /^(my|the) app is running$/ do
7
+ #no-op on iOS
8
+ end
9
+
10
+
11
+ # -- Touch --#
12
+ Then /^I (press|touch) on screen (\d+)% from the left and (\d+)% from the top$/ do |x, y|
13
+ touch(nil, {:x => x, :y => y})
14
+ sleep(STEP_PAUSE)
15
+ end
16
+
17
+ Then /^I (press|touch) "([^\"]*)"$/ do |_,name|
18
+ touch("view marked:'#{name}'")
19
+ sleep(STEP_PAUSE)
20
+ end
21
+
22
+ #Then /^I (press|touch) (\d+)% right and (\d+)% down from "([^\"]*)" $/ do |_,x,y,name|
23
+ # touch({:query => "view marked:'#{name}'", :offset => {:x => x, :y => y}})
24
+ #end
25
+
26
+ Then /^I (press|touch) button number (\d+)$/ do |_,index|
27
+ raise "Index should be positive (was: #{index})" if (index<=0)
28
+ touch("button index:#{index-1}")
29
+ sleep(STEP_PAUSE)
30
+ end
31
+
32
+ Then /^I (press|touch) the "([^\"]*)" button$/ do |_,name|
33
+ touch("button marked:'#{name}'")
34
+ sleep(STEP_PAUSE)
35
+ end
36
+
37
+ # /^I press view with name "([^\"]*)"$/
38
+ # like touch "..."
39
+ # /^I press image button number (\d+)$/
40
+ # iOS doesn't have image buttons'
41
+
42
+ ##TODO note in tables views: this means visible cell index!
43
+ Then /^I (press|touch) list item number (\d+)$/ do |_,index|
44
+ 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 |name|
50
+ touch("view:'UISwitch'")
51
+ sleep(STEP_PAUSE)
52
+ end
53
+
54
+ Then /^I toggle the "([^\"]*)" switch$/ do |name|
55
+ touch("view:'UISwitch' marked:'#{name}'")
56
+ sleep(STEP_PAUSE)
57
+ end
58
+
59
+ #/^I enter "([^\"]*)" as "([^\"]*)"$/
60
+ ## -- Entering text directly --##
61
+ When /^I type "([^\"]*)" into the "([^\"]*)" text field$/ do |text_to_type, field_name|
62
+ set_text("textField placeholder:'#{field_name}'", text_to_type)
63
+ sleep(STEP_PAUSE)
64
+ end
65
+
66
+ # alias
67
+ When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |text_field, text_to_type|
68
+ puts %Q|I type "#{text_to_type}" into the "#{text_field}" text field|
69
+ When %Q|I type "#{text_to_type}" into the "#{text_field}" text field|
70
+ end
71
+
72
+ When /^I fill in text fields as follows:$/ do |table|
73
+ table.hashes.each do |row|
74
+ When %Q|I type "#{row['text']}" into the "#{row['field']}" text field|
75
+ end
76
+ end
77
+
78
+ #doesn't make sense iOS?
79
+ #Then /^I enter "([^\"]*)" into input field number (\d+)$/ do |text, index|
80
+ # text_fields_modified = frankly_map( "textField placeholder:'#{field_name}'", "setText:", text_to_type )
81
+ # raise "could not find text fields with placeholder '#{field_name}'" if text_fields_modified.empty?
82
+ #end
83
+
84
+ When /^I clear "([^\"]*)"$/ do |name|
85
+ puts %Q|I type "" into the "#{name}" text field|
86
+ When %Q|I type "" into the "#{name}" text field|
87
+ end
88
+
89
+ ##Then /^I clear input field number (\d+)$/ do |index|
90
+ # raise "Index should be positive (was: #{index})" if (index<=0)
91
+ #
92
+ #end
93
+
94
+
95
+
96
+
97
+ # -- See -- #
98
+ Then /^I wait to see "([^\"]*)"$/ do |expected_mark|
99
+ Timeout::timeout(WAIT_TIMEOUT) do
100
+ until view_with_mark_exists( expected_mark )
101
+ sleep 0.1
102
+ end
103
+ end
104
+ end
105
+
106
+ Then /^I wait to not see "([^\"]*)"$/ do |expected_mark|
107
+ sleep 2
108
+ Timeout::timeout(WAIT_TIMEOUT) do
109
+ while element_exists( "view marked:'#{expected_mark}'" )
110
+ sleep 0.1
111
+ end
112
+ end
113
+ end
114
+
115
+ Then /^I wait for "([^\"]*)" to appear$/ do |name|
116
+ Then %Q|I wait to see "#{name}"|
117
+ end
118
+
119
+ When /^I wait for ([\d\.]+) second(?:s)?$/ do |num_seconds|
120
+ num_seconds = num_seconds.to_f
121
+ sleep num_seconds
122
+ end
123
+ #/^I wait for dialog to close$/
124
+ #/^I wait for progress$/
125
+
126
+ Then /^I wait for the "([^\"]*)" button to appear$/ do |name|
127
+ Timeout::timeout(WAIT_TIMEOUT) do
128
+ until element_exists( "button marked:'#{name}'" )
129
+ sleep 0.1
130
+ end
131
+ end
132
+ end
133
+
134
+ Then /^I wait to see a navigation bar titled "([^\"]*)"$/ do |expected_mark|
135
+ Timeout::timeout(30) do
136
+ values = query('navigationItemView', :accessibilityLabel)
137
+ until values.include?(expected_mark)
138
+ values = query('navigationItemView', :accessibilityLabel)
139
+ sleep 0.1
140
+ end
141
+ end
142
+ end
143
+
144
+ Then /^I wait$/ do
145
+ sleep 2
146
+ end
147
+
148
+
149
+ Then /^I go back$/ do
150
+ touch("navigationItemButtonView first")
151
+ sleep(STEP_PAUSE)
152
+ end
153
+
154
+ Then /^take picture$/ do
155
+ sleep(STEP_PAUSE)
156
+ screenshot
157
+ end
158
+
159
+ # Note "up/down" seems to be missing on the web page?
160
+ # Should be /^I swipe (left|right|up|down)$/
161
+ Then /^I swipe (left|right)$/ do |dir|
162
+ swipe(dir)
163
+ sleep(STEP_PAUSE)
164
+ end
165
+
166
+ Then /^I swipe (left|right) on cell number (\+d)$/ do |dir,index|
167
+ raise "Index should be positive (was: #{index})" if (index<=0)
168
+ swipe(dir,{:query => "tableViewCell index:#{index-1}"})
169
+ sleep(STEP_PAUSE)
170
+ end
171
+
172
+
173
+ ##pinch##
174
+ Then /^I pinch to zoom (in|out)$/ do |in_out|
175
+ pinch(in_out)
176
+ sleep([STEP_PAUSE+4,6].max)
177
+ end
178
+
179
+ Then /^I pinch to zoom (in|out) on "([^\"]*)"$/ do |in_out, name|
180
+ pinch(in_out,{:query => "view marked:'#{name}'"})
181
+ sleep([STEP_PAUSE+4,6].max)
182
+ end
183
+
184
+ # Note "up/left/right" seems to be missing on the web page
185
+ Then /^I scroll (left|right|up|down)$/ do |dir|
186
+ scroll("scrollView index:0", dir)
187
+ sleep(STEP_PAUSE)
188
+ end
189
+
190
+ Then /^I scroll (left|right|up|down) on "([^\"]*)"$/ do |dir,name|
191
+ scroll("view marked:'#{name}'", dir)
192
+ sleep(STEP_PAUSE)
193
+ end
194
+
195
+
196
+
197
+ ### Playback ###
198
+ Then /^I playback recording "([^"]*)"$/ do |filename|
199
+ playback("#{filename}_#{ENV['DEVICE']}")
200
+ sleep(STEP_PAUSE)
201
+ end
202
+
203
+ Then /^I playback recording "([^"]*) on "([^"]*)"$/ do |filename, name|
204
+ playback("#{filename}_#{ENV['DEVICE']}", {:query => "view marked:'#{name}'"})
205
+ sleep(STEP_PAUSE)
206
+ end
207
+
208
+ Then /^I playback recording "([^"]*) on "([^"]*)" with offset (\d+),(\d+)$/ do |filename, name, x, y|
209
+ x = x.to_i
210
+ y = y.to_i
211
+ playback("#{filename}_#{ENV['DEVICE']}", {:query => "view marked:'#{name}'", :offset => {:x => x, :y => y}})
212
+ sleep(STEP_PAUSE)
213
+ end
214
+
215
+ Then /^I reverse playback recording "([^"]*)"$/ do |filename|
216
+ playback("#{filename}_#{ENV['DEVICE']}", {:reverse => true})
217
+ sleep(STEP_PAUSE)
218
+ end
219
+
220
+ Then /^I reverse playback recording "([^"]*) on "([^"]*)"$/ do |filename, name|
221
+ playback("#{filename}_#{ENV['DEVICE']}", {:query => "view marked:'#{name}'",:reverse => true})
222
+ sleep(STEP_PAUSE)
223
+ end
224
+
225
+ Then /^I reverse playback recording "([^"]*) on "([^"]*)" with offset (\d+),(\d+)$/ do |filename, name, x, y|
226
+ x = x.to_i
227
+ y = y.to_i
228
+ playback("#{filename}_#{ENV['DEVICE']}", {:query => "view marked:'#{name}'", :offset => {:x => x, :y => y},:reverse => true})
229
+ sleep(STEP_PAUSE)
230
+ end
231
+
232
+
233
+ ### Device orientation ###
234
+ Then /^I rotate device (left|right)$/ do |dir|
235
+ dir = dir.to_sym
236
+ rotate(dir)
237
+ sleep(STEP_PAUSE)
238
+ end
239
+
240
+ Then /^I send app to background for (\d+) seconds$/ do |secs|
241
+ secs = secs.to_f
242
+ background(secs)
243
+ end
244
+
245
+ ### Assertions ###
246
+ Then /^I should see "([^\"]*)"$/ do |expected_mark|
247
+ check_element_exists("view marked:'#{expected_mark}'")
248
+ end
249
+
250
+ Then /^I should not see "([^\"]*)"$/ do |expected_mark|
251
+ check_element_does_not_exist("view marked:'#{expected_mark}'")
252
+ end
253
+
254
+ Then /^I should see a "([^\"]*)" button$/ do |expected_mark|
255
+ check_element_exists("button marked:'#{expected_mark}'")
256
+ end
257
+ Then /^I should not see a "([^\"]*)" button$/ do |expected_mark|
258
+ check_element_does_not_exist("button marked:'#{expected_mark}'")
259
+ end
260
+
261
+ Then /^I don't see the text "([^\"]*)"$/ do |text|
262
+ Then %Q|I should not see "#{text}"|
263
+ end
264
+ Then /^I don't see the "([^\"]*)"$/ do |text|
265
+ Then %Q|I should not see "#{text}"|
266
+ end
267
+
268
+ Then /^I see the text "([^\"]*)"$/ do |text|
269
+ Then %Q|I should see "#{text}"|
270
+ end
271
+ Then /^I see the "([^\"]*)"$/ do |text|
272
+ Then %Q|I should see "#{text}"|
273
+ end
274
+
275
+
276
+
277
+ #** TODO /^I dont see the text "([^\"]*)"$/
278
+ # /^I dont see the "([^\"]*)"$/ do |text|
279
+ #
280
+ # the ruby block is a copy-paste on the web.
281
+ # I would say I should see and I should not see
282
+ # seems more natural.
283
+ #
284
+ # OK
285
+ #
286
+
287
+ #
288
+ #
289
+ #
290
+ #Then /I should see the following:/ do |table|
291
+ # values = frankly_map( 'view', 'accessibilityLabel' )
292
+ # table.raw.each do |expected_mark|
293
+ # values.should include( expected_mark.first )
294
+ # end
295
+ #end
296
+ #
297
+ #Then /I should not see the following:/ do |table|
298
+ # values = frankly_map( 'view', 'accessibilityLabel' )
299
+ # table.raw.each do |expected_mark|
300
+ # values.should_not include( expected_mark.first )
301
+ # end
302
+ #end
303
+ #
304
+ #Then /^I should see a navigation bar titled "([^\"]*)"$/ do |expected_mark|
305
+ # values = frankly_map( 'navigationItemView', 'accessibilityLabel' )
306
+ # values.should include(expected_mark)
307
+ #end
308
+ #
309
+ #Then /^I should see an alert view titled "([^\"]*)"$/ do |expected_mark|
310
+ # values = frankly_map( 'alertView', 'message')
311
+ # puts values
312
+ # values.should include(expected_mark)
313
+ #end
314
+ #
315
+ #Then /^I should not see an alert view$/ do
316
+ # check_element_does_not_exist( 'alertView' )
317
+ #end
318
+ #
319
+ #Then /^I should see an element of class "([^\"]*)" with name "([^\"]*)" with the following labels: "([^\"]*)"$/ do |className, classLabel, listOfLabels|
320
+ # arrayOfLabels = listOfLabels.split(',');
321
+ # arrayOfLabels.each do |label|
322
+ # check_element_exists("view marked:'#{classLabel}' parent view:'#{className}' descendant view marked:'#{label}'")
323
+ # end
324
+ #end
325
+ #
326
+ #Then /^I should see an element of class "([^\"]*)" with name "([^\"]*)" with a "([^\"]*)" button$/ do |className, classLabel, buttonName|
327
+ # check_element_exists("view marked:'#{classLabel}' parent view:'#{className}' descendant button marked:'#{buttonName}'")
328
+ #end
329
+ #
330
+ #Then /^I should not see a hidden button marked "([^\"]*)"$/ do |expected_mark|
331
+ # element_is_not_hidden("button marked:'#{expected_mark}'").should be_false
332
+ #end
333
+ #
334
+ #Then /^I should see a nonhidden button marked "([^\"]*)"$/ do |expected_mark|
335
+ # element_is_not_hidden("button marked:'#{expected_mark}'").should be_true
336
+ #end
337
+ #
338
+ #Then /^I should see an element of class "([^\"]*)"$/ do |className|
339
+ # element_is_not_hidden("view:'#{className}'")
340
+ #end
341
+ #
342
+ #Then /^I should not see an element of class "([^\"]*)"$/ do |className|
343
+ # selector = "view:'#{className}'"
344
+ # element_exists_and_is_not_hidden = element_exists( selector ) && element_is_not_hidden(selector)
345
+ # element_exists_and_is_not_hidden.should be_false
346
+ #end
347
+ #
348
+ #
349
+ ## -- Type/Fill in -- #
350
+ #
351
+ #When /^I type "([^\"]*)" into the "([^\"]*)" text field$/ do |text_to_type, field_name|
352
+ # text_fields_modified = frankly_map( "textField placeholder:'#{field_name}'", "setText:", text_to_type )
353
+ # raise "could not find text fields with placeholder '#{field_name}'" if text_fields_modified.empty?
354
+ # #TODO raise warning if text_fields_modified.count > 1
355
+ #end
356
+ #
357
+ ## alias
358
+ #When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |text_field, text_to_type|
359
+ # puts %Q|I type "#{text_to_type}" into the "#{text_field}" text field|
360
+ # When %Q|I type "#{text_to_type}" into the "#{text_field}" text field|
361
+ #end
362
+ #
363
+ #When /^I fill in text fields as follows:$/ do |table|
364
+ # table.hashes.each do |row|
365
+ # When %Q|I type "#{row['text']}" into the "#{row['field']}" text field|
366
+ # end
367
+ #end
368
+ #
369
+ ## -- Rotate -- #
370
+ #Given /^the device is in (a )?landscape orientation$/ do |ignored|
371
+ # # for some reason the simulator sometimes starts of reporting its orientation as 'flat'. Workaround for this is to rotate the device then wait a bit
372
+ # if 'flat' == frankly_current_orientation
373
+ # rotate_simulator_right
374
+ # sleep 1
375
+ # end
376
+ #
377
+ # unless frankly_oriented_landscape?
378
+ # rotate_simulator_left
379
+ # sleep 1
380
+ # raise "expected orientation to be landscape after rotating left, but it is #{frankly_current_orientation}" unless frankly_oriented_landscape?
381
+ # end
382
+ #end
383
+ #
384
+ #Given /^the device is in (a )?portrait orientation$/ do |ignored|
385
+ # # for some reason the simulator sometimes starts of reporting its orientation as 'flat'. Workaround for this is to rotate the device then wait a bit
386
+ # if 'flat' == frankly_current_orientation
387
+ # rotate_simulator_right
388
+ # sleep 1
389
+ # end
390
+ #
391
+ # unless frankly_oriented_portrait?
392
+ # rotate_simulator_left
393
+ # sleep 1
394
+ # raise "Expected orientation to be portrait after rotating left, but it is #{frankly_current_orientation}" unless frankly_oriented_portrait?
395
+ # end
396
+ #end
397
+ #
398
+ #When /^I simulate a memory warning$/ do
399
+ # simulate_memory_warning
400
+ #end
401
+ #
402
+ #Then /^I rotate to the "([^\"]*)"$/ do |direction|
403
+ # if direction == "right"
404
+ # rotate_simulator_right
405
+ # elsif direction == "left"
406
+ # rotate_simulator_left
407
+ # else
408
+ # raise %Q|Rotation direction specified ("#{direction}") is invalid. Please specify right or left.|
409
+ # end
410
+ # sleep 1
411
+ #end
412
+ #
413
+ ## -- touch -- #
414
+ #When /^I touch "([^\"]*)"$/ do |mark|
415
+ # selector = "view marked:'#{mark}' first"
416
+ # if element_exists(selector)
417
+ # touch( selector )
418
+ # else
419
+ # raise "Could not touch [#{mark}], it does not exist."
420
+ # end
421
+ # sleep 1
422
+ #end
423
+ #
424
+ #When /^I touch "([^\"]*)" if exists$/ do |mark|
425
+ # sleep 1
426
+ # selector = "view marked:'#{mark}' first"
427
+ # if element_exists(selector)
428
+ # touch(selector)
429
+ # sleep 1
430
+ # end
431
+ #end
432
+ #
433
+ #When /^I touch the first table cell$/ do
434
+ # touch("tableViewCell first")
435
+ #end
436
+ #
437
+ #When /^I swipe the first table cell?/ do
438
+ # swipe( "tableViewCell index:0", :right)
439
+ # sleep 2 # give the UI a chance to animate the swipe
440
+ #end
441
+ #
442
+ #
443
+ #When /^I touch the table cell marked "([^\"]*)"$/ do |mark|
444
+ # touch("tableViewCell marked:'#{mark}'")
445
+ #end
446
+ #
447
+ #When /^I swipe the table cell marked "([^\"]*)"$/ do |cell_index_s|
448
+ # swipe( "tableViewCell marked:'#{mark}'", :right)
449
+ # sleep 2 # give the UI a chance to animate the swipe
450
+ #end
451
+ #
452
+ #
453
+ #When /^I touch the (\d*)(?:st|nd|rd|th)? table cell$/ do |ordinal|
454
+ # ordinal = ordinal.to_i - 1
455
+ # touch("tableViewCell index:#{ordinal}")
456
+ #
457
+ #end
458
+ #
459
+ #
460
+ #When /^I swipe the (\d*)(?:st|nd|rd|th)? table cell?/ do |cell_index_s|
461
+ # cell_index = cell_index_s.to_i - 1 #index 0 corresponds to 1st
462
+ # raise "Row should have a positive index" if cell_index <= 0
463
+ # swipe( "tableViewCell index:#{cell_index}", :right)
464
+ # sleep 2 # give the UI a chance to animate the swipe
465
+ #end
466
+ #
467
+ #
468
+ #Then /I touch the following:/ do |table|
469
+ # values = frankly_map( 'view', 'accessibilityLabel' )
470
+ # table.raw.each do |expected_mark|
471
+ # touch( "view marked:'#{expected_mark}'" )
472
+ # sleep 2
473
+ # end
474
+ #end
475
+ #
476
+ #When /^I touch the button marked "([^\"]*)"$/ do |mark|
477
+ # touch( "button marked:'#{mark}'" )
478
+ #end
479
+ #
480
+ #When /^I touch the "([^\"]*)" action sheet button$/ do |mark|
481
+ # touch( "actionSheet threePartButton marked:'#{mark}'" )
482
+ #end
483
+ #
484
+ #When /^I touch the (\d*)(?:st|nd|rd|th)? action sheet button$/ do |ordinal|
485
+ # ordinal = ordinal.to_i
486
+ # touch( "actionSheet threePartButton tag:#{ordinal}" )
487
+ #end
488
+ #
489
+ #When /^I touch the (\d*)(?:st|nd|rd|th)? alert view button$/ do |ordinal|
490
+ # ordinal = ordinal.to_i
491
+ # touch( "alertView threePartButton tag:#{ordinal}" )
492
+ #end
493
+ #
494
+ ## -- switch -- #
495
+ #
496
+ #When /^I flip switch "([^\"]*)" on$/ do |mark|
497
+ # selector = "view:'UISwitch' marked:'#{mark}'"
498
+ # views_switched = frankly_map( selector, 'setOn:animated:', true, true )
499
+ # raise "could not find anything matching [#{uiquery}] to switch" if views_switched.empty?
500
+ #end
501
+ #
502
+ #When /^I flip switch "([^\"]*)" off$/ do |mark|
503
+ # selector = "view:'UISwitch' marked:'#{mark}'"
504
+ # views_switched = frankly_map( selector, 'setOn:animated:', false, true )
505
+ # raise "could not find anything matching [#{uiquery}] to switch" if views_switched.empty?
506
+ #end
507
+ #
508
+ #When /^I flip switch "([^\"]*)"$/ do |mark|
509
+ # touch("view:'UISwitch' marked:'#{mark}'")
510
+ #end
511
+ #
512
+ #Then /^switch "([^\"]*)" should be on$/ do |mark|
513
+ ## switch_states = frankly_map( "view:'Switch' marked:'#{mark}'", "isOn" )
514
+ # switch_states = frankly_map( "view accesibilityLabel:'#{mark}'", "isOn" )
515
+ # puts "test #{switch_states.inspect}"
516
+ #
517
+ # if switch_states == 0
518
+ # puts "Switch #{mark} is ON"
519
+ # else
520
+ # puts "Switch #{mark} is OFF, flim switch ON"
521
+ # Then %Q|I flip switch "#{mark}"|
522
+ # end
523
+ #end
524
+ #
525
+ #Then /^switch "([^\"]*)" should be off$/ do |mark|
526
+ # switch_states = frankly_map( "view:'UISwitch' marked:'#{mark}'", "isOn" )
527
+ # puts "test #{switch_states.inspect}"
528
+ #
529
+ # if switch_states == 0
530
+ # puts "Switch #{mark} is ON, flip switch OFF"
531
+ # Then %Q|I flip switch "#{mark}"|
532
+ # else
533
+ # puts "Switch #{mark} is OFF"
534
+ # end
535
+ #end
536
+ #
537
+ #
538
+ ## -- misc -- #
539
+ #
540
+ #When /^I wait for ([\d\.]+) second(?:s)?$/ do |num_seconds|
541
+ # num_seconds = num_seconds.to_f
542
+ # sleep num_seconds
543
+ #end
544
+ #
545
+ #Then /^a pop\-over menu is displayed with the following:$/ do |table|
546
+ # sleep 1
547
+ # table.raw.each do |expected_mark|
548
+ # check_element_exists "actionSheet view marked:'#{expected_mark}'"
549
+ # end
550
+ #end
551
+ #
552
+ #Then /^I navigate back$/ do
553
+ # touch( "navigationItemButtonView" )
554
+ #end
555
+ #
556
+ #When /^I dump the DOM$/ do
557
+ # dom = frankly_dump
558
+ #end
559
+ #
560
+ #When /^I touch Done$/ do
561
+ # frankly_map('kBKeyView last','touch')
562
+ #end
563
+ #When /^I touch Next$/ do
564
+ # frankly_map('kBKeyView last','touch')
565
+ #end
566
+ #
567
+ #When /^I quit the simulator/ do
568
+ # quit_simulator
569
+ #end