Commit b8a54fc0 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'rs-capybara-screenshot-artifacts' into 'master'

Store capybara screenshots as build artifacts

Closes #13971

See merge request !7985
parents bdc1a55e a61c1977
...@@ -67,9 +67,11 @@ stages: ...@@ -67,9 +67,11 @@ stages:
- knapsack rspec "--color --format documentation" - knapsack rspec "--color --format documentation"
artifacts: artifacts:
expire_in: 31d expire_in: 31d
when: always
paths: paths:
- knapsack/
- coverage/ - coverage/
- knapsack/
- tmp/capybara/
.spinach-knapsack: &spinach-knapsack .spinach-knapsack: &spinach-knapsack
stage: test stage: test
...@@ -85,9 +87,11 @@ stages: ...@@ -85,9 +87,11 @@ stages:
- knapsack spinach "-r rerun" || retry '[[ -e tmp/spinach-rerun.txt ]] && bundle exec spinach -r rerun $(cat tmp/spinach-rerun.txt)' - knapsack spinach "-r rerun" || retry '[[ -e tmp/spinach-rerun.txt ]] && bundle exec spinach -r rerun $(cat tmp/spinach-rerun.txt)'
artifacts: artifacts:
expire_in: 31d expire_in: 31d
when: always
paths: paths:
- knapsack/
- coverage/ - coverage/
- knapsack/
- tmp/capybara/
# Prepare and merge knapsack tests # Prepare and merge knapsack tests
......
require 'spinach/capybara' require 'spinach/capybara'
require 'capybara/poltergeist' require 'capybara/poltergeist'
require 'capybara-screenshot/spinach'
# Give CI some extra time # Give CI some extra time
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 30 : 10 timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 30 : 10
...@@ -20,12 +21,8 @@ end ...@@ -20,12 +21,8 @@ end
Capybara.default_max_wait_time = timeout Capybara.default_max_wait_time = timeout
Capybara.ignore_hidden_elements = false Capybara.ignore_hidden_elements = false
unless ENV['CI'] || ENV['CI_SERVER'] # Keep only the screenshots generated from the last failing test suite
require 'capybara-screenshot/spinach' Capybara::Screenshot.prune_strategy = :keep_last_run
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run
end
Spinach.hooks.before_run do Spinach.hooks.before_run do
TestEnv.warm_asset_cache unless ENV['CI'] || ENV['CI_SERVER'] TestEnv.warm_asset_cache unless ENV['CI'] || ENV['CI_SERVER']
......
require 'capybara/rails' require 'capybara/rails'
require 'capybara/rspec' require 'capybara/rspec'
require 'capybara/poltergeist' require 'capybara/poltergeist'
require 'capybara-screenshot/rspec'
# Give CI some extra time # Give CI some extra time
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 30 : 10 timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 30 : 10
...@@ -21,12 +22,8 @@ end ...@@ -21,12 +22,8 @@ end
Capybara.default_max_wait_time = timeout Capybara.default_max_wait_time = timeout
Capybara.ignore_hidden_elements = true Capybara.ignore_hidden_elements = true
unless ENV['CI'] || ENV['CI_SERVER'] # Keep only the screenshots generated from the last failing test suite
require 'capybara-screenshot/rspec' Capybara::Screenshot.prune_strategy = :keep_last_run
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run
end
RSpec.configure do |config| RSpec.configure do |config|
config.before(:suite) do config.before(:suite) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment