我目前正在测试Filepicker.io上传表单的功能,并且无法使文件上载正常工作。我为水豚使用Poltergeist驱动程序,并且从我已经能够执行的调试中,Filepicker iframe从不加载。我已经通过使用Poltergeist的远程调试来确认这一点。使用Filepicker.io和Capybara进行功能测试
下面是测试代码的示例:
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也产生任何结果。
我能够按照本指南,http://mscottford.com/post/30910962407/getting-spooky-remote-debugging-with-poltergeist-on,并使用Poltergeist进行远程调试。在进一步检查页面时,我可以看到Filepicker接口和iframe未打开,但没有给出控制台错误。 – Adam 2013-04-09 21:52:10