lib/ilesspainfulclient-cucumber/lesspainful_steps.rb in ilesspainfulclient-cucumber-0.0.8 vs lib/ilesspainfulclient-cucumber/lesspainful_steps.rb in ilesspainfulclient-cucumber-0.0.9

- old
+ new

@@ -59,11 +59,11 @@ sleep(STEP_PAUSE) end #/^I enter "([^\"]*)" as "([^\"]*)"$/ ## -- Entering text directly --## -When /^I type "([^\"]*)" into the "([^\"]*)" text field$/ do |text_to_type, field_name| +When /^I enter "([^\"]*)" into the "([^\"]*)" text field$/ do |text_to_type, field_name| set_text("textField placeholder:'#{field_name}'", text_to_type) sleep(STEP_PAUSE) end # alias @@ -75,23 +75,24 @@ table.hashes.each do |row| When %Q|I type "#{row['text']}" into the "#{row['field']}" text field| end end -#doesn't make sense iOS? -#Then /^I enter "([^\"]*)" into input field number (\d+)$/ do |text, index| -# text_fields_modified = frankly_map( "textField placeholder:'#{field_name}'", "setText:", text_to_type ) -# raise "could not find text fields with placeholder '#{field_name}'" if text_fields_modified.empty? -#end +Then /^I enter "([^\"]*)" into input field number (\d+)$/ do |text, index| + index = index.to_i + raise "Index should be positive (was: #{index})" if (index<=0) + set_text("textField index:#{index-1}",text) +end When /^I clear "([^\"]*)"$/ do |name| When %Q|I type "" into the "#{name}" text field| end -##Then /^I clear input field number (\d+)$/ do |index| -# raise "Index should be positive (was: #{index})" if (index<=0) -# -#end +Then /^I clear input field number (\d+)$/ do |index| + index = index.to_i + raise "Index should be positive (was: #{index})" if (index<=0) + set_text("textField index:#{index-1}","") +end # -- See -- #