Allow capybara to upload screenshots to S3

pull/5591/head
Oliver Günther 8 years ago
parent d5c62e4fb0
commit a98f71e203
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 1
      Gemfile
  2. 10
      Gemfile.lock
  3. 20
      spec/support/capybara.rb

@ -193,6 +193,7 @@ group :test do
gem 'capybara', '~> 2.13.0'
gem 'capybara-screenshot', '~> 1.0.14'
gem 'aws-sdk', '~> 2.9.25'
gem 'fuubar', '~> 2.2.0'
gem 'capybara-select2', git: 'https://github.com/goodwill/capybara-select2', ref: '585192e'
gem 'capybara-ng', '~> 0.2.7'

@ -173,6 +173,14 @@ GEM
execjs
awesome_nested_set (3.1.3)
activerecord (>= 4.0.0, < 5.2)
aws-sdk (2.9.25)
aws-sdk-resources (= 2.9.25)
aws-sdk-core (2.9.25)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-resources (2.9.25)
aws-sdk-core (= 2.9.25)
aws-sigv4 (1.0.0)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
@ -329,6 +337,7 @@ GEM
interception (0.5)
ipaddress (0.8.3)
iso8601 (0.9.1)
jmespath (1.3.1)
json (1.8.6)
json_spec (1.1.4)
multi_json (~> 1.0)
@ -613,6 +622,7 @@ DEPENDENCIES
airbrake (~> 5.1.0)
autoprefixer-rails (~> 6.7.7.2)
awesome_nested_set (~> 3.1.3)
aws-sdk (~> 2.9.25)
bcrypt (~> 3.1.6)
bourbon (~> 4.3.4)
capybara (~> 2.13.0)

@ -1,4 +1,5 @@
require 'capybara/rspec'
require 'capybara-screenshot'
require 'capybara-screenshot/rspec'
require 'rack_session_access/capybara'
@ -7,6 +8,24 @@ RSpec.configure do
Capybara.javascript_driver = :selenium
end
##
# Configure capybara-screenshot
# Remove old images automatically
Capybara::Screenshot.prune_strategy = :keep_last_run
# Set up S3 uploads if desired
if ENV['OPENPROJECT_ENABLE_CAPYBARA_SCREENSHOT_S3_UPLOADS']
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
@ -45,3 +64,4 @@ Capybara.register_driver :selenium do |app|
desired_capabilities: capabilities
)
end

Loading…
Cancel
Save