Commit 66f66a03 authored by Maxime Orefice's avatar Maxime Orefice Committed by Stan Hu

Change capybara screenshots name

This MR updates our screenshots files names taken on test failures:
- Remove timestamps
- Use RSpec full_description method instead of the file_path
parent 17a3ad8b
---
title: Change capybara screenshots files names taken on tests failures
merge_request: 26788
author:
type: changed
......@@ -122,8 +122,10 @@ module QA
driver.browser.save_screenshot(path)
end
Capybara::Screenshot.append_timestamp = false
Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example|
::File.join(QA::Runtime::Namespace.name, example.file_path.sub('./qa/specs/features/', ''))
::File.join(QA::Runtime::Namespace.name, example.full_description.downcase.parameterize(separator: "_")[0..99])
end
Capybara.configure do |config|
......
......@@ -79,6 +79,11 @@ Capybara.ignore_hidden_elements = true
Capybara.default_normalize_ws = true
Capybara.enable_aria_label = true
Capybara::Screenshot.append_timestamp = false
Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example|
::File.join(QA::Runtime::Namespace.name, example.full_description.downcase.parameterize(separator: "_")[0..99])
end
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run
# From https://github.com/mattheworiordan/capybara-screenshot/issues/84#issuecomment-41219326
......
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