1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Don't start the server for the failure screenshot

When `before_setup` fails, for example with fixture errors, the failure is stored, `setup` is skipped, and `take_failed_screenshot` is called.  Taking a screenshot triggers starting the server which will probably fail since fixtures are not properly loaded.  This generates another failure and makes it harder to debug the fixture failure.

If the server was not already started, it makes no sense to take a screenshot since it is not relevant.

This commit skips taking a failure screenshot if no browser session has been started.
This commit is contained in:
Uwe Kubosch 2021-12-11 11:58:51 +01:00 committed by GitHub
parent a35a380c2c
commit 1dfcffb583
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,7 +42,7 @@ module ActionDispatch
#
# +take_failed_screenshot+ is called during system test teardown.
def take_failed_screenshot
take_screenshot if failed? && supports_screenshot?
take_screenshot if failed? && supports_screenshot? && Capybara::Session.instance_created?
end
private