Commit 3ffea8a4 authored by Maxime Orefice's avatar Maxime Orefice

Fix capybara screenshot attachment

This commit fixes the way we generate our attachment tag during
a test failure. It is now using the same configuration than QA.

Apply code review feedback
parent f1173f87
...@@ -170,14 +170,16 @@ RSpec.configure do |config| ...@@ -170,14 +170,16 @@ RSpec.configure do |config|
Capybara.raise_server_errors = false Capybara.raise_server_errors = false
example.run example.run
ensure
Capybara.raise_server_errors = true
end
config.append_after do |example|
if example.metadata[:screenshot] if example.metadata[:screenshot]
screenshot = example.metadata[:screenshot][:image] || example.metadata[:screenshot][:html] screenshot = example.metadata[:screenshot][:image] || example.metadata[:screenshot][:html]
screenshot&.delete_prefix!(ENV.fetch('CI_PROJECT_DIR', ''))
example.metadata[:stdout] = %{[[ATTACHMENT|#{screenshot}]]} example.metadata[:stdout] = %{[[ATTACHMENT|#{screenshot}]]}
end end
ensure
Capybara.raise_server_errors = true
end end
config.after(:example, :js) do |example| config.after(:example, :js) do |example|
......
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