mirror of
https://github.com/mastodon/mastodon
synced 2024-11-27 06:18:17 +09:00
Extract capybara config and improve headless_chrome driver config (#28681)
This commit is contained in:
parent
543d7890fd
commit
8422b8ded0
@ -108,8 +108,6 @@ RSpec.configure do |config|
|
||||
end
|
||||
|
||||
config.around :each, type: :system do |example|
|
||||
driven_by :selenium, using: :headless_chrome, screen_size: [1600, 1200]
|
||||
|
||||
# The streaming server needs access to the database
|
||||
# but with use_transactional_tests every transaction
|
||||
# is rolled-back, so the streaming server never sees the data
|
||||
|
31
spec/support/capybara.rb
Normal file
31
spec/support/capybara.rb
Normal file
@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Capybara.server_host = 'localhost'
|
||||
Capybara.server_port = 3000
|
||||
Capybara.app_host = "http://#{Capybara.server_host}:#{Capybara.server_port}"
|
||||
|
||||
require 'selenium/webdriver'
|
||||
|
||||
Capybara.register_driver :chrome do |app|
|
||||
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
||||
end
|
||||
|
||||
Capybara.register_driver :headless_chrome do |app|
|
||||
options = Selenium::WebDriver::Chrome::Options.new
|
||||
options.add_argument '--headless=new'
|
||||
options.add_argument '--window-size=1680,1050'
|
||||
|
||||
Capybara::Selenium::Driver.new(
|
||||
app,
|
||||
browser: :chrome,
|
||||
options: options
|
||||
)
|
||||
end
|
||||
|
||||
Capybara.javascript_driver = :headless_chrome
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.before(:each, type: :system) do
|
||||
driven_by Capybara.javascript_driver
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user