Skip to content

Commit 1dfcffb

Browse files
authored
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.
1 parent a35a380 commit 1dfcffb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def take_screenshot
4242
#
4343
# +take_failed_screenshot+ is called during system test teardown.
4444
def take_failed_screenshot
45-
take_screenshot if failed? && supports_screenshot?
45+
take_screenshot if failed? && supports_screenshot? && Capybara::Session.instance_created?
4646
end
4747

4848
private

0 commit comments

Comments
 (0)