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
@@ -10,7 +10,7 @@ end
10
10
  Then /^I use the keyboard to enter "([^"]*)"$/ do |text|
11
11
  wait_for_animation
12
12
  should_see_keyboard
13
- @text_entered_by_keyboard = keyboard_enter_text text
13
+ @text_entered_by_keyboard = briar_keyboard_enter_text text
14
14
  end
15
15
 
16
16
  When /^I touch the done button the keyboard disappears$/ do
@@ -30,5 +30,10 @@ Then(/^I turn off spell checking and capitalization$/) do
30
30
  end
31
31
 
32
32
  Then /^I am done text editing$/ do
33
- touch_navbar_item 'done text editing'
33
+ idx = index_of_navbar_button 'done text editing'
34
+ if idx
35
+ touch_navbar_item 'done text editing'
36
+ else
37
+ touch_button 'done text editing'
38
+ end
34
39
  end
@@ -1,63 +1,24 @@
1
- #include Briar::Picker::Date
2
-
3
- # steps
4
1
 
5
2
  Then /^I change the time on the picker to "([^"]*)"$/ do |target_time|
6
- screenshot_and_raise 'picker is not in date time or time mode' unless picker_is_in_time_mode or picker_is_in_date_and_time_mode
7
- if picker_has_calabash_additions
8
- date_str_to_send = date_str_to_send_to_picker_from_time_str target_time
9
- set_picker_date_with_date_time_str (date_str_to_send)
10
- else
11
- screenshot_and_raise 'this version of briar requires a category on UIDatePicker. Sorry!'
12
- end
13
-
14
-
15
- @date_picker_time_12h = picker_is_in_12h_locale ? picker_time_12h_str : picker_time_for_other_locale
16
- @date_picker_time_24h = picker_is_in_24h_locale ? picker_time_24h_str : picker_time_for_other_locale
17
-
18
- # this test catches problems (it is how i caught the scroll down/scroll up
19
- # described in the comment block above)
20
- unless time_strings_are_equivalent(@date_picker_time_12h, @date_picker_time_24h)
21
- screenshot_and_raise "ERROR: changing the picker resulted in two different times: 12H => '#{@date_picker_time_12h}' 24H => '#{@date_picker_time_24h}'"
22
- end
23
-
24
- if picker_is_in_date_and_time_mode
25
- @date_picker_date_time_12h = picker_is_in_12h_locale ? picker_date_and_time_str_12h : picker_date_and_time_str_for_other_locale
26
- @date_picker_date_time_24h = picker_is_in_24h_locale ? picker_date_and_time_str_24h : picker_date_and_time_str_for_other_locale
27
- # this test catches problems (it is how i caught the scroll down/scroll up
28
- # described in the comment block above)
29
- unless date_time_strings_are_equivalent(@date_picker_date_time_12h, @date_picker_date_time_24h)
30
- screenshot_and_raise "ERROR: changing the picker resulted in two different dates: 12H => '#{@date_picker_date_time_12h}' 24H => '#{@date_picker_date_time_24h}'"
31
- end
32
- end
33
-
34
- unless target_time.eql? @date_picker_time_12h or target_time.eql? @date_picker_time_24h
35
- screenshot_and_raise "tried to change the time to '#{target_time}' but found '#{@date_picker_time_12h}' or '#{@date_picker_time_24h}'"
36
- end
3
+ change_time_on_picker_with_time_str target_time
37
4
  end
38
5
 
39
6
  Then /^I change the date on the picker to "([^"]*)"$/ do |target_date|
40
- if picker_has_calabash_additions
41
- date_str_to_send = date_str_to_send_to_picker_from_date_str target_date
42
- set_picker_date_with_date_time_str (date_str_to_send)
43
- else
44
- screenshot_and_raise 'this version of briar requires a category on UIDatePicker. Sorry!'
45
- end
7
+ change_date_on_picker_with_date_str target_date
46
8
  end
47
9
 
48
-
49
10
  Then /^I change the picker date to "([^"]*)" and the time to "([^"]*)"$/ do |target_date, target_time|
50
- macro %Q|I change the date on the picker to "#{target_date}"|
51
- macro %Q|I change the time on the picker to "#{target_time}"|
11
+ change_time_on_picker_with_time_str target_date
12
+ change_date_on_picker_with_date_str target_time
52
13
  end
53
14
 
54
15
  Then /^I change the picker to (\d+) days? ago$/ do |days_ago|
55
16
  today = Date.today
56
17
  #noinspection RubyUnusedLocalVariable
57
18
  days_ago = today -= days_ago.to_i
58
- fmt = picker_is_in_24h_locale ? PICKER_24H_DATE_FMT : PICKER_12H_DATE_FMT
19
+ fmt = picker_is_in_24h_locale ? BRIAR_PICKER_24H_BRIEF_DATE_FMT : BRIAR_PICKER_12H_BRIEF_DATE_FMT
59
20
  target_date = days_ago.strftime(fmt).squeeze(' ').strip
60
- macro %Q|I change the date on the picker to "#{target_date}"|
21
+ change_date_on_picker_with_date_str target_date
61
22
  end
62
23
 
63
24
 
@@ -65,166 +26,49 @@ Then /^I change the picker to (\d+) days? ago at "([^"]*)"$/ do |days_ago, targe
65
26
  today = Date.today
66
27
  #noinspection RubyUnusedLocalVariable
67
28
  days_ago = today -= days_ago.to_i
68
- fmt = picker_is_in_24h_locale ? PICKER_24H_DATE_FMT : PICKER_12H_DATE_FMT
29
+ fmt = picker_is_in_24h_locale ? BRIAR_PICKER_24H_BRIEF_DATE_FMT : BRIAR_PICKER_12H_BRIEF_DATE_FMT
69
30
  target_date = days_ago.strftime(fmt).squeeze(' ').strip
70
- macro %Q|I change the picker date to "#{target_date}" and the time to "#{target_time}"|
31
+ change_date_on_picker_with_date_str target_date
32
+ change_time_on_picker_with_time_str target_time
71
33
  end
72
34
 
73
- # requires that the picker is visible
74
- Then /^the text in the "([^"]*)" label should match picker date and time$/ do |label_id|
75
- text = query("view marked:'#{label_id}'", :text).first
76
- screenshot_and_raise "could not find label with id '#{label_id}'"
77
- date_time_24h = picker_is_in_24h_locale ? picker_date_and_time_str_24h : picker_date_and_time_str_for_other_locale
78
- date_time_12h = picker_is_in_12h_locale ? picker_date_and_time_str_12h : picker_date_and_time_str_for_other_locale
79
- unless (text.eql? date_time_12h) or (text.eql? date_time_24h)
80
- screenshot_and_raise "expected '#{text}' to match '#{date_time_12h}' or '#{date_time_24h}'"
81
- end
82
- end
83
35
 
36
+ #noinspection RubyUnusedLocalVariable
84
37
  Then /^I change the picker date time to "([^"]*)"$/ do |target_time|
85
38
  pending 'deprecated 0.0.6 - not replaced with anything'
86
- date_str = picker_date_str
87
- macro %Q|I change the picker date to "#{date_str}" and the time to "#{target_time}"|
88
39
  end
89
40
 
41
+
90
42
  Then /^I should see that the date picker is in time mode$/ do
91
- res = query('datePicker', :datePickerMode).first
92
- unless res
93
- screenshot_and_raise 'expected to a date picker'
94
- end
95
- unless res == UIDatePickerModeTime
96
- screenshot_and_raise "expected to see picker with time mode but found mode '#{res}'"
43
+ unless picker_is_in_time_mode
44
+ screenshot_and_raise 'expected to see picker with time mode'
97
45
  end
98
46
  end
99
47
 
100
48
  # requires picker is visible
101
49
  Then /^I should see that the time on the picker is now$/ do
102
- time_hash = time_hash_by_add_minutes_until_at_closest_interval (now_time_12h_locale)
103
- at_interval_12h = time_hash[:h12]
104
- at_interval_24h = time_hash[:h24]
105
- picker_time = picker_time_str
106
- unless picker_time.eql? at_interval_12h or picker_time.eql? at_interval_24h
107
- screenshot_and_raise "expected to picker time to be '#{at_interval_12h}' or '#{at_interval_24h}' but found '#{picker_time}'"
108
- end
50
+ should_see_time_on_picker_is_now
109
51
  end
110
52
 
111
53
  # requires a time or date change. picker does not need to be visible
112
54
  Then /^I should see that the "([^"]*)" row has the time I just entered in the "([^"]*)" label$/ do |row_id, label_id|
113
- arr = query("tableViewCell marked:'#{row_id}' isHidden:0 descendant label marked:'#{label_id}'", :text)
114
- screenshot_and_raise "could not find '#{label_id}' in the '#{row_id}' row" if arr.empty?
115
- actual_text = arr.first
116
- unless (actual_text.eql? @date_picker_time_12h) or (actual_text.eql? @date_picker_time_24h)
117
- screenshot_and_raise "expected to see '#{@date_picker_time_12h}' or '#{@date_picker_time_24h}' in '#{label_id}' but found '#{actual_text}'"
118
- end
55
+ should_see_row_has_time_i_just_entered row_id, label_id
119
56
  end
120
57
 
121
58
  # does not require a time or date change. picker needs to be visible
122
59
  Then /^I should see that the "([^"]*)" row has the same time as the picker in the "([^"]*)" label$/ do |row_id, label_id|
123
- arr = query("tableViewCell marked:'#{row_id}' isHidden:0 descendant label marked:'#{label_id}'", :text)
124
- screenshot_and_raise "could not find '#{label_id}' in the '#{row_id}'" if arr.empty?
125
- time_str_12h = picker_is_in_12h_locale ? picker_time_12h_str : picker_time_for_other_locale
126
- time_str_24h = picker_is_in_24h_locale ? picker_time_24h_str : picker_time_for_other_locale
127
- actual_text = arr.first
128
- unless (actual_text.eql? time_str_12h) or (actual_text.eql? time_str_24h)
129
- screenshot_and_raise "expected to see '#{time_str_12h}' or '#{time_str_24h}' in '#{label_id}' but found '#{actual_text}'"
130
- end
131
- end
132
-
133
- # requires a time or date change. picker does not need to be visible
134
- Then /^I should see that the "([^"]*)" row has the date and time I just entered in the "([^"]*)" label$/ do |row_id, label_id|
135
- arr = query("tableViewCell marked:'#{row_id}' isHidden:0 descendant label marked:'#{label_id}'", :text)
136
- screenshot_and_raise "could not find '#{label_id}' in the '#{row_id}' row" if arr.empty?
137
- actual_text = arr.first
138
- unless (actual_text.eql? @date_picker_date_time_12h) or (actual_text.eql? @date_picker_date_time_24h)
139
- screenshot_and_raise "expected to see '#{@date_picker_date_time_12h}' or '#{@date_picker_date_time_24h}' in '#{label_id}' but found '#{actual_text}'"
140
- end
60
+ should_see_row_has_label_with_time_on_picker row_id, label_id
141
61
  end
142
62
 
143
63
  Then /^I change the minute interval on the picker to (1|5|10|30) minutes?$/ do |target_interval|
144
- res = query('datePicker', [{setMinuteInterval:target_interval.to_i}])
145
- screenshot_and_raise 'did not find a date picker - could not set the minute interval' if res.empty?
146
- sleep(PICKER_STEP_PAUSE * 5)
147
- @picker_minute_interval = target_interval.to_i
64
+ change_minute_interval_on_picker target_interval.to_i
148
65
  end
149
66
 
150
- Then /^I change the time on the picker to (\d+) minutes? from now$/ do |target_minute|
151
- future = Time.new + (60 * target_minute.to_i)
152
- time_str = future.strftime(PICKER_12H_TIME_FMT).squeeze(' ').strip
153
- macro %Q|I change the time on the picker to "#{time_str}"|
154
- sleep(PICKER_STEP_PAUSE)
67
+ Then /^I change the time on the picker to (\d+) minutes? from now$/ do |target_minutes|
68
+ change_time_on_picker_to_minutes_from_now (target_minutes)
155
69
  end
156
70
 
157
- Then /^I change the time on the picker to (\d+) minutes? before now$/ do |target_minute|
158
- past = Time.new - (60 * target_minute.to_i)
159
- time_str = past.strftime(PICKER_12H_TIME_FMT).squeeze(' ').strip
160
- macro %Q|I change the time on the picker to "#{time_str}"|
161
- sleep(PICKER_STEP_PAUSE)
71
+ Then /^I change the time on the picker to (\d+) minutes? before now$/ do |target_minutes|
72
+ change_time_on_picker_to_minutes_before_now (target_minutes)
162
73
  end
163
74
 
164
- # DEAD SEA
165
-
166
- # old non_category date picking
167
- #tokens = target_time.split(/[: ]/)
168
- #screenshot_and_raise "could not parse '#{target_time}' into a valid time" if tokens.count > 3 or tokens.count < 1
169
- #time_in_24h_locale = tokens.count == 2
170
- #hour_token = tokens[0].to_i
171
- #period_token = tokens[2]
172
- #if time_in_24h_locale
173
- # screenshot_and_raise "'#{hour_token}' is not on (0, 23)" unless (0..23).member?(hour_token)
174
- # period_token = hour_token > 11 ? PICKER_PM : PICKER_AM
175
- #else
176
- # screenshot_and_raise "'#{hour_token}' is not on (1, 12)" unless (0..12).member?(hour_token)
177
- # am_pm_token = tokens[2]
178
- # screenshot_and_raise "'#{am_pm_token}' is not a recognized period (AM or PM)" unless (am_pm_token.eql? PICKER_AM or am_pm_token.eql? PICKER_PM)
179
- # hour_token = 0 if hour_token == 12 and am_pm_token.eql? PICKER_AM
180
- # hour_token = hour_token + 12 if hour_token < 12 and am_pm_token.eql? PICKER_PM
181
- #end
182
- #
183
- #minute_token = tokens[1].to_i
184
- #screenshot_and_raise "'#{minute_token}'is not on (0, 59)" unless (0..59).member?(minute_token)
185
- #
186
- ## rollback the date by 1 to avoid maxi date problems
187
- ## decided this was not a good idea because sometimes the rollback step below
188
- ## would not fire
189
- ## picker_scroll_down_on_column 0 if picker_is_in_date_and_time_mode
190
- #
191
- #picker_scroll_to_hour hour_token
192
- #picker_scroll_to_minute minute_token
193
- #
194
- #picker_scroll_to_period period_token if picker_is_in_12h_locale
195
- #
196
- ## rollback the change we made above
197
- ## decided this was not a good idea
198
- ## sometimes this does not fire so you can end up with inconsistent dates
199
- ## see the test below
200
- ## picker_scroll_up_on_column 0 if picker_is_in_date_and_time_mode
201
-
202
-
203
- ##
204
-
205
- #unless picker_weekday_month_day_is(target_date)
206
- # # figure out which way to turn the picker
207
- # # target = Date.parse(target_date)
208
- # dir = (Date.parse(target_date) < Date.today) ? 'down' : 'up'
209
- # limit = 60
210
- # count = 0
211
- # begin
212
- # dir.eql?('down') ? picker_scroll_down_on_column(0) : picker_scroll_up_on_column(0)
213
- # sleep(PICKER_STEP_PAUSE)
214
- # count = count + 1
215
- # end while ((not picker_weekday_month_day_is(target_date)) and count < limit)
216
- #end
217
- #unless picker_weekday_month_day_is(target_date)
218
- # screenshot_and_raise "scrolled '#{limit}' and could not change date to #{target_date}"
219
- #end
220
- #
221
- #@date_picker_date_time_12h = picker_is_in_12h_locale ? picker_date_and_time_str_12h : picker_date_and_time_str_for_other_locale
222
- #@date_picker_date_time_24h = picker_is_in_24h_locale ? picker_date_and_time_str_24h : picker_date_and_time_str_for_other_locale
223
- #if picker_is_in_date_and_time_mode
224
- # @date_picker_time_12h = picker_is_in_12h_locale ? picker_time_12h_str : picker_time_for_other_locale
225
- # @date_picker_time_24h = picker_is_in_24h_locale ? picker_time_24h_str : picker_time_for_other_locale
226
- # unless time_strings_are_equivalent(@date_picker_time_12h, @date_picker_time_24h)
227
- # screenshot_and_raise "ERROR: changing the picker resulted in two different times: 12H => '#{@date_picker_time_12h}' 24H => '#{@date_picker_time_24h}'"
228
- # end
229
- #end
230
- #end
@@ -1,40 +1,39 @@
1
- #include Briar::Table
2
- #include Briar::Core
3
-
4
1
  Then /^I should see (?:the|an?) "([^"]*)" row$/ do |name|
5
2
  should_see_row name
6
3
  end
7
4
 
5
+
6
+ Then(/^I scroll to the "([^"]*)" row$/) do |row_id|
7
+ briar_scroll_to_row row_id
8
+ end
9
+
8
10
  #noinspection RubyUnusedLocalVariable
9
- Then /^I scroll (left|right|up|down) until I see the "([^\"]*)" row limit (\d+)$/ do |dir, row_name, limit|
10
- pending "deprecated 0.0.6 - use 'Then I scroll #{dir} until I see (?:the|an?) \"#{row_name}\" row"
11
+ Then /^I scroll (left|right|up|down) until I see the "([^\"]*)" row limit (\d+)$/ do |dir, row_id, limit|
12
+ pending "deprecated 0.0.6 - use 'Then I scroll to the \"#{row_id}\" row'"
11
13
  end
12
14
 
13
15
 
16
+ #noinspection RubyUnusedLocalVariable
14
17
  Then /^I scroll (left|right|up|down) until I see (?:the|an?) "([^\"]*)" row$/ do |dir, row_id|
15
- scroll_until_i_see_row dir, row_id
18
+ pending "deprecated 0.0.8 - use 'Then I scroll to the \"#{row_id}\" row'"
16
19
  end
17
20
 
18
21
  Then /^I touch (?:the) "([^"]*)" row and wait for (?:the) "([^"]*)" view to appear$/ do |row_id, view_id|
19
- # problem
20
- wait_for_animation
22
+ wait_for_row row_id
21
23
  touch_row_and_wait_to_see row_id, view_id
22
24
  end
23
25
 
24
26
  Then /^I touch the "([^"]*)" row on the "([^"]*)" table and wait for the "([^"]*)" view to appear$/ do |row_id, table_id, view_id|
25
- wait_for_animation
27
+ wait_for_row row_id
26
28
  touch_row_and_wait_to_see row_id, view_id, table_id
27
29
  end
28
30
 
29
-
30
31
  Then /^I touch (?:the) "([^"]*)" row$/ do |row_name|
31
32
  touch_row row_name
32
33
  end
33
34
 
34
-
35
- Then /^I touch the "([^"]*)" section header$/ do |header_name|
36
- touch("tableView child view marked:'#{header_name}'")
37
- wait_for_animation
35
+ Then /^I touch the "([^"]*)" section header$/ do |header_id|
36
+ touch_section_header header_id
38
37
  end
39
38
 
40
39
  Then /^I should see the "([^"]*)" table in edit mode$/ do |table_id|
@@ -46,45 +45,34 @@ end
46
45
 
47
46
  Then /^the (first|second) row should be "([^"]*)"$/ do |idx, row_id|
48
47
  (idx.eql? 'first') ? index = 0 : index = 1
49
- res = query('tableViewCell', :accessibilityIdentifier)[index]
50
- unless res.eql? row_id
51
- screenshot_and_raise "i expected the #{idx} row would be #{row_id}, but found #{res}"
52
- end
48
+ should_see_row_at_index row_id, index
53
49
  end
54
50
 
51
+ Then(/^the (\d+)(?:st|nd|rd|th)? row should be "([^"]*)"$/) do |row_index, row_id|
52
+ idx = row_index.to_i - 1
53
+ should_see_row_at_index row_id, idx
54
+ end
55
55
 
56
56
  Then /^I swipe (left|right) on the "([^"]*)" row$/ do |dir, row_name|
57
57
  swipe_on_row dir, row_name
58
58
  end
59
59
 
60
-
61
- Then /^I should be able to swipe to delete the "([^"]*)" row$/ do |row_name|
62
- swipe_on_row 'left', row_name
63
- should_see_delete_confirmation_in_row row_name
64
- touch_delete_confirmation row_name
65
- should_not_see_row row_name
60
+ Then /^I should be able to swipe to delete the "([^"]*)" row$/ do |row_id|
61
+ swipe_to_delete_row row_id
66
62
  end
67
63
 
68
- Then /^I touch the delete button on the "([^"]*)" row$/ do |row_name|
69
- should_see_edit_mode_delete_button row_name
70
- touch("tableViewCell marked:'#{row_name}' child tableViewCellEditControl")
71
- step_pause
72
- should_see_delete_confirmation_in_row row_name
64
+ Then /^I touch the delete button on the "([^"]*)" row$/ do |row_id|
65
+ touch_edit_mode_delete_button row_id
73
66
  end
74
67
 
75
- Then /^I use the edit mode delete button to delete the "([^"]*)" row$/ do |row_name|
76
- macro %Q|I touch the delete button on the "#{row_name}" row|
77
- touch_delete_confirmation row_name
78
- should_not_see_row row_name
68
+ Then /^I use the edit mode delete button to delete the "([^"]*)" row$/ do |row_id|
69
+ delete_row_with_edit_mode_delete_button row_id
79
70
  end
80
71
 
81
- Then /^I should see "([^"]*)" in row (\d+)$/ do |cell_name, row|
72
+ Then /^I should see "([^"]*)" in row (\d+)$/ do |row_id, row_index|
82
73
  # on ios 6 this is returning nil
83
- #res = query("tableViewCell index:#{row}", :accessibilityIdentifier).first
84
- access_ids = query('tableViewCell', :accessibilityIdentifier)
85
- unless access_ids.index(cell_name) == row.to_i
86
- screenshot_and_raise "expected to see '#{cell_name}' in row #{row} but found '#{access_ids[row.to_i]}'"
87
- end
74
+ #res = query("tableViewCell index:#{row}", AI).first
75
+ should_see_row_at_index row_id, row_index
88
76
  end
89
77
 
90
78
  Then /^I should see the rows in this order "([^"]*)"$/ do |row_ids|
@@ -92,7 +80,7 @@ Then /^I should see the rows in this order "([^"]*)"$/ do |row_ids|
92
80
  counter = 0
93
81
  tokens.each do |token|
94
82
  token.strip!
95
- macro %Q|I should see "#{token}" in row #{counter}|
83
+ should_see_row_at_index token, counter
96
84
  counter = counter + 1
97
85
  end
98
86
  end
@@ -125,7 +113,7 @@ end
125
113
 
126
114
  Then /^I should see a "([^"]*)" button in the "([^"]*)" row$/ do |button_id, row_id|
127
115
  should_see_row row_id
128
- arr = query("tableViewCell marked:'#{row_id}' child tableViewCellContentView child button marked:'#{button_id}'", :accessibilityIdentifier)
116
+ arr = query("tableViewCell marked:'#{row_id}' descendant child tableViewCellContentView child button marked:'#{button_id}'", AI)
129
117
  (arr.length == 1)
130
118
  end
131
119
 
@@ -135,30 +123,15 @@ Then /^I touch the "([^"]*)" button in the "([^"]*)" row$/ do |button_id, row_id
135
123
  end
136
124
 
137
125
  Then /^I should see a switch for "([^"]*)" in the "([^"]*)" row that is in the "([^"]*)" position$/ do |switch_id, row_id, on_off|
138
- should_see_row row_id
139
- query_str = "tableViewCell marked:'#{row_id}' child tableViewCellContentView child switch marked:'#{switch_id}'"
140
- res = query(query_str, :isOn).first
141
- unless res
142
- screenshot_and_raise "expected to find a switch marked '#{switch_id}' in row '#{row_id}'"
143
- end
144
- expected = (on_off.eql? 'on') ? 1 : 0
145
- unless res.to_i == expected
146
- screenshot_and_raise "expected to find a switch marked '#{switch_id}' in row '#{row_id}' that is '#{on_off}' but found it was '#{res ? 'on' : 'off'}'"
147
- end
126
+ should_see_switch_in_row_with_state switch_id, row_id, (on_off.eql? 'on') ? 1 : 0
148
127
  end
149
128
 
150
129
  Then /^I should see a detail disclosure chevron in the "([^"]*)" row$/ do |row_id|
151
- should_see_row row_id
152
- # gray disclosure chevron is accessory type 1
153
- res = query("tableViewCell marked:'#{row_id}'", :accessoryType).first
154
- unless res == 1
155
- screenshot_and_raise "expected to see disclosure chevron in row '#{row_id}' but found '#{res}'"
156
- end
130
+ should_see_disclosure_chevron_in_row row_id
157
131
  end
158
132
 
159
133
  Then /^I touch the "([^"]*)" switch in the "([^"]*)" row$/ do |switch_id, row_id|
160
- should_see_row row_id
161
- touch("tableViewCell marked:'#{row_id}' child tableViewCellContentView child switch marked:'#{switch_id}'")
134
+ touch_switch_in_row switch_id, row_id
162
135
  end
163
136
 
164
137
  Then /^I should see "([^"]*)" in the "([^"]*)" section (footer|header)$/ do |text, section_footer_id, head_or_foot|
@@ -169,23 +142,14 @@ Then /^I should see "([^"]*)" in the "([^"]*)" section (footer|header)$/ do |tex
169
142
  end
170
143
 
171
144
  Then /^I should see a text field with text "([^"]*)" in the "([^"]*)" row$/ do |text, row_id|
172
- should_see_row row_id
173
- query_str = "tableViewCell marked:'#{row_id}' child tableViewCellContentView child textField"
174
- res = query(query_str)
175
- screenshot_and_raise "expected to see text field in '#{row_id}' row" if res.empty?
176
- actual = query(query_str, :text).first
177
- screenshot_and_raise "expected to find text field with '#{text}' in row '#{row_id}' but found '#{actual}'" if !text.eql? actual
145
+ should_see_text_field_in_row_with_text row_id, text
178
146
  end
179
147
 
180
148
  When /^I touch the "([^"]*)" text field in the "([^"]*)" row the keyboard appears$/ do |text_field_id, row_id|
181
- should_see_row row_id
182
- query_str = "tableViewCell marked:'#{row_id}' child tableViewCellContentView child textField marked:'#{text_field_id}'"
183
- touch(query_str)
184
- wait_for_animation
185
- should_see_keyboard
149
+ touch_text_field_in_row_and_wait_for_keyboard text_field_id, row_id
186
150
  end
187
151
 
188
-
189
152
  Then /^I should see that the "([^"]*)" row has image "([^"]*)"$/ do |row_id, image_id|
190
153
  should_see_row_with_image row_id, image_id
191
154
  end
155
+