features/step_definitions/table_steps.rb in briar-0.0.5 vs features/step_definitions/table_steps.rb in briar-0.0.6

- old
+ new

@@ -3,15 +3,20 @@ Then /^I should see (?:the|an?) "([^"]*)" row$/ do |name| should_see_row name end +#noinspection RubyUnusedLocalVariable Then /^I scroll (left|right|up|down) until I see the "([^\"]*)" row limit (\d+)$/ do |dir, row_name, limit| - scroll_until_i_see_row dir, row_name, limit + pending "deprecated 0.0.6 - use 'Then I scroll #{dir} until I see (?:the|an?) \"#{row_name}\" row" end +Then /^I scroll (left|right|up|down) until I see (?:the|an?) "([^\"]*)" row$/ do |dir, row_id| + scroll_until_i_see_row dir, row_id +end + Then /^I touch (?:the) "([^"]*)" row and wait for (?:the) "([^"]*)" view to appear$/ do |row_id, view_id| # problem wait_for_animation touch_row_and_wait_to_see row_id, view_id end @@ -38,12 +43,12 @@ end end Then /^the (first|second) row should be "([^"]*)"$/ do |idx, row_id| - (idx.eql? "first") ? index = 0 : index = 1 - res = query("tableViewCell", :accessibilityIdentifier)[index] + (idx.eql? 'first') ? index = 0 : index = 1 + res = query('tableViewCell', :accessibilityIdentifier)[index] unless res.eql? row_id screenshot_and_raise "i expected the #{idx} row would be #{row_id}, but found #{res}" end end @@ -52,11 +57,11 @@ swipe_on_row dir, row_name end Then /^I should be able to swipe to delete the "([^"]*)" row$/ do |row_name| - swipe_on_row "left", row_name + swipe_on_row 'left', row_name should_see_delete_confirmation_in_row row_name touch_delete_confirmation row_name should_not_see_row row_name end @@ -74,18 +79,18 @@ end Then /^I should see "([^"]*)" in row (\d+)$/ do |cell_name, row| # on ios 6 this is returning nil #res = query("tableViewCell index:#{row}", :accessibilityIdentifier).first - access_ids = query("tableViewCell", :accessibilityIdentifier) + access_ids = query('tableViewCell', :accessibilityIdentifier) unless access_ids.index(cell_name) == row.to_i screenshot_and_raise "expected to see '#{cell_name}' in row #{row} but found '#{access_ids[row.to_i]}'" end end Then /^I should see the rows in this order "([^"]*)"$/ do |row_ids| - tokens = row_ids.split(",") + tokens = row_ids.split(',') counter = 0 tokens.each do |token| token.strip! macro %Q|I should see "#{token}" in row #{counter}| counter = counter + 1 @@ -100,20 +105,20 @@ should_see_row_with_label_with_text row_id, label_id, @text_entered_by_keyboard end Then /^I move the "([^"]*)" row (up|down) (\d+) times? using the reorder edit control$/ do |row_id, dir, n| should_see_row row_id - dir_str = (dir.eql?("up")) ? "drag_row_up" : "drag_row_down" + dir_str = (dir.eql?('up')) ? 'drag_row_up' : 'drag_row_down' n.to_i.times do ( playback(dir_str, {:query => "tableViewCell marked:'#{row_id}' descendant tableViewCellReorderControl"}) step_pause) end end Then /^I should (see|not see) (?:the|an?) "([^"]*)" table$/ do |visibility, table_id| - if visibility.eql?("see") + if visibility.eql?('see') should_see_table table_id else should_not_see_table table_id end end @@ -134,12 +139,12 @@ query_str = "tableViewCell marked:'#{row_id}' child tableViewCellContentView child switch marked:'#{switch_id}'" res = query(query_str, :isOn).first unless res screenshot_and_raise "expected to find a switch marked '#{switch_id}' in row '#{row_id}'" end - expected = (on_off.eql? "on") ? 1 : 0 + expected = (on_off.eql? 'on') ? 1 : 0 unless res.to_i == expected - 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"}'" + 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'}'" end end Then /^I should see a detail disclosure chevron in the "([^"]*)" row$/ do |row_id| should_see_row row_id