briar 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +8 -8
  2. data/Rakefile +6 -11
  3. data/bin/briar +58 -0
  4. data/bin/briar_helpers.rb +28 -2
  5. data/briar.gemspec +3 -2
  6. data/features/step_definitions/alerts_and_sheets/action_sheet_steps.rb +10 -4
  7. data/features/step_definitions/alerts_and_sheets/alert_view_steps.rb +3 -10
  8. data/features/step_definitions/bars/navbar_steps.rb +1 -9
  9. data/features/step_definitions/bars/tabbar_steps.rb +2 -4
  10. data/features/step_definitions/bars/toolbar_steps.rb +2 -11
  11. data/features/step_definitions/control/button_steps.rb +3 -8
  12. data/features/step_definitions/control/segmented_control_steps.rb +20 -58
  13. data/features/step_definitions/email_steps.rb +10 -7
  14. data/features/step_definitions/keyboard_steps.rb +7 -2
  15. data/features/step_definitions/picker/date_picker_steps.rb +21 -177
  16. data/features/step_definitions/table_steps.rb +35 -71
  17. data/features/step_definitions/text_field_steps.rb +1 -5
  18. data/features/step_definitions/text_view_steps.rb +2 -2
  19. data/install-calabash-framework.sh.example +10 -0
  20. data/lib/briar.rb +31 -5
  21. data/lib/briar/alerts_and_sheets/action_sheet.rb +99 -0
  22. data/lib/briar/alerts_and_sheets/alert_view.rb +25 -4
  23. data/lib/briar/bars/navbar.rb +30 -19
  24. data/lib/briar/bars/tabbar.rb +7 -4
  25. data/lib/briar/bars/toolbar.rb +14 -1
  26. data/lib/briar/briar_core.rb +46 -15
  27. data/lib/briar/control/button.rb +35 -1
  28. data/lib/briar/control/segmented_control.rb +69 -8
  29. data/lib/briar/control/slider.rb +2 -2
  30. data/lib/briar/cucumber.rb +3 -1
  31. data/lib/briar/email.rb +19 -13
  32. data/lib/briar/keyboard.rb +50 -10
  33. data/lib/briar/label.rb +20 -0
  34. data/lib/briar/picker/date_picker.rb +88 -584
  35. data/lib/briar/picker/date_picker_core.rb +293 -0
  36. data/lib/briar/picker/date_picker_manipulation.rb +255 -0
  37. data/lib/briar/picker/picker.rb +10 -0
  38. data/lib/briar/table.rb +261 -93
  39. data/lib/briar/version.rb +1 -1
  40. data/spec/spec_helper.rb +0 -2
  41. metadata +14 -13
  42. data/lib/briar/gestalt.rb +0 -87
  43. data/spec/briar/gestalt_spec.rb +0 -66
@@ -28,5 +28,15 @@ module Briar
28
28
  titles = visible_titles column
29
29
  titles[selected_idx]
30
30
  end
31
+
32
+ def scroll_picker(dir, picker_id)
33
+ should_see_picker picker_id
34
+ if dir.eql? 'down'
35
+ picker_scroll_down_on_column 0
36
+ else
37
+ picker_scroll_up_on_column 0
38
+ end
39
+ step_pause
40
+ end
31
41
  end
32
42
  end
data/lib/briar/table.rb CHANGED
@@ -2,97 +2,126 @@
2
2
 
3
3
  module Briar
4
4
  module Table
5
- def query_str_row_in_table (row_id, table_id = nil)
5
+
6
+ def query_str_for_row_content (row_id, table_id = nil)
7
+ base = query_str_for_row row_id, table_id
8
+ "#{base} tableViewCellContentView descendant"
9
+ end
10
+
11
+ def query_str_for_row (row_id, table_id = nil)
6
12
  table_id == nil ?
7
13
  "tableViewCell marked:'#{row_id}'" :
8
- "tableView marked:'#{table_id}' child tableViewCell marked:'#{row_id}'"
14
+ "tableView marked:'#{table_id}' descendant tableViewCell marked:'#{row_id}'"
9
15
  end
10
16
 
11
- def query_str_rows_in_table (table_id = nil)
17
+ def query_str_for_rows (table_id = nil)
12
18
  table_id == nil ?
13
19
  'tableViewCell' :
14
- "tableView marked:'#{table_id}' child tableViewCell"
20
+ "tableView marked:'#{table_id}' descendant tableViewCell"
15
21
  end
16
22
 
17
- def query_str_table (table_id = nil)
23
+ def query_str_for_table (table_id = nil)
18
24
  table_id == nil ?
19
25
  'tableView' :
20
26
  "tableView marked:'#{table_id}'"
21
27
  end
22
28
 
23
- def row_exists? (row_id, table_id = nil)
24
- query_str = query_str_row_in_table row_id, table_id
25
- exists = !query(query_str, :accessibilityIdentifier).empty?
26
- # if row cannot be found just return false
27
- return false unless exists
28
-
29
- all_rows = query(query_str_rows_in_table(table_id), :accessibilityIdentifier)
30
- index = all_rows.index(row_id)
31
-
32
- # problems only happen if we are dealing with the first or last index
33
- return exists if index != 0 and index != (all_rows.length - 1)
29
+ def table_has_calabash_additions
30
+ success_value = '1'
31
+ res = query('tableView', [{hasCalabashAdditions: success_value}])
32
+ screenshot_and_raise 'table is not visible' if res.empty?
33
+ res.first.eql? success_value
34
+ end
34
35
 
35
- if index == 0 or index == (all_rows.length - 1)
36
- # collect information about the table, row, and content offset
37
- content_offset_y = query('tableView', :contentOffset).first['Y']
38
- frame = query(query_str).first['frame']
39
- cell_h = frame['height'].to_f
40
- cell_y = frame['y'].to_f
41
- table_h = query(query_str_table(table_id)).first['frame']['height']
36
+ #noinspection RubyUnusedLocalVariable
37
+ def row_exists? (row_id, table_id = nil)
38
+ pending "deprecated 0.0.8 - use 'row_visible?' instead"
39
+ end
42
40
 
43
- # if the row is the first row and there has been no scrolling, just return true
44
- return true if index == 0 and content_offset_y == 0
45
- # if the row is the first row and more than half of it is visible
46
- return (content_offset_y + cell_y + (cell_h/2.0))/content_offset_y >= 2.0 if index == 0
47
- # if the row is the last row and more than half of it is visible
48
- return (table_h - (cell_y - content_offset_y))/(cell_h/2.0) >= 1.0 if index == (all_rows.length - 1)
49
- end
41
+ def row_visible? (row_id, table_id = nil)
42
+ query_str = query_str_for_row row_id, table_id
43
+ !query(query_str, AI).empty?
44
+
45
+ #query_str = query_str_row_in_table row_id, table_id
46
+ #exists = !query(query_str, AI).empty?
47
+ ## if row cannot be found just return false
48
+ #return false unless exists
49
+ #
50
+ #all_rows = query(query_str_rows_in_table(table_id), AI)
51
+ #index = all_rows.index(row_id)
52
+ #
53
+ ## problems only happen if we are dealing with the first or last index
54
+ #return exists if index != 0 and index != (all_rows.length - 1)
55
+ #
56
+ #if index == 0 or index == (all_rows.length - 1)
57
+ # # collect information about the table, row, and content offset
58
+ # content_offset_y = query('tableView', :contentOffset).first['Y']
59
+ # frame = query(query_str).first['frame']
60
+ # cell_h = frame['height'].to_f
61
+ # cell_y = frame['y'].to_f
62
+ # table_h = query(query_str_table(table_id)).first['frame']['height']
63
+ #
64
+ # # if the row is the first row and there has been no scrolling, just return true
65
+ # return true if index == 0 and content_offset_y == 0
66
+ # # if the row is the first row and more than half of it is visible
67
+ # return (content_offset_y + cell_y + (cell_h/2.0))/content_offset_y >= 2.0 if index == 0
68
+ # # if the row is the last row and more than half of it is visible
69
+ # return (table_h - (cell_y - content_offset_y))/(cell_h/2.0) >= 1.0 if index == (all_rows.length - 1)
70
+ #end
50
71
  end
51
72
 
52
73
  def should_see_row (row_id, table_id = nil)
53
- unless row_exists? row_id, table_id
54
- screenshot_and_raise "i do not see a row named #{row_id}"
74
+ unless row_visible? row_id, table_id
75
+ screenshot_and_raise "i do not see a row '#{row_id}'"
55
76
  end
56
77
  end
57
78
 
58
79
 
59
- def should_not_see_row(row_id)
60
- if row_exists? row_id
80
+ def should_not_see_row(row_id, table_id=nil)
81
+ if row_visible? row_id, table_id
61
82
  screenshot_and_raise "i should not have seen row named #{row_id}"
62
83
  end
63
84
  end
64
85
 
65
- def query_str_for_label_and_text_exists (row_id, label_id, table_id = nil)
66
- table_id == nil ?
67
- "tableViewCell marked:'#{row_id}' isHidden:0 descendant label marked:'#{label_id}'" :
68
- "tableView marked:'#{table_id}' child tableViewCell marked:'#{row_id}' isHidden:0 descendant label marked:'#{label_id}'"
86
+ def wait_for_row(row_id, options={:table_id => nil,
87
+ :timeout => 1.0})
88
+ table_id = options[:table_id]
89
+ query_str = query_str_for_row row_id, table_id
90
+ timeout = options[:timeout] || 1.0
91
+ msg = "waited for '#{timeout}' seconds but did not see row '#{query_str}' with query '#{query_str}'"
92
+ wait_for(:timeout => timeout,
93
+ :retry_frequency => 0.2,
94
+ :post_timeout => 0.1,
95
+ :timeout_message => msg ) do
96
+ row_visible? row_id, table_id
97
+ end
98
+ end
99
+
69
100
 
101
+ def query_str_for_label_and_text_exists (row_id, label_id, table_id = nil)
102
+ query_str = query_str_for_row_content row_id, table_id
103
+ "#{query_str} label marked:'#{label_id}'"
70
104
  end
71
105
 
72
106
  def row_with_label_and_text_exists? (row_id, label_id, text, table_id = nil)
73
107
  should_see_row row_id
74
- #arr = query("tableViewCell marked:'#{row_id}' isHidden:0 descendant label marked:'#{label_id}'", :text)
75
- arr = query(query_str_for_label_and_text_exists(row_id, label_id, table_id), :text)
76
- ## iOS 4 and 5
77
-
108
+ arr = query(query_str_for_label_and_text_exists(row_id, label_id, table_id), :text)
78
109
  (arr.length == 1) and (arr.first.eql? text)
79
110
  end
80
111
 
81
-
82
-
83
- def should_see_row_with_label_with_text (row_id, label_id, text)
84
- should_see_row row_id
85
- unless row_with_label_and_text_exists? row_id, label_id, text
86
- actual = query("tableViewCell marked:'#{row_id}' child tableViewCellContentView child label marked:'#{label_id}'", :text).first
112
+ def should_see_row_with_label_with_text (row_id, label_id, text, table_id=nil)
113
+ should_see_row row_id, table_id
114
+ unless row_with_label_and_text_exists? row_id, label_id, text, table_id
115
+ query_str = query_str_for_row_content row_id, table_id
116
+ actual = query("#{query_str} label marked:'#{label_id}'", :text).first
87
117
  screenshot_and_raise "expected to see row '#{row_id}' with label '#{label_id}' that has text '#{text}', but found '#{actual}'"
88
118
  end
89
119
  end
90
120
 
91
121
  def should_see_row_with_image (row_id, image_id, table_id = nil)
92
122
  should_see_row row_id, table_id
93
- query_base = query_str_row_in_table row_id, table_id
94
- query_str = "#{query_base} child tableViewCellContentView child imageView marked:'#{image_id}'"
95
- if query(query_str).empty?
123
+ query_str = query_str_for_row_content row_id, table_id
124
+ if query("#{query_str} imageView marked:'#{image_id}'").empty?
96
125
  if table_id == nil
97
126
  screenshot_and_raise "expected to see row '#{row_id}' with image view '#{image_id}'"
98
127
  else
@@ -102,13 +131,41 @@ module Briar
102
131
  end
103
132
 
104
133
 
105
- def scroll_until_i_see_row (dir, row_id)
106
- wait_poll({:until_exists => "tableView descendant tableViewCell marked:'#{row_id}'",
134
+ def briar_scroll_to_row (row_id, table_id=nil)
135
+ unless table_id.nil?
136
+ should_see_table row_id
137
+ end
138
+
139
+ query_str = query_str_for_table table_id
140
+
141
+ msg = "could find row marked '#{row_id}' in table '#{query_str}'"
142
+ options = {:query => query_str,
143
+ :scroll_position => :middle,
144
+ :animate => true,
145
+ :failed_message => msg}
146
+ scroll_to_row_with_mark row_id, options
147
+ # you will be tempted to remove this pause - don't.
148
+ # set :animate => false instead
149
+ step_pause
150
+ end
151
+
152
+ def briar_scroll_to_row_and_touch (row_id, wait_for_view=nil)
153
+ briar_scroll_to_row(row_id)
154
+ if wait_for_view.nil?
155
+ touch_row row_id
156
+ else
157
+ touch_row_and_wait_to_see row_id, wait_for_view
158
+ end
159
+ end
160
+
161
+ def scroll_until_i_see_row (dir, row_id, table_id=nil)
162
+ warn "deprecated 0.0.8 - use 'scroll_to_row #{row_id}' with optional table view mark"
163
+ wait_poll({:until_exists => query_str_for_row(row_id, table_id),
107
164
  :timeout => 2}) do
108
165
  scroll('tableView', dir)
109
166
  end
110
167
 
111
- unless row_exists?(row_id)
168
+ unless row_visible?(row_id)
112
169
  screenshot_and_raise "i scrolled '#{dir}' but did not see '#{row_id}'"
113
170
  end
114
171
  end
@@ -116,10 +173,10 @@ module Briar
116
173
 
117
174
  def touch_row_offset_hash (row_id, table_id = nil)
118
175
  offset = 0
119
- query = query_str_row_in_table row_id, table_id
176
+ query = query_str_for_row row_id, table_id
120
177
  if tabbar_visible?
121
178
  #puts "tabbar visible"
122
- cells = query(query_str_rows_in_table, :accessibilityIdentifier)
179
+ cells = query(query_str_for_rows, AI)
123
180
  #puts "cells = #{cells} is #{row_id} last? ==> #{cells.last.eql?(row_id)}"
124
181
  if cells.last.eql?(row_id)
125
182
  row_h = query(query, :frame).first['Height'].to_i
@@ -133,7 +190,7 @@ module Briar
133
190
  def touch_row (row_id, table_id = nil)
134
191
  should_see_row row_id
135
192
  offset = touch_row_offset_hash row_id, table_id
136
- query_str = query_str_row_in_table(row_id, table_id)
193
+ query_str = query_str_for_row(row_id, table_id)
137
194
  #puts "touch(\"#{query_str}\", :offset => #{offset})"
138
195
  touch(query_str, :offset => offset)
139
196
  step_pause
@@ -141,15 +198,13 @@ module Briar
141
198
 
142
199
 
143
200
  def touch_row_and_wait_to_see(row_id, view, table_id = nil)
144
- should_see_row row_id
201
+ should_see_row row_id, table_id
145
202
  touch_row row_id, table_id
146
- wait_for_transition("view marked:'#{view}'",
147
- {:timeout=>TOUCH_TRANSITION_TIMEOUT,
148
- :retry_frequency=>TOUCH_TRANSITION_RETRY_FREQ})
203
+ wait_for_view view, 2.0
149
204
  end
150
205
 
151
206
  def table_exists? (table_name)
152
- !query("tableView marked:'#{table_name}'", :accessibilityIdentifier).empty?
207
+ !query("tableView marked:'#{table_name}'", AI).empty?
153
208
  end
154
209
 
155
210
  def should_see_table (table_name)
@@ -166,64 +221,177 @@ module Briar
166
221
  end
167
222
  end
168
223
 
169
- def swipe_on_row (dir, row_name)
170
- swipe(dir, {:query => "tableViewCell marked:'#{row_name}'"})
224
+ def swipe_on_row (dir, row_id, table_id=nil)
225
+ if device.ios7?
226
+ pending ('swipe is not available on iOS 7')
227
+ end
228
+ query_str = query_str_for_row row_id, table_id
229
+ swipe(dir, {:query => query_str})
171
230
  step_pause
172
- @row_that_was_swiped = row_name
231
+ @row_that_was_swiped = row_id
173
232
  end
174
233
 
175
- def should_not_see_delete_confirmation_in_row(row_name)
176
- unless query("tableViewCell marked:'#{row_name}' child tableViewCellDeleteConfirmationControl").empty?
177
- screenshot_and_raise "should see a delete confirmation button on row #{row_name}"
234
+
235
+ def should_not_see_delete_confirmation_in_row(row_id, table_id=nil)
236
+ query_str = query_str_for_row row_id, table_id
237
+ unless query("#{query_str} descendant tableViewCellDeleteConfirmationControl").empty?
238
+ screenshot_and_raise "should see a delete confirmation button on row #{row_id}"
178
239
  end
179
240
  end
180
241
 
181
-
182
- def should_see_delete_confirmation_in_row(row_name)
183
- if query("tableViewCell marked:'#{row_name}' child tableViewCellDeleteConfirmationControl").empty?
184
- screenshot_and_raise "should see a delete confirmation button on row '#{row_name}'"
242
+ def should_see_delete_confirmation_in_row(row_id, table_id=nil)
243
+ query_str = query_str_for_row row_id, table_id
244
+ if query("#{query_str} descendant tableViewCellDeleteConfirmationControl").empty?
245
+ screenshot_and_raise "should see a delete confirmation button on row '#{row_id}'"
185
246
  end
186
247
  end
187
248
 
188
- def touch_delete_confirmation(row_name)
189
- touch("tableViewCell marked:'#{row_name}' child tableViewCellDeleteConfirmationControl")
249
+ def touch_delete_confirmation(row_id, table_id=nil)
250
+ query_str = query_str_for_row row_id, table_id
251
+ touch("#{query_str} descendant tableViewCellDeleteConfirmationControl")
190
252
  step_pause
191
253
  end
192
254
 
193
- def edit_mode_delete_button_exists? (row_name)
194
- #!query("tableViewCell marked:'#{row_name}' child tableViewCellEditControl").empty?
195
- !query("all tableViewCell marked:'#{row_name}' child tableViewCellEditControl").empty?
255
+ def edit_mode_delete_button_exists? (row_id, table_id=nil)
256
+ query_str = query_str_for_row row_id, table_id
257
+ #!query("all tableViewCell marked:'#{row_id}' child tableViewCellEditControl").empty?
258
+ !query("#{query_str} descendant tableViewCellEditControl").empty?
259
+ end
260
+
261
+ def should_see_edit_mode_delete_button (row_id, table_id=nil)
262
+ unless edit_mode_delete_button_exists? row_id, table_id
263
+ screenshot_and_raise "should see a edit mode delete button on row #{row_id}"
264
+ end
265
+ end
266
+
267
+ def should_not_see_edit_mode_delete_button (row_id, table_id=nil)
268
+ if edit_mode_delete_button_exists? row_id, table_id
269
+ screenshot_and_raise "i should not see an edit mode delete button on row #{row_id}"
270
+ end
271
+ end
272
+
273
+ def reorder_button_exists? (row_id, table_id=nil)
274
+ query_str = query_str_for_row row_id, table_id
275
+ #!query("tableViewCell marked:'#{row_id}' child tableViewCellReorderControl").empty?
276
+ #!query("all tableViewCell marked:'#{row_id}' child tableViewCellReorderControl").empty?
277
+ !query("#{query_str} descendant tableViewCellReorderControl").empty?
278
+ end
279
+
280
+ def should_see_reorder_button (row_id, table_id=nil)
281
+ unless reorder_button_exists? row_id, table_id
282
+ screenshot_and_raise "i should be able to see reorder button on row #{row_id}"
283
+ end
196
284
  end
197
285
 
198
- def should_see_edit_mode_delete_button (row_name)
199
- unless edit_mode_delete_button_exists? row_name
200
- screenshot_and_raise "should see a edit mode delete button on row #{row_name}"
286
+ def should_not_see_reorder_button (row_id, table_id=nil)
287
+ if reorder_button_exists? row_id, table_id
288
+ screenshot_and_raise "i should not see reorder button on row #{row_id}"
201
289
  end
202
290
  end
203
291
 
204
- def should_not_see_edit_mode_delete_button (row_name)
205
- if edit_mode_delete_button_exists? row_name
206
- screenshot_and_raise "i should not see an edit mode delete button on row #{row_name}"
292
+ def should_see_row_at_index (row_id, index, table_id=nil)
293
+ query_str = query_str_for_rows table_id
294
+ res = query(query_str, AI)[index.to_i]
295
+ unless res.eql? row_id
296
+ screenshot_and_raise "i should see '#{row_id}' at #{index} in '#{query_str}', but found #{res}"
207
297
  end
208
298
  end
209
299
 
210
- def reorder_button_exists? (row_name)
211
- #TableViewCellReorderControl
212
- #!query("tableViewCell marked:'#{row_name}' child tableViewCellReorderControl").empty?
213
- !query("all tableViewCell marked:'#{row_name}' child tableViewCellReorderControl").empty?
300
+ def touch_edit_mode_delete_button (row_id, table_id=nil)
301
+ should_see_edit_mode_delete_button row_id, table_id
302
+ touch("tableViewCell marked:'#{row_id}' child tableViewCellEditControl")
303
+ step_pause
304
+ should_see_delete_confirmation_in_row row_id
214
305
  end
215
306
 
216
- def should_see_reorder_button (row_name)
217
- unless reorder_button_exists? row_name
218
- screenshot_and_raise "i should be able to see reorder button on row #{row_name}"
307
+ def should_see_switch_in_row_with_state (switch_id, row_id, state, table_id=nil)
308
+ should_see_row row_id, table_id
309
+ query_str = query_str_for_row_content row_id, table_id
310
+ res = query("#{query_str} switch marked:'#{switch_id}'", :isOn).first
311
+ unless res
312
+ screenshot_and_raise "expected to find a switch marked '#{switch_id}' in row '#{row_id}'"
219
313
  end
314
+ unless res.to_i == state
315
+ screenshot_and_raise "expected to find a switch marked '#{switch_id}' in row '#{row_id}' that is '#{state ? 'on' : 'off'}' but found it was '#{res ? 'on' : 'off'}'"
316
+ end
317
+ end
318
+
319
+ def touch_text_field_clear_button_in_row (row_id, table_id=nil)
320
+ query_str = query_str_for_row_content row_id, table_id
321
+ res = query("#{query_str} textField")
322
+ screenshot_and_raise "expected to see text field in '#{row_id}' row" if res.empty?
323
+ touch("#{query_str} textField descendant button")
324
+ step_pause
325
+ end
326
+
327
+ def touch_text_field_in_row_and_wait_for_keyboard (text_field_id, row_id, table_id=nil)
328
+ should_see_row row_id, table_id
329
+ query_str = query_str_for_row_content row_id, table_id
330
+ touch("#{query_str} textField marked:'#{text_field_id}'")
331
+ step_pause
332
+ should_see_keyboard
220
333
  end
221
334
 
222
- def should_not_see_reorder_button (row_name)
223
- if reorder_button_exists? row_name
224
- screenshot_and_raise "i should not see reorder button on row #{row_name}"
335
+ def should_see_text_field_in_row_with_text (row_id, text_field_id, text, table_id=nil)
336
+ should_see_row row_id, table_id
337
+ query_str = "#{query_str_for_row_content row_id, table_id} textField marked:'#{text_field_id}'"
338
+ res = query(query_str)
339
+ screenshot_and_raise "expected to see text field in '#{row_id}' row" if res.empty?
340
+ actual = query(query_str, :text).first
341
+ screenshot_and_raise "expected to find text field with '#{text}' in row '#{row_id}' but found '#{actual}'" if !text.eql? actual
342
+ end
343
+
344
+ def delete_row_with_edit_mode_delete_button (row_id, table_id=nil)
345
+ touch_edit_mode_delete_button row_id, table_id
346
+ touch_delete_confirmation row_id, table_id
347
+ should_not_see_row row_id, table_id
348
+ end
349
+
350
+ def touch_switch_in_row (switch_id, row_id, table_id=nil)
351
+ should_see_row row_id, table_id
352
+ query_str = query_str_for_row_content row_id, table_id
353
+ touch("#{query_str} switch marked:'#{switch_id}'")
354
+ step_pause
355
+ end
356
+
357
+ def swipe_to_delete_row (row_id, table_id = nil)
358
+
359
+ swipe_on_row 'left', row_id, table_id
360
+ should_see_delete_confirmation_in_row row_id, table_id
361
+ touch_delete_confirmation row_id, table_id
362
+ should_not_see_row row_id, table_id
363
+ end
364
+
365
+ def should_see_disclosure_chevron_in_row (row_id, table_id=nil)
366
+ should_see_row row_id, table_id
367
+ # gray disclosure chevron is accessory type 1
368
+ query_str = query_str_for_row row_id, table_id
369
+ res = query(query_str, :accessoryType).first
370
+ unless res == 1
371
+ screenshot_and_raise "expected to see disclosure chevron in row '#{row_id}' but found '#{res}'"
225
372
  end
226
373
  end
227
374
 
375
+ def should_see_slider_in_row (slider_id, row_id, table_id)
376
+ query_str = query_str_for_row_content row_id, table_id
377
+ actual_id = query("#{query_str} slider marked:'#{slider_id}'", AI).first
378
+ unless actual_id.eql? row_id
379
+ screenshot_and_raise "expected to see slider '#{slider_id}' in '#{row_id}' but found '#{actual_id}'"
380
+ end
381
+ end
382
+
383
+ def should_see_slider_in_row_with_value (slider_id, row_id, value, table_id=nil)
384
+ query_str = query_str_for_row_content row_id, table_id
385
+ actual_value = query("#{query_str} slider marked:'#{slider_id}'", :value).first.to_i
386
+ unless actual_value == value.to_i
387
+ screenshot_and_raise "expected to see slider '#{slider_id}' with '#{value}' in '#{row_id}' but found '#{actual_value}'"
388
+ end
389
+ end
390
+
391
+ def touch_section_header (header_id, table_id=nil)
392
+ query_str = query_str_for_table table_id
393
+ touch("#{query_str} descendant view marked:'#{header_id}'")
394
+ step_pause
395
+ end
228
396
  end
229
397
  end