1 # frozen_string_literal: true
5 ENV.delete("http_proxy")
7 ActiveSupport.on_load(:action_dispatch_system_test_case) do
8 ActionDispatch::SystemTesting::Server.silence_puma = true
11 class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
12 include ActionMailer::TestCase::ClearTestDeliveries
14 Capybara.configure do |config|
15 config.enable_aria_label = true
18 cattr_accessor(:capybara_server_port) { ENV.fetch("CAPYBARA_SERVER_PORT", nil) }
20 served_by :host => "rails-app", :port => capybara_server_port if capybara_server_port
22 def self.driven_by_selenium(config_name = "default", opts = {})
23 preferences = opts.fetch(:preferences, {}).reverse_merge(
24 "intl.accept_languages" => "en"
31 if capybara_server_port
32 selenium_host = "http://selenium-#{config_name}:4444"
33 options = options.merge(
34 :url => selenium_host,
41 :using => Settings.system_test_headless ? :headless_firefox : :firefox,
44 preferences.each do |name, value|
45 options.add_preference(name, value)
47 options.binary = Settings.system_test_firefox_binary if Settings.system_test_firefox_binary
55 osm_website_app = create(:oauth_application, :name => "OpenStreetMap Web Site", :scopes => "write_api write_notes")
56 Settings.oauth_application = osm_website_app.uid
68 within "form", :text => "Email Address or Username" do
69 fill_in "username", :with => user.email
70 fill_in "password", :with => "s3cr3t"
77 click_on "Logout", :match => :first
81 within("#sidebar_content", &)
84 def within_content_body(&)
85 within("#content > .content-body", &)
88 def within_content_heading(&)
89 within("#content > .content-heading", &)