Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix spec failure detection to log browser console

Christophe Bliard91c8d717e8b5
diff --git a/spec/support/capybara_browser_logs.rb b/spec/support/capybara_browser_logs.rb
index dc8dea94e6f..d7f9faf372f 100644
--- a/spec/support/capybara_browser_logs.rb
+++ b/spec/support/capybara_browser_logs.rb
@@ -19,8 +19,15 @@ module Capybara::BrowserLogs
private
+ # borrowed from capybara-screenshot code
def failed?(example)
- example.execution_result.status == :failed
+ return true if example.exception
+ return false unless defined?(::RSpec::Expectations::FailureAggregator)
+
+ failure_notifier = ::RSpec::Support.failure_notifier
+ return false unless failure_notifier.is_a?(::RSpec::Expectations::FailureAggregator)
+
+ failure_notifier.failures.any? || failure_notifier.other_errors.any?
end
end
end