对rails上的uploadify使用黄瓜测试3

对rails上的uploadify使用黄瓜测试3

问题描述:

我想在ruby on rails上的uploadify的黄瓜测试3.我试图点击上传按钮从capybara,但因为它既不是按钮或链接。此外,它隐藏text_field,所以我不能写当我填写上传与text.txt。

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

Cucumber Step like

当我将文件/images/back.gif附加到data_input时

When I attach the file "/images/back.gif" to "data_input"