Anybody have idea how to test file download using cucumber?
I found this to be a convenient way of testing for downloads, its a naiv way just testing for the headers put for most of the time its reasonable.
If you are using capbybara then put the following inside your step_definitions.rb
Then /^I should get a download with the filename "([^\"]*)"$/ do |filename|
page.response_headers['Content-Disposition'].should include("filename=\"#{filename}\"")
end
Inside your feature you can now do:
When I follow "Export as ZIP"
Then I should get a download with the filename "contacts_20110203.zip"
Cheers