Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prune_strategy don't work, folder with screenshots is not automatic cleared #278

Open
Synkevych opened this issue Jan 31, 2021 · 0 comments

Comments

@Synkevych
Copy link

Hello guys.
In our application we use your gem and it works great with RSpec, Capybara. It creates screenshots for failed tests on local machine and after running Github Actions.
But we have a problem cleaning old screenshots in tmp/screenshots folder. The project is configured with default settings, so images are saved in the screenshots folder. New screenshots of failed tests are added to old ones and are difficult to find and distinguish from others.

The documentation states that capybara-screenshot has a default prune_strategy method for this, but it doesn't seem to work. Do you have any idea why it doesn't work and how you can fix it?

Here some setting from the project that might be useful:

Gemfile:

ruby '2.6.6'
gem 'rails', '5.2.0'

group :test do
  gem 'capybara'
  gem 'capybara-screenshot'
  gem 'webdrivers'
end

spec/rails_helper.rb:

require File.expand_path('../config/environment', __dir__)
abort('The Rails environment is running in production mode!') if Rails.env.production? || Rails.env.staging?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!

require 'capybara/rspec'
require 'capybara-screenshot/rspec'

Capybara.asset_host = 'http://localhost:5000'
Capybara::Screenshot.prune_strategy = :keep_last_run

# Also tried with this config:
# Capybara::Screenshot.prune_strategy = { keep: 20 }

Thanks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant