Commit 542765fb authored by Maxime Orefice's avatar Maxime Orefice Committed by Heinrich Lee Yu

Add rspec stdout metadata

Ties a capybara screenshot to a rspec failing test
parent d0290377
......@@ -44,11 +44,21 @@ module QA
new.visit(address, page_class, &block)
end
# rubocop: disable Metrics/AbcSize
def self.configure!
RSpec.configure do |config|
config.define_derived_metadata(file_path: %r{/qa/specs/features/}) do |metadata|
metadata[:type] = :feature
end
config.around(:each) do |example|
example.run
if example.metadata[:screenshot]
screenshot = example.metadata[:screenshot][:image] || example.metadata[:screenshot][:html]
example.metadata[:stdout] = %{[[ATTACHMENT|#{screenshot}]]}
end
end
end
Capybara.server_port = 9887 + ENV['TEST_ENV_NUMBER'].to_i
......@@ -140,6 +150,7 @@ module QA
config.default_normalize_ws = true
end
end
# rubocop: enable Metrics/AbcSize
class Session
include Capybara::DSL
......
......@@ -126,6 +126,12 @@ RSpec.configure do |config|
Capybara.raise_server_errors = false
example.run
if example.metadata[:screenshot]
screenshot = example.metadata[:screenshot][:image] || example.metadata[:screenshot][:html]
example.metadata[:stdout] = %{[[ATTACHMENT|#{screenshot}]]}
end
ensure
Capybara.raise_server_errors = true
end
......
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