Skip to content

Commit

Permalink
Don't start the server for the failure screenshot
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
donv committed Dec 11, 2021
1 parent a35a380 commit 1dfcffb
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -42,7 +42,7 @@ def take_screenshot
#
# +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
Expand Down

0 comments on commit 1dfcffb

Please sign in to comment.