2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2018-12-19 14:47:15 +00:00
|
|
|
require_relative './set_up'
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.before(:each, type: :system) do
|
|
|
|
|
2020-12-10 09:17:26 +00:00
|
|
|
Capybara.register_server :puma_wrapper do |app, port, host, **_options|
|
|
|
|
|
|
|
|
# update fqdn Setting according to random assigned Rack server port
|
|
|
|
Setting.set('fqdn', "#{host}:#{port}")
|
|
|
|
|
|
|
|
# start a silenced Puma as application server
|
2021-07-06 07:52:22 +00:00
|
|
|
Capybara.servers[:puma].call(app, port, host, Silent: true, Host: '0.0.0.0', Threads: '0:16')
|
2020-12-10 09:17:26 +00:00
|
|
|
end
|
|
|
|
Capybara.server = :puma_wrapper
|
2018-12-19 14:47:15 +00:00
|
|
|
|
|
|
|
# set the Host from gather container IP for CI runs
|
|
|
|
if ENV['CI'].present?
|
|
|
|
ip_address = Socket.ip_address_list.detect(&:ipv4_private?).ip_address
|
|
|
|
host!("http://#{ip_address}")
|
|
|
|
end
|
|
|
|
|
|
|
|
# set custom Zammad driver (e.g. zammad_chrome) for special
|
|
|
|
# functionalities and CI requirements
|
2020-08-21 08:18:31 +00:00
|
|
|
driven_by(:"zammad_#{ENV.fetch('BROWSER', 'firefox')}")
|
2020-12-15 11:29:07 +00:00
|
|
|
|
|
|
|
browser_width = ENV['BROWSER_WIDTH'] || 1024
|
|
|
|
browser_height = ENV['BROWSER_HEIGHT'] || 800
|
|
|
|
page.driver.browser.manage.window.resize_to(browser_width, browser_height)
|
2018-12-19 14:47:15 +00:00
|
|
|
end
|
|
|
|
end
|