[英]How can I test an S3 direct upload with Capybara?
I'm using s3_direct_upload for video uploading direct to S3. 我正在使用s3_direct_upload将视频直接上传到S3。 The user visits the page, clicks a div which is a proxy for clicking the form input, selects a file, hits 'ok', and then completes a form while the video uploads. 用户访问该页面,单击div作为单击表单输入的代理,选择文件,点击“确定”,然后在视频上传时完成表单。 I'd like to test this with capybara, but it's looking like I'll need to resort to #attach_file
. 我想用capybara测试一下,但看起来我需要求助于#attach_file
。 Is this my only option? 这是我唯一的选择吗?
In the capybara spec, I ended up going with the less-than-desirable approach of: 在水豚规范中,我最终采用了不太理想的方法:
find(:css, '#choose-file').click
where my HAML has: 我的HAML所在的地方:
.choose-files
= s3_uploader_form callback_url: videos_url,
callback_param: 'video[direct_upload_url]',
id: 's3-uploader',
expiration: 24.hours.from_now.utc.iso8601,
max_file_size: 100.megabytes,
acl: 'public-read' do
.small.button#choose-file{data: {upload: 'button'}} Choose File
.hide
= file_field_tag :file, multiple: true, id: 'upload-input'
- content_for :javascript do
:coffee
$ ->
$('#s3-uploader').S3Uploader
remove_completed_progress_bar: false
progress_bar_target: $('#uploads_container')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.