diff --git a/docker-compose.yml b/docker-compose.yml index 064e8dec..8adaee3e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,12 +7,12 @@ services: image: "selenium/${SELENIUM_IMAGE:-standalone-chrome-debug}" volumes: - "/dev/shm:/dev/shm" - - "${PWD}:${PWD}" # For making attach_file specs work + # - "${PWD}:${PWD}" # For making attach_file specs work selenium_firefox: network_mode: "host" image: "selenium/${SELENIUM_IMAGE:-standalone-firefox-debug}" volumes: - "/dev/shm:/dev/shm" - - "${PWD}:${PWD}" # For making attach_file specs work + # - "${PWD}:${PWD}" # For making attach_file specs work environment: - SE_OPTS=-port 4445 diff --git a/spec/selenium_spec_chrome_remote.rb b/spec/selenium_spec_chrome_remote.rb index ea13777a..3e3528fe 100644 --- a/spec/selenium_spec_chrome_remote.rb +++ b/spec/selenium_spec_chrome_remote.rb @@ -39,6 +39,19 @@ module TestSessions Chrome = Capybara::Session.new(CHROME_REMOTE_DRIVER, TestApp) end +TestSessions::Chrome.driver.browser.file_detector = lambda do |args| + # args => ["/path/to/file"] + str = args.first.to_s + str if File.exist?(str) + end + +session.driver.browser.file_detector = lambda do |args| + # args => ["/path/to/file"] + str = args.first.to_s + str if File.exist?(str) +end + + skipped_tests = %i[response_headers status_code trigger download] # skip window tests when headless for now - closing a window not supported by chromedriver/chrome skipped_tests << :windows if ENV['TRAVIS'] && (ENV['SKIP_WINDOW'] || ENV['HEADLESS']) diff --git a/spec/selenium_spec_firefox_remote.rb b/spec/selenium_spec_firefox_remote.rb index 514e940d..dd3a8825 100644 --- a/spec/selenium_spec_firefox_remote.rb +++ b/spec/selenium_spec_firefox_remote.rb @@ -39,6 +39,12 @@ module TestSessions Firefox = Capybara::Session.new(FIREFOX_REMOTE_DRIVER, TestApp) end +TestSessions::Firefox.driver.browser.file_detector = lambda do |args| + # args => ["/path/to/file"] + str = args.first.to_s + str if File.exist?(str) +end + skipped_tests = %i[response_headers status_code trigger download] # skip window tests when headless for now - closing a window not supported by chromedriver/chrome skipped_tests << :windows if ENV['TRAVIS'] && (ENV['SKIP_WINDOW'] || ENV['HEADLESS']) diff --git a/spec/shared_selenium_session.rb b/spec/shared_selenium_session.rb index 4058cd86..aefdfd1d 100644 --- a/spec/shared_selenium_session.rb +++ b/spec/shared_selenium_session.rb @@ -264,27 +264,27 @@ RSpec.shared_examples "Capybara::Session" do |session, mode| end end - describe "#attach_file" do - before do - session.visit('/form') - end - - after do - session.driver.browser.file_detector = nil if session.driver.browser.respond_to?(:file_detector=) - end - - it "uploads the file when file_detector is used", :focus_ do - skip "Only test on remote drivers" unless session.driver.browser.respond_to?(:file_detector=) - session.driver.browser.file_detector = lambda do |args| - # args => ["/path/to/file"] - str = args.first.to_s - str if File.exist?(str) - end - session.attach_file "form_image", with_os_path_separators(__FILE__) - session.click_button('awesome') - expect(extract_results(session)['image']).to eq(File.basename(__FILE__)) - end - end + # describe "#attach_file" do + # before do + # session.visit('/form') + # end + # + # after do + # session.driver.browser.file_detector = nil if session.driver.browser.respond_to?(:file_detector=) + # end + # + # it "uploads the file when file_detector is used", :focus_ do + # skip "Only test on remote drivers" unless session.driver.browser.respond_to?(:file_detector=) + # session.driver.browser.file_detector = lambda do |args| + # # args => ["/path/to/file"] + # str = args.first.to_s + # str if File.exist?(str) + # end + # session.attach_file "form_image", with_os_path_separators(__FILE__) + # session.click_button('awesome') + # expect(extract_results(session)['image']).to eq(File.basename(__FILE__)) + # end + # end context "Windows" do it "can't close the primary window" do