rails / rails

Ruby on Rails
https://rubyonrails.org
MIT License
55.93k stars 21.64k forks source link

System test screenshot path is not configurable #41828

Closed dmolesUC closed 3 years ago

dmolesUC commented 3 years ago

Steps to reproduce

  1. create a Rails project using capybara and selenium-webdriver for system tests.
  2. set Capybara.save_path to some directory, e.g. ci-artifacts/screenshots
  3. write and run a system test that fails and takes a screenshot

Expected behavior

Actual behavior

Notes

The issue is in ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper#absolute_path, which hard-codes the screenshot directory to tmp/screenshots.

It's not critical that it follow Capybara.save_path (although it is counterintuitive that it doesn't), but it would be nice if there was some way to configure where these go.

System configuration

Rails version: 6.0.3.5, but 6.1.3.1 (linked above) has the same code (as does main, at least as of this writing)

Ruby version: 2.7.2

lfalcao commented 3 years ago

@dmolesUC yes, it shouldn't be hardcode... can you send a PR?

you can use a symbolic link in the meantime: ln -fs tmp/screenshots ci-artifacts/screenshots