我目前正在对 Filepicker.io 上传表单进行功能测试,但无法让文件上传正常工作。我正在为 Capybara 使用Poltergeist驱动程序,并且从我能够进行的调试中,Filepicker iframe 永远不会加载。我已经通过使用 Poltergeist 的远程调试确认了这一点。
这是测试代码的示例:
within_fieldset 'Photos' do
click_button 'Find Photo'
end
within_frame 'filepicker_dialog' do
attach_file '#fileUploadInput', Rails.root.join('spec', 'files', 'photo.jpg')
end
并产生错误:
Failure/Error: within_frame '#filepicker_dialog' do
Capybara::Poltergeist::TimeoutError:
Timed out waiting for response to {"name":"push_frame","args":["#filepicker_dialog"]}. It's possible that this happened because something took a very long time (for example a page load was slow). If so, setting the Poltergeist :timeout option to a higher value will help (see the docs for details). If increasing the timeout does not help, this is probably a bug in Poltergeist - please report it to the issue tracker.
尝试通过 javascript 控制台手动触发 Filepicker 也不会产生任何结果。