mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Test for directory upload support
This commit is contained in:
parent
1054005906
commit
88fdacaeac
3 changed files with 23 additions and 0 deletions
|
@ -547,6 +547,11 @@ New line after and before textarea tag
|
|||
<input type="file" name="form[multiple_documents][]" id="form_multiple_documents" multiple="multiple" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="form_directory_upload">Directory Upload</label>
|
||||
<input type="file" name="form[multiple_documents][]" id="form_directory_upload" multiple="multiple" webkitdirectory="webkitdirectory" mozdirectory="mozdirectory" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="submit" value="Upload Multiple"/>
|
||||
<p>
|
||||
|
|
|
@ -334,6 +334,20 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|||
end
|
||||
end
|
||||
|
||||
describe 'Capybara#Node#attach_file' do
|
||||
it 'can attach a directory', :focus_ do
|
||||
pending "Geckodriver doesn't support uploading a directory" if marionette?(session)
|
||||
pending "Selenium remote doesn't support transferring a directory" if remote?(session)
|
||||
pending "Headless Chrome doesn't support directory upload - https://bugs.chromium.org/p/chromedriver/issues/detail?id=2521&q=directory%20upload&colspec=ID%20Status%20Pri%20Owner%20Summary" if chrome?(session) && ENV['HEADLESS']
|
||||
|
||||
session.visit('/form')
|
||||
@test_file_dir = File.expand_path('./fixtures', File.dirname(__FILE__))
|
||||
session.attach_file('Directory Upload', @test_file_dir)
|
||||
session.click_button('Upload Multiple')
|
||||
expect(session.body).to include('5 | ') # number of files
|
||||
end
|
||||
end
|
||||
|
||||
context 'Windows' do
|
||||
it "can't close the primary window" do
|
||||
expect do
|
||||
|
|
|
@ -42,6 +42,10 @@ module Capybara
|
|||
def browser_name(session)
|
||||
session.driver.browser.browser if session.respond_to?(:driver)
|
||||
end
|
||||
|
||||
def remote?(session)
|
||||
session.driver.browser.is_a? ::Selenium::WebDriver::Remote::Driver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue