Skip to content

Instantly share code, notes, and snippets.

@liangzan
Created August 31, 2009 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liangzan/178505 to your computer and use it in GitHub Desktop.
Save liangzan/178505 to your computer and use it in GitHub Desktop.
#Cucumber Steps for file uploads
When /^I focus on "([^\"]*)" field to attach "([^\"]*)" file$/ do |field_name, file_name|
attach_file(field_name, file_name)
end
Given /^I have "([^\"]*)" csv file containing:$/ do |file_name, csv_values|
create_csv_file(file_name, csv_values)
end
#Celerity Helper
#Remember to define browser
def attach_file(field_name, file_name)
file_path = File.join($upload_path, file_name)
browser.file_field(:name, "#{field_name}").set file_path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment