mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 12:42:16 +08:00
DEV: Set a browser read timeout in capybara (#24757)
This commit is contained in:
parent
ce7504631a
commit
5b91dc1844
1
Gemfile
1
Gemfile
|
@ -128,6 +128,7 @@ group :test do
|
|||
gem "minitest", require: false
|
||||
gem "simplecov", require: false
|
||||
gem "selenium-webdriver", "~> 4.14", require: false
|
||||
gem "selenium-devtools", require: false
|
||||
gem "test-prof"
|
||||
gem "rails-dom-testing", require: false
|
||||
gem "minio_runner", require: false
|
||||
|
|
|
@ -461,6 +461,8 @@ GEM
|
|||
google-protobuf (~> 3.23)
|
||||
sass-embedded (1.66.1-x86_64-linux-gnu)
|
||||
google-protobuf (~> 3.23)
|
||||
selenium-devtools (0.120.0)
|
||||
selenium-webdriver (~> 4.2)
|
||||
selenium-webdriver (4.16.0)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
|
@ -647,6 +649,7 @@ DEPENDENCIES
|
|||
ruby-readability
|
||||
rubyzip
|
||||
sanitize
|
||||
selenium-devtools
|
||||
selenium-webdriver (~> 4.14)
|
||||
shoulda-matchers!
|
||||
sidekiq
|
||||
|
|
|
@ -176,6 +176,7 @@ end
|
|||
RSpec.configure { |config| config.extend Prefabrication }
|
||||
|
||||
PER_SPEC_TIMEOUT_SECONDS = 30
|
||||
BROWSER_READ_TIMEOUT = 30
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.fail_fast = ENV["RSPEC_FAIL_FAST"] == "1"
|
||||
|
@ -387,7 +388,8 @@ RSpec.configure do |config|
|
|||
options.add_preference("download.default_directory", Downloads::FOLDER)
|
||||
end
|
||||
|
||||
driver_options = { browser: :chrome }
|
||||
client = Selenium::WebDriver::Remote::Http::Default.new(read_timeout: BROWSER_READ_TIMEOUT)
|
||||
driver_options = { browser: :chrome, http_client: client }
|
||||
|
||||
if ENV["CAPYBARA_REMOTE_DRIVER_URL"].present?
|
||||
driver_options[:browser] = :remote
|
||||
|
|
|
@ -148,16 +148,11 @@ module SystemHelpers
|
|||
end
|
||||
|
||||
def using_browser_timezone(timezone, &example)
|
||||
previous_browser_timezone = ENV["TZ"]
|
||||
|
||||
ENV["TZ"] = timezone
|
||||
|
||||
using_session(timezone) do |session|
|
||||
page.driver.browser.devtools.emulation.set_timezone_override(timezone_id: timezone)
|
||||
freeze_time(&example)
|
||||
session.quit
|
||||
end
|
||||
|
||||
ENV["TZ"] = previous_browser_timezone
|
||||
end
|
||||
|
||||
# When using parallelism, Capybara's `using_session` method can cause
|
||||
|
|
Loading…
Reference in New Issue
Block a user