OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/spec/support/capybara.rb

40 lines
1.1 KiB

require 'capybara/rspec'
require 'capybara-screenshot'
require 'capybara-screenshot/rspec'
require 'rack_session_access/capybara'
require 'action_dispatch'
RSpec.configure do |config|
Capybara.default_max_wait_time = 4
Capybara.javascript_driver = :chrome_headless_en
end
##
# Configure capybara-screenshot
# Remove old images automatically
Capybara::Screenshot.prune_strategy = :keep_last_run
# Don't silence puma if we're using it
Capybara.register_server :thin do |app, port, host|
require 'rack/handler/thin'
Rack::Handler::Thin.run(app, Port: port, Host: host, signals: false)
end
Capybara.server = :thin
# Set up S3 uploads if desired
if ENV['OPENPROJECT_ENABLE_CAPYBARA_SCREENSHOT_S3_UPLOADS'] && ENV['AWS_ACCESS_KEY_ID']
Capybara::Screenshot.s3_configuration = {
s3_client_credentials: {
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
secret_access_key: ENV.fetch('AWS_ACCESS_KEY_SECRET'),
region: ENV.fetch('AWS_REGION', 'eu-west-1')
},
bucket_name: ENV.fetch('S3_BUCKET_NAME', 'openproject-travis-logs')
}
end
Rails.application.config do
config.middleware.use RackSessionAccess::Middleware
end