Skip to content

Commit

Permalink
Upload Capybara screenshots to S3 in the CI environment.
Browse files Browse the repository at this point in the history
  • Loading branch information
fonglh committed Jan 9, 2019
1 parent 23275eb commit 6465818
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ group :test do
gem 'capybara-selenium'
gem 'chromedriver-helper'

gem 'aws-sdk-s3'
# Make screen shots in tests, helps with the debugging of JavaScript tests.
gem 'capybara-screenshot'
end
Expand Down
17 changes: 17 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,21 @@ GEM
autoprefixer-rails (9.4.4)
execjs
awesome_print (1.8.0)
aws-eventstream (1.0.1)
aws-partitions (1.106.0)
aws-sdk-core (3.35.0)
aws-eventstream (~> 1.0)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-kms (1.11.0)
aws-sdk-core (~> 3, >= 3.26.0)
aws-sigv4 (~> 1.0)
aws-sdk-s3 (1.23.0)
aws-sdk-core (~> 3, >= 3.26.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
aws-sigv4 (1.0.3)
baby_squeel (1.3.1)
activerecord (>= 4.2.0)
join_dependency (~> 0.1.2)
Expand Down Expand Up @@ -283,6 +298,7 @@ GEM
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jmespath (1.4.0)
join_dependency (0.1.4)
activerecord (>= 4.2.0)
jquery-rails (4.3.3)
Expand Down Expand Up @@ -548,6 +564,7 @@ DEPENDENCIES
acts_as_tenant
after_commit_action
autoprefixer-rails
aws-sdk-s3
baby_squeel
bootstrap-sass
bootstrap-sass-extras (>= 0.0.7)!
Expand Down
18 changes: 18 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,22 @@

# Old school have_tag, with_tag(and more) matchers for rspec 3
config.include RSpecHtmlMatchers

# Upload Capybara screenshots to S3 in CI
if ENV['CI']
Capybara::Screenshot.s3_configuration = {
s3_client_credentials: {
access_key_id: ENV['CAPYBARA_SCREENSHOT_ACCESS_KEY_ID'],
secret_access_key: ENV['CAPYBARA_SCREENSHOT_SECRET_ACCESS_KEY'],
region: ENV['CAPYBARA_SCREENSHOT_REGION']
},
bucket_name: ENV['CAPYBARA_SCREENSHOT_BUCKET_NAME']
}

Capybara::Screenshot.s3_object_configuration = {
acl: 'public-read'
}

Capybara::Screenshot.prune_strategy = { keep: 10 }
end
end

0 comments on commit 6465818

Please sign in to comment.