[openstreetmap/openstreetmap-website] Use rack by default for system tests (PR #6878)

Tom Hughes notifications at github.com
Fri Mar 13 12:12:33 UTC 2026


@tomhughes commented on this pull request.



> +  # JavaScript. Note: js_test blocks get a separate browser session, so
+  # you must call sign_in_as within the block if authentication is needed.

Does this mean it's spinning up a new browser for each such test?

>          :url => selenium_host,
         :browser => :remote
       )
     end
 
-    driven_by(
-      :selenium,
-      :using => Settings.system_test_headless ? :headless_firefox : :firefox,
-      :options => options
-    ) do |options|
+    Capybara.register_driver driver_name do |app|
+      options = Selenium::WebDriver::Firefox::Options.new
+      options.add_argument("-headless") if headless

If this is the only place we're going to use `headless` why not just check the setting directly here?

> +    end
+
+    driver_name
+  end
+
+  # Define a test that uses a full browser via Selenium, for use in test
+  # classes that default to rack_test but have individual tests needing
+  # JavaScript. Note: js_test blocks get a separate browser session, so
+  # you must call sign_in_as within the block if authentication is needed.
+  #
+  # Pass driver_opts to customize the Selenium driver, e.g. to set
+  # browser language preferences:
+  #   js_test "name", :driver => "de", :preferences => { "intl.accept_languages" => "de" }
+  def self.js_test(name, driver_opts = {}, &block)
+    config_name = driver_opts.delete(:driver) || "default"
+    driver = register_selenium_driver(config_name, driver_opts)

If every test using selenium is re-registering the driver immediately before using it do we still need play all the name games to go different names for different option combinations?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6878#pullrequestreview-3943548494
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6878/review/3943548494 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260313/4ce9b35c/attachment.htm>


More information about the rails-dev mailing list