[ARVADOS] created: 86ac7a774a81b1e081dc68e44826ad0615e3c3ed

git at public.curoverse.com git at public.curoverse.com
Thu Nov 26 13:40:44 EST 2015


        at  86ac7a774a81b1e081dc68e44826ad0615e3c3ed (commit)


commit 86ac7a774a81b1e081dc68e44826ad0615e3c3ed
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Nov 26 13:50:32 2015 -0500

    7851: Choose available ports for selenium and poltergeist.
    
    Also, display the chosen port numbers at startup.
    
    Without this the Selenium driver defaults to 7055, which causes
    interference between concurrent test runs.

diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb
index 207ddd1..a59ac87 100644
--- a/apps/workbench/test/integration_helper.rb
+++ b/apps/workbench/test/integration_helper.rb
@@ -4,21 +4,41 @@ require 'capybara/poltergeist'
 require 'uri'
 require 'yaml'
 
+def available_port for_what
+  Addrinfo.tcp("0.0.0.0", 0).listen do |srv|
+    port = srv.connect_address.ip_port
+    STDERR.puts "Using port #{port} for #{for_what}"
+    return port
+  end
+end
+
+SELENIUM_OPTS = {
+  port: available_port('selenium'),
+}
+
 POLTERGEIST_OPTS = {
-  window_size: [1200, 800],
   phantomjs_options: ['--ignore-ssl-errors=true'],
-  inspector: true,
+  port: available_port('poltergeist'),
+  window_size: [1200, 800],
 }
 
 Capybara.register_driver :poltergeist do |app|
   Capybara::Poltergeist::Driver.new app, POLTERGEIST_OPTS
 end
 
+Capybara.register_driver :poltergeist_debug do |app|
+  Capybara::Poltergeist::Driver.new app, POLTERGEIST_OPTS.merge(inspector: true)
+end
+
 Capybara.register_driver :poltergeist_without_file_api do |app|
   js = File.expand_path '../support/remove_file_api.js', __FILE__
   Capybara::Poltergeist::Driver.new app, POLTERGEIST_OPTS.merge(extensions: [js])
 end
 
+Capybara.register_driver :selenium do |app|
+  Capybara::Selenium::Driver.new app, SELENIUM_OPTS
+end
+
 Capybara.register_driver :selenium_with_download do |app|
   profile = Selenium::WebDriver::Firefox::Profile.new
   profile['browser.download.dir'] = DownloadHelper.path.to_s
@@ -28,7 +48,7 @@ Capybara.register_driver :selenium_with_download do |app|
   profile['browser.download.manager.showWhenStarting'] = false
   profile['browser.helperApps.alwaysAsk.force'] = false
   profile['browser.helperApps.neverAsk.saveToDisk'] = 'text/plain,application/octet-stream'
-  Capybara::Selenium::Driver.new app, profile: profile
+  Capybara::Selenium::Driver.new app, SELENIUM_OPTS.merge(profile: profile)
 end
 
 module WaitForAjax

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list