I want cucumber test for uploadify on ruby on rails 3. I had tried to click on the upload button from capybara but as it is neither button nor link. Furthermore, it is hiding the text_field so I cannot write "When I fill in "upload" with "text.txt"". If any one has solved this problem, please help is needed here.
Write custom step for uploading a file
When /^(?:|I)attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
  type = path.split(".")[1]
  case type
  when "jpg"
    type = "image/jpg"
  when "png"
    type = "image/png"
  when "gif"
    type = "image/gif"
  end
  attach_file(field, path, type)
end
When /^I attach the "(.*)" file at "(.*)" to "(.*)"$/ do |type, path, field|
 attach_file(field,path,type)
end
Cucumber Step like
When I attach the file "/images/back.gif" to "data_input"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With