Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make page&screen shot on cuke failure
diff --git a/features/support/env.rb b/features/support/env.rb
index c26248a..d461a01 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -76,3 +76,17 @@ Before do |scenario|
# Reset overridden settings
AppConfig.reset_dynamic!
end
+
+Cucumber::Formatter::LegacyApi::Ast::StepInvocation.class_eval do
+ alias_method :orig_accept, :accept
+
+ def accept formatter
+ orig_accept(formatter)
+ if status == :failed
+ formatter.runtime.support_code.ruby.current_world.instance_eval do
+ save_page
+ save_screenshot
+ end
+ end
+ end
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment