mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Merge pull request #2436 from Ana06/screenshot
Store screenshot when feature test fails
This commit is contained in:
commit
0197ed3c46
1 changed files with 6 additions and 3 deletions
|
|
@ -4,13 +4,16 @@ RSpec.configure do |config|
|
|||
config.after(:each, type: :feature) do
|
||||
example_filename = RSpec.current_example.full_description
|
||||
example_filename = example_filename.tr(' ', '_')
|
||||
example_filename += '.html'
|
||||
example_filename = File.expand_path(example_filename, Capybara.save_path)
|
||||
example_screenshotname = "#{example_filename}.png"
|
||||
example_filename += '.html'
|
||||
if RSpec.current_example.exception.present?
|
||||
save_page(example_filename)
|
||||
save_page(example_screenshotname)
|
||||
# remove the file if the test starts working again
|
||||
elsif File.exist?(example_filename)
|
||||
File.unlink(example_filename)
|
||||
else
|
||||
File.unlink(example_filename) if File.exist?(example_filename)
|
||||
File.unlink(example_screenshotname) if File.exist?(example_screenshotname)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue